A FastAPI service that provides subscription and billing functionality. It includes authentication, CRUD operations, background tasks, and a Postgres + Redis backend.
- JWT authentication for secure access
- CRUD operations for users and subscriptions
- Billing simulation with Celery workers
- Postgres database with SQLAlchemy and Alembic migrations
- Redis for task queue management
- REST API with interactive docs at
/docs - Unit tests with pytest
cp .env.example .env
docker compose up --buildOnce running, open http://localhost:8000/docs to explore the API.
Environment variables are defined in .env. Key settings include:
POSTGRES_USER,POSTGRES_PASSWORD,POSTGRES_DBREDIS_URLSECRET_KEY
app/— FastAPI application codemigrations/— Alembic migration filestests/— Unit testsdocker-compose.yml— Services for API, Postgres, Redis, and worker
Run tests inside the container with:
docker compose run --rm api pytestThis project is intended as a portfolio example and starting point. It can be extended with real payment provider integration or additional features.