v0.3.0 — New: hbk add <module> — plug Stripe, Docker & more into existing projects

The All-in-One Full-Stack Backend Solution

Auth, database, migrations, Docker, tests, and payments — wired up and production-ready out of the box. Pair it with an AI coding assistant and ship in minutes: faster, cheaper, and more reliable than asking it to build the same stack from scratch.

$ pip install hatchback πŸ“‹ Copied!
🏁 Get Started View on GitHub β†’
10+ CLI Commands
< 30s Project Setup
0 Config To Production

Built for Speed. Engineered for Scale.

Everything you need to go from zero to production β€” no corners cut.

πŸš€

Production Ready

FastAPI, SQLAlchemy 2.0, Pydantic v2, and Alembic migrations — pre-wired and ready to deploy.

πŸ›‘οΈ

Secure by Default

Rate limiting, JWT auth, secure secret generation, and non-root Docker containers.

⚑

Blazing Fast

Optional uv support for lightning-fast dependency management and virtualenvs.

πŸ—οΈ

Clean Architecture

Service-Repository pattern for maintainable, testable, and scalable code from day one.

βœ…

Testing Ready

Integrated pytest setup with a single hbk test command. No excuses.

🐳

Dockerized

Ready-to-deploy docker-compose setup with healthchecks and non-root security.

πŸ€–

AI-Powered

Built-in Agent Skills for GitHub Copilot and VS Code agent mode β€” your AI understands your project.

πŸ’³

Stripe Integration

Opt-in payment stack: checkout sessions, signed webhooks, and plans, subscriptions & payments tables wired into your DB.

🧩

Modular Extensions

Add new capabilities to an existing project with hbk add <module>. No re-init, no glue code — the installer wires up requirements, env vars, routes and models for you.

🏎️

Drift Mode

A CLI that drives as good as it looks. Scaffold, migrate, seed, and test β€” all from the terminal.


From Zero to API in 30 Seconds

Four steps. That's all it takes to get a fully scaffolded, production-ready FastAPI project.

1

Install Hatchback

Grab it from PyPI β€” it's lightweight and has zero heavy dependencies.

$ pip install hatchback
2

Initialize Your Project

Scaffold a complete FastAPI project with database, auth, Docker, and tests. Add --stripe to bundle a full payments stack.

$ hbk init my_project --stripe # Creates: routes, models, schemas, services, repos, tests, docker, alembic… # + Stripe: payment service, webhook, plans/subscriptions/payments tables
3

Generate Resources

Don't write boilerplate β€” generate models, schemas, services, and routes in one command.

$ hbk make product # βœ“ Model, Schema, Repository, Service, and Route created # βœ“ Automatically registered in your app
4

Start the Engine

Fire up the dev server with hot-reloading and you're live.

$ hbk run # 🏎️ Server live at http://localhost:8000 # πŸ“„ Docs at http://localhost:8000/docs

Full CLI Reference

Every command at your fingertips. All accessible via hbk or hatchback.

Command Description
hbk init <name> --stripe Initialize a new project with full scaffolding (add --stripe for payments)
hbk add <module> Install an optional module (stripe, docker, …) into an existing project
hbk add --list List available optional modules
hbk run Start dev server with hot-reload
hbk make <resource> Scaffold a new resource (model, schema, service, route…)
hbk remove <name> Remove a scaffolded resource or uninstall a module (auto-detected)
hbk migrate create -m "msg" Create a new Alembic migration
hbk migrate apply Apply pending database migrations
hbk migrate downgrade Rollback the last migration (-r -2 for multiple steps)
hbk seed Seed database with initial data (tenant + admin)
hbk inspect --url <db_url> Inspect existing DB and generate models & scaffolds
hbk upgrade Sync latest agent skills and infra files
hbk test Run the test suite

Service-Repository Architecture

A clean, layered architecture that keeps your code modular and testable.

🌐 Routes HTTP endpoints
β†’
βš™οΈ Services Business logic
β†’
πŸ—„οΈ Repositories Data access
β†’
πŸ’Ύ Models SQLAlchemy ORM
my_project/ β”œβ”€β”€ .github/ β”‚ └── skills/ # Agent Skills for AI assistants β”œβ”€β”€ app/ β”‚ β”œβ”€β”€ config/ # Database, Security, Limiter β”‚ β”œβ”€β”€ models/ # SQLAlchemy Database Models β”‚ β”œβ”€β”€ schemas/ # Pydantic Data Schemas β”‚ β”œβ”€β”€ repositories/ # Data Access Layer (CRUD) β”‚ β”œβ”€β”€ services/ # Business Logic β”‚ β”œβ”€β”€ routes/ # API Endpoints β”‚ β”œβ”€β”€ dependencies.py β”‚ └── main.py β”œβ”€β”€ alembic/ # Database Migrations β”œβ”€β”€ tests/ # Pytest Suite β”œβ”€β”€ docker-compose.yml └── requirements.txt

Stripe in One Flag

Pass --stripe at init — or run hbk add stripe in an existing project — to ship payments with a verified webhook, DB-backed plans, subscriptions and payments. No extra wiring.

1

Opt in at init

The CLI installs the Stripe SDK, adds the required env vars, models, repositories, service and routes. Already past init? Just run hbk add stripe — same result, no re-bootstrap.

$ hbk init my_app --stripe $ # or, on an existing project: $ hbk add stripe # + app/services/payment.py, routes/payment.py # + models: Plan, Subscription, Payment # + STRIPE_API_KEY / STRIPE_WEBHOOK_SECRET in .env
2

Create the tables

Alembic autogenerate picks up the new models. Run the initial migration once.

$ hbk migrate create -m "add stripe tables" $ hbk migrate apply # tables: plans, subscriptions, payments
3

Endpoints ready out of the box

A full payment surface, all under /payments.

GET  /payments/plans GET  /payments/subscriptions/me GET  /payments/me POST /payments/checkout-session POST /payments/webhook  # Stripe signature verified
4

Webhook events persisted automatically

The webhook handler verifies the Stripe signature and updates your DB — idempotent, retry-safe, and tenant-aware via metadata.

# checkout.session.completed β†’ Payment row # payment_intent.succeeded/failed β†’ Payment row (upsert) # customer.subscription.* β†’ Subscription row (upsert)