Backcraft
Enterprise-grade FastAPI project generator with AI-powered business logic injection.
Backcraft turns a project description — a natural-language prompt, an interactive
wizard, or a canvas file — into a complete, working FastAPI backend: SQLAlchemy
models with real relationships, Alembic migrations, JWT authentication, CRUD
routes, tests, Docker/Kubernetes manifests, and optional integrations (Stripe
payments, Celery task queues, Prometheus/Grafana monitoring). With AI business
logic injection enabled (the default), Claude fills in real validation rules,
workflows, and domain logic instead of leaving # TODO stubs.
Requirements
- Python 3.9+
- An Anthropic API key for AI-powered generation
(
fullauto,chat, and business logic injection). Not required forgeneratewith--no-aioruse_business_logic=False.
Installation
pip install backcraft-engine
Or from source:
git clone <this-repository>
cd backcraft-backend
uv sync
Quickstart
Set your Anthropic API key once (stored in ~/.backcraft/credentials, never in
a project directory):
backcraft auth
Then generate a project from a one-line description:
backcraft fullauto "A task management API where users can create projects and tasks, with JWT authentication"
Backcraft analyzes the description, designs entities and relationships, shows
you a summary, and (after confirmation) generates the full project into
./generated/<app-name>/.
Other ways to build a project
# Step-by-step interactive wizard (terminal UI)
backcraft builder
# Same wizard, with a browser-based visual canvas (Next.js + React Flow)
backcraft builder --web
# Conversational, multi-turn chat instead of a single prompt
backcraft chat
# Generate directly from an existing canvas file (JSON/YAML)
backcraft generate --canvas my_project.json
# Validate a canvas file or an existing generated project
backcraft validate ./my_project
Run backcraft --help or backcraft <command> --help for the full option list.
What gets generated
- Models & migrations: SQLAlchemy 2.0 models (
Mapped/mapped_column), with realrelationship()/ForeignKeywiring for one-to-many, many-to-one, and many-to-many relationships, plus Alembic migrations. - API: FastAPI routes and Pydantic schemas per entity, JWT authentication, health checks, rate limiting, and (optionally) OAuth2/API-key auth.
- Tests: pytest suites (unit, integration, e2e) generated alongside the app.
- Infrastructure: Dockerfile, docker-compose (dev/prod), GitHub Actions and GitLab CI pipelines, nginx config, deploy/backup scripts.
- Optional integrations, enabled per-project via the canvas:
- Stripe checkout sessions + webhook handling
- Celery task queue (worker + beat, with a docker-compose service each)
- Prometheus metrics endpoint + scrape config, Grafana dashboard with provisioning
- Kubernetes manifests (Deployment, Service, Ingress, ConfigMap, Secret, HPA)
Configuration
Generated projects read their configuration from a .env file (see the
generated .env.example). Backcraft itself only needs ANTHROPIC_API_KEY,
which backcraft auth manages for you:
backcraft auth # prompt for and store a key
backcraft auth --status # check whether a key is configured
backcraft auth --clear # remove the stored key
Development
uv sync --extra dev
# Run the fast test suite (no API key required)
pytest tests/ -m "not slow and not requires_llm"
# Run the full suite, including the AI-powered generation tests
# (requires ANTHROPIC_API_KEY, calls the real Anthropic API, and is slow)
pytest tests/ -m "requires_llm"
# Lint and format
ruff check src/ && black src/ && isort src/
License
MIT — see LICENSE.
Metadata
Release files for backcraft-engine 3.2.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| backcraft_engine-3.2.7.tar.gz | 446.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| backcraft_engine-3.2.7-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 981.6 kB
Release files / backcraft_engine-3.2.7.tar.gz
| Download URL | backcraft_engine-3.2.7.tar.gz |
|---|---|
| Size | 446.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9513a4a95c4eb674f3408bf1c98c2d418d61be52433c0c6a7b8dd98dec3d16d6
|
|
BLAKE2b-256 checksum How to use checksums |
292159b8357aa5806c0808032dad5110a803c0cea3827393a79dbf0ea4eba894
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / backcraft_engine-3.2.7-py3-none-any.whl
| Download URL | backcraft_engine-3.2.7-py3-none-any.whl |
|---|---|
| Size | 534.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
428c27874775fa2681e207ebb94150ce78a2faae1ddef56b08ed8de4bf3d1e08
|
|
BLAKE2b-256 checksum How to use checksums |
8be5748a0a884e29cdae3e9d68c692f104ac28e465a9aef3ce44aaa7057b0774
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|