Production-grade FastAPI project generator for Python backends
Project description
๐จ FastForge
Production-grade FastAPI project generator for Python backends.
FastForge generates a ready-to-run, production-grade FastAPI project with SOLID architecture, structured logging, Docker containerization, and async CRUD โ all in under 30 seconds.
Use Cases
FastForge is for teams and developers who need to ship production Python APIs fast:
| Use Case | What FastForge Generates |
|---|---|
| Microservice backend | REST API with async CRUD, health checks, structured logging, Docker โ ready to deploy |
| Event-driven service | Kafka/RabbitMQ/NATS producer + consumer, structured events, async processing |
| Data API layer | PostgreSQL/MySQL/MongoDB with async ORM, repository pattern, Pydantic schemas |
| Internal tooling API | Fast scaffolding with security headers middleware, CORS, structured error handling |
| Hackathon / MVP | Working API with Docker in 30 seconds โ skip the boilerplate, start building |
| Team standardization | Enforce consistent architecture, logging, testing, and deployment patterns across projects |
Example: Build an Order Service
$ pip install fastforge-cli
$ fastforge
? Project name: order-service
? Model name: order
? Log output: Stdout + File
? Log agent: Vector
? Log target: Elasticsearch
? Include debug compose? Yes
? Generate project? Yes
โ Project created: ./order-service
$ cd order-service
$ docker compose -f docker-compose.debug.yml up --build
# API running at http://localhost:8000/docs โ no venv needed
Standards & Architecture
Every generated project follows these standards:
SOLID Principles
| Principle | Implementation |
|---|---|
| Single Responsibility | Each layer has one job: routes handle HTTP, services hold business logic, repositories manage data |
| Open/Closed | Add new models by creating new files โ no modification to existing code needed |
| Liskov Substitution | Repository interfaces allow swapping implementations (in-memory โ PostgreSQL) |
| Interface Segregation | Small, focused interfaces โ Repository protocol with only the methods each consumer needs |
| Dependency Inversion | FastAPI's Depends() wires everything; services depend on abstractions, not implementations |
12-Factor App Compliance
| Factor | Implementation |
|---|---|
| Config | pydantic-settings โ all config via environment variables |
| Dependencies | pyproject.toml with pinned versions, no system-level deps |
| Backing services | Database, cache, streaming attached via URL config โ swap by changing env vars |
| Port binding | Self-contained HTTP server via uvicorn |
| Concurrency | Async I/O with asyncio โ scales via process managers (gunicorn, uvicorn workers) |
| Logs | Structured JSON to stdout/file โ treat logs as event streams |
| Dev/prod parity | Same Docker image for dev and prod, identical dependencies |
| Disposability | Graceful shutdown via lifespan events, health checks for orchestrators |
Code Quality
- Linting: ruff (replaces flake8 + isort + black)
- Testing: pytest + pytest-asyncio, async test client
- Type safety: Pydantic models for all request/response schemas
- Pre-commit hooks: Automated ruff + pytest on every commit
- Security: Non-root Docker user, security headers middleware, CORS configuration
Quick Start
pip install fastforge-cli
fastforge
That's it. Answer a few prompts and you get a running application.
What You Get (Basic Mode)
| Feature | Implementation |
|---|---|
| SOLID Architecture | Repository pattern + Service layer + Dependency Injection |
| Async CRUD API | FastAPI with full Create/Read/Update/Delete |
| Structured Logging | structlog with JSON output, request IDs, duration tracking |
| Docker | Slim Dockerfile, docker-compose, health checks |
| Debug Docker | docker-compose.debug.yml at project root โ no venv needed, auto-reload, debugpy on port 5678 |
| Security | Security headers middleware, CORS, non-root container |
| Testing | pytest + pytest-asyncio, 80%+ coverage out of the box |
| Code Quality | ruff linting, pre-commit hooks |
CLI Flow
$ fastforge
โโโโโโโโโโโฆโ โโโโโโโฆโโโโโโโโ
โ โฃ โ โโฃโโโ โ โ โฃ โ โโ โฆโโ โฆโโฃ
โ โฉ โฉโโโ โฉ โ โโโโฉโโโโโโโโ
Production-grade FastAPI Generator
โโ Choose your path โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Basic mode โ SOLID app, JSON logging, Docker, async โ
โ Advanced โ + Database, Cache, Streaming, Secrets โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
? Project name: order-service
? Model name: order
? Log output: Stdout + File
? Log agent: Vector
? Log target: Elasticsearch
? Include debug compose? Yes
? Generate project? Yes
โ Project created: ./order-service
Basic Mode (default)
Just 4-5 questions โ production-ready app with structured logging, Docker, and CRUD.
Advanced Mode
Enable with "Enable advanced configuration?" โ unlocks:
- Database โ PostgreSQL, MySQL, SQLite (SQLAlchemy async), MongoDB (Motor)
- Cache โ Redis, Memcached, In-memory (cachetools)
- Streaming โ Kafka, RabbitMQ, Redis Pub/Sub, NATS (producer + consumer)
- Secrets โ HashiCorp Vault, AWS Secrets Manager, Azure Key Vault, GCP Secret Manager
- Logging โ Vector or Fluent Bit sidecar โ Elasticsearch, OpenSearch, Kafka, Loki, or HTTP endpoint
- Quality Gate โ SonarQube, SonarCloud, Qodana, CodeClimate
Generated Project Structure
your-service/
โโโ app/
โ โโโ main.py # App factory + lifespan
โ โโโ config.py # pydantic-settings
โ โโโ dependencies.py # DI wiring
โ โโโ api/
โ โ โโโ routes/
โ โ โ โโโ health.py # Health + readiness
โ โ โ โโโ orders.py # CRUD routes
โ โ โโโ models/
โ โ โโโ order.py # Pydantic schemas
โ โโโ services/
โ โ โโโ order_service.py # Business logic
โ โโโ repositories/
โ โ โโโ order_repository.py # Data access (interface + impl)
โ โโโ middleware/
โ โโโ security_headers.py
โ โโโ logging_middleware.py
โโโ tests/
โ โโโ test_api.py
โโโ docker-compose.debug.yml # Dev: debugpy + auto-reload (no venv needed)
โโโ docker/
โ โโโ docker-compose.yml # Production stack
โ โโโ vector/ or fluentbit/ # Log agent config (if selected)
โโโ Dockerfile
โโโ pyproject.toml
โโโ .pre-commit-config.yaml
Run Immediately
cd your-service
# Option A: Docker (recommended โ no venv needed)
docker compose -f docker-compose.debug.yml up --build # dev + auto-reload
docker compose -f docker/docker-compose.yml up --build # production stack
# Option B: Local
pip install -e ".[dev]"
uvicorn app.main:app --reload
pytest
Log Agent Targets
When you select a log agent (Vector or Fluent Bit), FastForge asks where to send logs:
| Target | Description |
|---|---|
| Elasticsearch | Full-text search and analytics โ ELK stack |
| OpenSearch | AWS-managed alternative to Elasticsearch |
| Kafka | Log streaming to a Kafka topic for downstream consumers |
| Loki | Grafana's log aggregation system โ lightweight, label-based |
| HTTP | Generic HTTP endpoint โ works with any log ingestion API |
Extend Your Project
# Add features
fastforge add model # CRUD model (route, service, repo, tests)
fastforge add postgres # PostgreSQL database support
fastforge add observability # OpenTelemetry tracing + Prometheus metrics
# Deploy
fastforge deploy local # Build and run with docker compose
fastforge deploy compose # Production Docker Compose manifest
fastforge deploy swarm # Docker Swarm stack
fastforge deploy k8s # Kubernetes manifests
fastforge deploy helm # Helm chart
fastforge deploy marathon # Marathon app definition
# Security
fastforge secure setup # Gitleaks + Trivy configs
fastforge secure scan # Trivy image scan
fastforge secure sbom # CycloneDX SBOM
fastforge secure license # License compliance check
fastforge secure audit # Dependency vulnerability audit
# CI/CD
fastforge ci github # GitHub Actions pipeline
fastforge ci gitlab # GitLab CI pipeline
fastforge ci bitbucket # Bitbucket Pipelines
fastforge ci jenkins # Jenkinsfile
# Operations
fastforge infra # Standalone infrastructure stack
fastforge doctor # Project health check (8 checks)
Requirements
- Python 3.10+
- pip
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fastforge_cli-0.0.2.tar.gz.
File metadata
- Download URL: fastforge_cli-0.0.2.tar.gz
- Upload date:
- Size: 77.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68fa0f0ec85d9b14a152ad2224291e4e2c7588a764859ff111f4ef9ee62c8a83
|
|
| MD5 |
4a575257698215b22b295ca80fbe7c6a
|
|
| BLAKE2b-256 |
0b929adbd5e233d7195b2e1d2b8c433265f266e3bfdef258cfad957ebba4b694
|
Provenance
The following attestation bundles were made for fastforge_cli-0.0.2.tar.gz:
Publisher:
publish.yml on VibhuviOiO/fastforge-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastforge_cli-0.0.2.tar.gz -
Subject digest:
68fa0f0ec85d9b14a152ad2224291e4e2c7588a764859ff111f4ef9ee62c8a83 - Sigstore transparency entry: 1288385796
- Sigstore integration time:
-
Permalink:
VibhuviOiO/fastforge-cli@8449c5a404a85be3e88496f0d24088cc4e39de8f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/VibhuviOiO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8449c5a404a85be3e88496f0d24088cc4e39de8f -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file fastforge_cli-0.0.2-py3-none-any.whl.
File metadata
- Download URL: fastforge_cli-0.0.2-py3-none-any.whl
- Upload date:
- Size: 106.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b258887ed12766642710858263e5de81f0d817629c1786b5f39c5852f0bbddd
|
|
| MD5 |
8f552abf43ea69c6a8352484e9e75387
|
|
| BLAKE2b-256 |
0be8a13fea28bc658ced5278c97d9206696a964d0f197f72f7bf805741cb8a1e
|
Provenance
The following attestation bundles were made for fastforge_cli-0.0.2-py3-none-any.whl:
Publisher:
publish.yml on VibhuviOiO/fastforge-cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
fastforge_cli-0.0.2-py3-none-any.whl -
Subject digest:
2b258887ed12766642710858263e5de81f0d817629c1786b5f39c5852f0bbddd - Sigstore transparency entry: 1288385938
- Sigstore integration time:
-
Permalink:
VibhuviOiO/fastforge-cli@8449c5a404a85be3e88496f0d24088cc4e39de8f -
Branch / Tag:
refs/heads/main - Owner: https://github.com/VibhuviOiO
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8449c5a404a85be3e88496f0d24088cc4e39de8f -
Trigger Event:
workflow_dispatch
-
Statement type: