Blitz is a small full-stack example project containing a FastAPI backend, static frontend pages, redis for quick reads, mysql as main DB and supporting Docker configuration for easy deployment.
This repository includes a docker-compose.yml that defines a small stack:
db(MySQL 8.0) — container_name:mysql-db, exposes host port3306.redis(Redis 7) — container_name:redis-cache, exposes port6379.backend— built from./backend(container_name:blitz-app). The backend expects the database atDB_HOST=db:3306and Redis atredis:6379. The FastAPI app listens on port8080inside the container (proxied by nginx).nginx— container_name:blitz-nginx, maps host port80to container port80and servesfrontend/while proxying/api/to the backend.
Steps to run the full stack from the repository root:
docker-compose up --build -dFollow logs for the whole stack or a single service:
docker-compose logs -f # all services
docker-compose logs -f backend # single servicePopulate the MySQL DB (the compose mounts database/1_populate.sql to init the DB, but you can also run it manually):
# If you need to run the SQL manually against the running mysql-db container
docker exec -i mysql-db mysql -u root -proot_password sales < database/1_populate.sqlOpen the frontend at http://localhost/ (nginx serves static files). API requests are proxied at http://localhost/api/ to the backend (FastAPI running in blitz-app container).
The primary supported deployment method is Docker Compose (see above).
- Check
docker-compose.ymlfor environment variables (DB credentials, ports). Ensure those values match when running local DB instances. portals/nginx/nginx.confcontains example routing. Adjust upstream/backend hostnames and ports if you run services on different addresses/ports.
backend/main.py— FastAPI application entrypoint.backend/requirements.txt— Python dependencies for the backend.frontend/— Static UI pages.database/1_populate.sql— SQL script to create/seed database.docker-compose.yml— Compose file to build and run services in Docker.portals/nginx/nginx.conf— Example nginx reverse-proxy/static config.
- If containers fail to start, run
docker-compose logs -fto inspect errors. - If the backend is unreachable, confirm the service port in
docker-compose.ymland innginx.confmatch the Uvicorn port. - When running locally, ensure your virtual environment's Python version matches the project's requirements (Python 3.13 is present in the repo venv).