Market API on FastAPI: registration for customers and sellers, company/product management, JWT auth, Celery email tasks, Redis cache/sessions.
- JWT authentication (access + refresh) and role-based access
- PostgreSQL + SQLAlchemy 2.0 async + Alembic
- Repository / Service layers with
dependency-injector - SQLAdmin, Celery/Flower, Prometheus metrics
- Docker multi-stage image with healthcheck
- Clone the repo and
cdinto it - Copy
.env-exampleto.envand fill values - Generate JWT keys:
mkdir -p certs
openssl genrsa -out certs/jwt-private.pem 2048
openssl rsa -in certs/jwt-private.pem -pubout -out certs/jwt-public.pem- Install with uv:
uv sync --group dev- Run migrations and start:
uv run alembic upgrade head
uv run python -m appcp .env-example .env
# put JWT PEMs in ./certs
docker compose up --build- API / Swagger:
http://localhost:9000/docs - Health:
http://localhost:9000/health - Admin:
http://localhost:9000/admin - Flower:
http://localhost:9999
uv sync --group dev
uv run coverage run -m pytest tests -v
uv run coverage report -mCoverage gate: ≥ 80% (fail_under in pyproject.toml). CI runs lint (ruff) then pytest + coverage on Python 3.12 with Postgres.
endpoints → services → repository → SQLAlchemy wired via app.core.container.Container (dependency-injector).