Skip to main content

Scaffold a FastAPI + SQLAlchemy backend with SQLite/Postgres/MySQL and optional JWT + Google OAuth auth

Project description

backend-dash

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.

Features

  • Scaffold a complete FastAPI backend in seconds.
  • Supports --db=sqlite|postgres|mysql with 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_all for zero-config local development.
  • Optional --auth mode adds JWT + Google OAuth auth support.
  • Clear validation for unsupported database values.
  • Clean .env.example setup for local development and migrations.

Installation

One-off usage

uvx backend-dash init "My API"

Install locally

pip install backend-dash
backend-dash init "My API"

Editable install for development

git clone https://github.com/prathamdmehta/backend-dash.git
cd backend-dash
pip install -e . --break-system-packages

Usage

Create a new project:

backend-dash init "Demo Project"

Create a project with auth:

backend-dash init "Demo Project Auth" --auth

Choose a database:

backend-dash init "My API" --db=sqlite
backend-dash init "My API" --db=postgres
backend-dash init "My API" --db=mysql

Combine database and auth:

backend-dash init "My API" --db=postgres --auth

What gets generated

Base project

  • FastAPI app structure.
  • SQLAlchemy session and base model wiring.
  • Example item resource with CRUD routes.
  • Pydantic schemas and models.
  • Pytest test setup.

With --auth

  • Repository layer with a generic BaseRepository and UserRepository.
  • 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.

Database support

SQLite

SQLite is the default and uses create_all for a simple local setup.

PostgreSQL

For PostgreSQL, the scaffold uses Alembic migrations and real schema management.

MySQL

For MySQL, the scaffold also uses Alembic migrations and the correct MySQL driver setup.

Migrations

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 head

The generated .env.example includes the right migration flow so you can move from scaffold to production-style schema management quickly.

Project structure

my_api/
├── app/
├── tests/
├── alembic/
├── alembic.ini
└── .env.example

If --auth is enabled, additional auth-related modules are included inside the app structure.

Example

Generate a new API project:

backend-dash init "Orders API" --db=postgres --auth

This creates a FastAPI backend with database wiring, migrations, tests, and authentication already in place, so you can start on business logic immediately.

Development

git clone https://github.com/prathamdmehta/backend-dash.git
cd backend-dash
pip install -e . --break-system-packages

Then run the CLI locally:

backend-dash init "Demo Project"

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

backend_dash-0.1.0.tar.gz (17.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

backend_dash-0.1.0-py3-none-any.whl (31.8 kB view details)

Uploaded Python 3

File details

Details for the file backend_dash-0.1.0.tar.gz.

File metadata

  • Download URL: backend_dash-0.1.0.tar.gz
  • Upload date:
  • Size: 17.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for backend_dash-0.1.0.tar.gz
Algorithm Hash digest
SHA256 58b5f65678561a9ae9775ecd4b2c3c889ec68926f2e92e5388b33696b6affe5e
MD5 3d7a1ebc54f02e31cc781604fe55c20b
BLAKE2b-256 efbacf71f6be123ec4cc0f08353fd60281260bfcb63168ab99b08798d036f37a

See more details on using hashes here.

File details

Details for the file backend_dash-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: backend_dash-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for backend_dash-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d1a80ea1c99da6db7f9da48f86669ce4931d0d77adc07f7858a393212193332
MD5 e9a2332b4ba9702619187182bcdfb7f7
BLAKE2b-256 943b19e5e3e4852dd3b56aaf91e9350f48a09ba13a978a8549f34f037bb0ab90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page