FastAPI-based authentication service with async SQLAlchemy, Redis-backed token controls, and Celery-powered email tasks.
For architecture and workflow deep dives, see TECHNICAL.md.
- User registration and login
- Access + refresh token flow
- Token refresh and logout with blacklist support
- Email verification and password reset workflows
- Request-id, timing, error handling, and rate-limiting middleware
- Python 3.14+
- FastAPI
- SQLAlchemy (async) + asyncpg
- Redis (async + sync client)
- Celery
- Alembic
- Pytest + pytest-asyncio
- Ruff (lint + format)
app/main.py- FastAPI app entrypointapp/api/v1/- versioned API routersapp/services/- business logicapp/repositories/- data access layerapp/models/- SQLAlchemy modelsapp/dependencies/- DI providers for DB/auth/redisapp/middleware/- error/timing/request-id/rate-limit middlewareapp/tasks/- Celery task definitionsalembic/- database migrationstests/- async API/integration tests
- Install dependencies:
uv sync- Start local services:
docker compose up -d- Run migrations:
uv run alembic upgrade head- Run API:
uv run uvicorn app.main:app --reload- (Optional) Run worker:
uv run celery -A app.celery_app worker --queues=critical,default --loglevel=info- Lint:
uv run ruff check . - Format:
uv run ruff format . - Compile check:
uv run python -m compileall app tests - Run all tests:
uv run pytest -q - Run test for one file:
uv run pytest tests/test_login.py - Run test for one test:
uv run pytest tests/test_login.py::test_login_success
GET /health
- All API routes are mounted under:
/api/v1
- Configuration is managed in
app/core/config.pyvia environment variables. - Local development values can be provided using
.env.