A dice-driven comic reading tracker built with FastAPI, React, and Tailwind CSS.
TESTS MUST NEVER BE SKIPPED - THIS IS NON-NEGOTIABLE.
When tests fail:
- β Fix the test
- β Fix the code that breaks the test
- β Investigate the root cause
- β NEVER skip, disable, or work around the test
This applies to ALL developers, ALL test suites, and ALL situations. No exceptions.
Skipped tests create technical debt and hide broken functionality. If a test is failing, it's telling you something is broken. Fix it.
- Backend: FastAPI (Python 3.13)
- Database: PostgreSQL with SQLAlchemy ORM (async-only via asyncpg)
- Migrations: Alembic
- Frontend: React + Vite + Tailwind CSS
- Styling: Tailwind CSS
- Testing: pytest with httpx.AsyncClient for API tests
- Auth: JWT authentication with refresh token rotation
- Code Quality: ruff linting, ty type checking, 96% coverage requirement
β οΈ IMPORTANT: Async PostgreSQL OnlyThis project uses asyncpg (async PostgreSQL) ONLY. Never use synchronous psycopg2.
- β USE:
asyncpg,create_async_engine(),AsyncSession- β NEVER USE:
psycopg2,psycopg,create_engine()(sync),Session(sync)Mixing sync/async database code will break the application. See AGENTS.md for details.
# Clone the repository
git clone https://github.com/JoshCLWren/comic-pile.git
cd comic-pile
# Install dependencies
uv sync --all-extras
# Activate the virtual environment
source .venv/bin/activate
# Set up the database
make migrate
# Seed sample data (optional)
make seed
# Run the development server
make devOpen http://localhost:8000 to view the app, or http://localhost:8000/docs for API documentation.
# Run the development server
make dev
# Run tests
pytest
make pytest
# Run tests with coverage
pytest --cov=comic_pile --cov-report=term-missing
# Run linting
make lint
# Seed database with sample data
make seed
# Run database migrations
make migratemake dev- Run FastAPI development server with hot reloadmake seed- Populate database with Faker sample datamake migrate- Run Alembic migrationsmake pytest- Run test suite with coveragemake lint- Run ruff and ty type checking
.
βββ app/ # FastAPI application
β βββ __init__.py
β βββ main.py # FastAPI app factory
β βββ api/ # API route handlers
β βββ models/ # SQLAlchemy database models
β βββ schemas/ # Pydantic request/response schemas
β βββ auth.py # JWT authentication
βββ comic_pile/ # Core package (dice ladder, queue, session logic)
βββ frontend/ # React frontend (Vite + Tailwind CSS)
βββ alembic/ # Database migration files
βββ scripts/ # Utility scripts (seed data, backups)
βββ static/ # Built frontend assets
βββ tests/ # pytest test suite
βββ tests_e2e/ # Playwright E2E tests
βββ docs/ # Technical documentation
βββ pyproject.toml # Project configuration
βββ uv.lock # Dependency lockfile
The project uses pytest with coverage reporting:
# Run all tests
pytest
# Run with verbose output
pytest -v
# Run with coverage
pytest --cov=comic_pile --cov-report=term-missingCoverage requirement: Minimum 96% (configured in pyproject.toml)
This project uses standard Python packages and does not depend on custom consolidated packages.
comic-pile
βββ FastAPI (web framework)
βββ SQLAlchemy (ORM)
βββ Alembic (migrations)
βββ PostgreSQL (database via asyncpg)
βββ PyJWT (authentication)
βββ React + Vite + Tailwind CSS (frontend)
# Run linter
ruff check .
# Fix auto-fixable issues
ruff check --fix .
# Format code
ruff format .# Run type checker
ty check --error-on-warningA pre-commit hook is installed automatically that runs:
- Python compilation check
- Ruff linting
- Any type usage check (disallows
Anytype) - ty type checking
The hook will block commits with issues. To test manually:
make githookThe app is configured with CORS enabled for local network access. To use the app on other devices:
-
Find your machine's local IP address:
- Linux/Mac:
ip addr showorifconfig - Windows:
ipconfig
- Linux/Mac:
-
Access from any device on your local network:
- App: http://YOUR_IP:8000 (e.g., http://192.168.1.5:8000)
- API docs: http://YOUR_IP:8000/docs
-
If firewall blocks connections, allow port 8000:
# Linux (ufw) sudo ufw allow 8000
| Document | Description |
|---|---|
| docs/API.md | REST API reference β endpoints, schemas, and examples |
| docs/REACT_ARCHITECTURE.md | Frontend architecture β components, hooks, contexts, build pipeline |
| docs/AUTH_USERS_MULTITENANT_PLAN.md | JWT auth design and multi-tenant isolation plan |
| docs/DATABASE_SAVE_LOAD.md | PostgreSQL backups, JSON export/import, disaster recovery |
| docs/rate_limiting.md | Per-endpoint rate limits via slowapi |
| docs/GIT_HOOKS.md | Pre-commit and pre-push hook setup |
| docs/frontend-backend-asset-coupling-audit.md | Asset pipeline audit and remediation plan |
| CONTRIBUTING.md | Development workflow and code quality standards |
| LOCAL_TESTING.md | Local test environment setup with fixtures and sample data |
| TECH_DEBT.md | Technical debt tracker β active items and resolution history |
| SECURITY.md | Docker security, SSL/TLS, secrets, container hardening |
| ROLLBACK.md | Database, Docker, and git rollback procedures |
| prd.md | Product Requirements Document (design source of truth) |
Interactive API docs are also available at /docs (Swagger UI) and /redoc when the server is running.
- Fork the repository
- Create a phase branch:
git checkout main && git checkout -b phase/2-database-models - Make your changes
- Run tests:
pytest - Run linting:
make lint - Commit with conventional commits
- Push and create a pull request
See CONTRIBUTING.md for detailed guidelines.
MIT License - see LICENSE file for details
Created by Josh Wren