v0.1.10 β€” Now with hbk migrate downgrade

The Drift-Ready Boilerplate for FastAPI

Bootstrap production-ready FastAPI applications in seconds. Pre-loaded with security, clean architecture, Docker, and AI-powered agent skills.

$ 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

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.

🏎️

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.

$ hbk init my_project # Creates: routes, models, schemas, services, repos, tests, docker, alembic...
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> Initialize a new project with full scaffolding
hbk run Start dev server with hot-reload
hbk make <resource> Scaffold a new resource (model, schema, service, route…)
hbk remove <resource> Remove a resource and clean up all imports
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