A CLI that generates ready-to-code FastAPI backend projects with SQLAlchemy, SQLite, PostgreSQL, MySQL, Alembic migrations, CRUD examples, tests, and optional JWT + Google OAuth authentication.
- Scaffold a complete FastAPI backend in seconds.
- Supports
--db=sqlite|postgres|mysqlwith SQLite as the default. - Generates a working SQLAlchemy setup and DB session wiring.
- Adds an example CRUD resource so you can start from real code, not boilerplate.
- Includes tests for the generated project.
- Adds Alembic migrations for PostgreSQL and MySQL.
- Keeps SQLite simple with
create_allfor zero-config local development. - Optional
--authmode adds JWT + Google OAuth auth support. - Clear validation for unsupported database values.
- Clean
.env.examplesetup for local development and migrations.
uvx backend-dash init "My API"pip install backend-dash
backend-dash init "My API"git clone https://github.com/prathamdmehta/backend-dash.git
cd backend-dash
pip install -e . --break-system-packagesCreate a new project:
backend-dash init "Demo Project"Create a project with auth:
backend-dash init "Demo Project Auth" --authChoose a database:
backend-dash init "My API" --db=sqlite
backend-dash init "My API" --db=postgres
backend-dash init "My API" --db=mysqlCombine database and auth:
backend-dash init "My API" --db=postgres --authAdd Docker support:
backend-dash init "My API" --db=postgres --dockerThis generates a Dockerfile, docker-compose.yml, and .dockerignore. For
--db=postgres/--db=mysql, the compose file includes the database service
too (with a healthcheck, so the app waits for the DB to actually be ready),
and Alembic migrations run automatically on container start. For the SQLite
default, it's just the app container with the DB file mounted as a volume.
cd my_api
cp .env.example .env
docker compose up --build- FastAPI app structure.
- SQLAlchemy session and base model wiring.
- Example item resource with CRUD routes.
- Pydantic schemas and models.
- Pytest test setup.
- Repository layer with a generic
BaseRepositoryandUserRepository. - Auth service for registration, login, JWT issuance, and Google token exchange.
- Validation with proper schema constraints.
- Centralized error handling with a consistent error response shape.
- Auth routes for register, login, me, Google login, and Google callback.
SQLite is the default and uses create_all for a simple local setup.
For PostgreSQL, the scaffold uses Alembic migrations and real schema management.
For MySQL, the scaffold also uses Alembic migrations and the correct MySQL driver setup.
For PostgreSQL and MySQL, the project generates Alembic configuration and an env.py wired to DATABASE_URL and your app metadata.
Typical workflow:
alembic revision --autogenerate -m "create initial tables"
alembic upgrade headThe generated .env.example includes the right migration flow so you can move from scaffold to production-style schema management quickly.
my_api/
├── app/
├── tests/
├── alembic/
├── alembic.ini
└── .env.exampleIf --auth is enabled, additional auth-related modules are included inside the app structure.
Generate a new API project:
backend-dash init "Orders API" --db=postgres --authThis creates a FastAPI backend with database wiring, migrations, tests, and authentication already in place, so you can start on business logic immediately.
git clone https://github.com/prathamdmehta/backend-dash.git
cd backend-dash
pip install -e . --break-system-packagesThen run the CLI locally:
backend-dash init "Demo Project"MIT