Skip to main content

Production-grade FastAPI project generator for Python backends

Project description

๐Ÿ”จ FastForge

Production-grade FastAPI project generator for Python backends.

PyPI Python License: MIT

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 new

? 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 infra/docker-compose.yml up --build
# API running at http://localhost:8000/docs

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 new

Answer a few prompts and you get a running application.

Non-Interactive / Preset-Driven Generation

Skip the prompts entirely with a built-in preset (works straight from pip install, no repo clone needed):

# List all available presets
fastforge list-presets

# Generate from a built-in preset
fastforge new --preset simple-fastapi
fastforge new --preset postgres-api
fastforge new --preset observable-api
fastforge new --preset rag-observable

# Override the project name (preset stays the same)
fastforge new --preset postgres-api --name my-order-service

You can also load presets from a custom file (JSON or YAML):

fastforge new --from-file ./my-team-preset.fastforge.json
fastforge new --from-file ./my-team-preset.fastforge.yaml

The repo also ships example presets under examples/use-cases/ you can copy and tweak.

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 new

  โ•”โ•โ•—โ•”โ•โ•—โ•”โ•โ•—โ•”โ•ฆโ•—  โ•”โ•โ•—โ•”โ•โ•—โ•ฆโ•โ•—โ•”โ•โ•—โ•”โ•โ•—
  โ• โ•ฃ โ• โ•โ•ฃโ•šโ•โ•— โ•‘   โ• โ•ฃ โ•‘ โ•‘โ• โ•ฆโ•โ•‘ โ•ฆโ•‘โ•ฃ
  โ•š  โ•ฉ โ•ฉโ•šโ•โ• โ•ฉ   โ•š  โ•šโ•โ•โ•ฉโ•šโ•โ•šโ•โ•โ•šโ•โ•
  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)
โ”œโ”€โ”€ infra/
โ”‚   โ”œโ”€โ”€ 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 infra/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 redis         # Redis cache support
fastforge add kafka         # Kafka streaming (producer + consumer)
fastforge add observability # OpenTelemetry tracing + Prometheus metrics
fastforge add auth jwt      # JWT authentication (login + protected routes)
fastforge add ai-telemetry  # OTel spans + token cost attribution for AI calls

# 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 doctor            # Project health check (8 checks)
fastforge audit             # Capability drift + CVE + env contract
fastforge upgrade           # Re-apply generator deltas
fastforge plugins ls        # List discovered generator plugins

Roadmap & Feature Plans

Honest, public roadmap. Status keys: โœ… Shipped ยท ๐ŸŸก Partial ยท โ›” Planned

Core CLI

Status Feature Notes
โœ… fastforge new (interactive) standalone / app / lib / workspace shapes
โœ… fastforge add postgres / kafka / redis / observability / ai-telemetry Idempotent, capability-tracked
โœ… fastforge add model <name> CRUD scaffold + repository + service + tests
โœ… fastforge add auth jwt JWT login/me routes, PyJWT + passlib
โœ… fastforge plugins ls / install Entry-point discovery via fastforge.generators
โœ… fastforge doctor 8 health checks; friendly when run outside a project
โœ… fastforge audit Capability drift + dependency CVE scan
๐ŸŸก fastforge upgrade Command exists; needs version-delta migration corpus
โœ… fastforge new --from-file preset.fastforge.json Non-interactive scaffolding for reproducible use-case presets and CI smoke runs
โ›” fastforge ship One-command deploy to Fly.io / Railway / Cloud Run free tier โ€” closes the "60-second wow" loop with a real URL

AI Ecosystem

Status Feature Notes
โœ… AI gateway (litellm, bifrost) Hot-swappable via AI_GATEWAY_PROVIDER
โœ… Embeddings (openai, gemini, cohere, bedrock, huggingface, local) 6 providers, one factory
โœ… Vector stores (chromadb, pgvector, qdrant, opensearch, vertex_ai) 5 providers, one factory
โœ… App kinds (semantic_search, rag, agent) Picked once at fastforge new
โœ… fastforge add ai-telemetry OTel spans + USD cost + tenant ID + W3C trace propagation
โ›” fastforge add ai-eval Promptfoo + golden-set + CI integration for prompt regression tests
โ›” fastforge add ai-cache Semantic + exact response caching to cut LLM bills
โ›” fastforge add ai-guardrails PII redaction, prompt-injection detection, output validation

Plugin Ecosystem

Status Feature Notes
โœ… Entry-point group fastforge.generators Discoverable, documented protocol
โœ… BaseGenerator + capability_schema() Plugin protocol stable across 0.x
โœ… Plugin author docs Overview, authoring, reference, publishing pages on vibhuvioio.com
โ›” billing-stripe (first external) Stripe Checkout + webhooks + metered usage hook โ€” pairs with ai-telemetry for AI chargeback
โ›” auth-clerk Drop-in auth with current_user deps + webhook handlers
โ›” storage-s3 Presigned URLs + multipart + MinIO compose for local dev
โ›” auth-keycloak Enterprise OIDC + role guards
โ›” queue-celery Background jobs + Redis broker + Flower
โ›” email-resend Templated transactional email

Promotion / Adoption

Status Feature Notes
โœ… Production-grade core 202 unit tests + 3 E2E generated-project tests + 6 smoke scenarios; 70% coverage
โœ… Public docs site vibhuvioio.com/products/fastforge with 16 pages
โœ… Version 0.1.0 published to PyPI Single source of truth via importlib.metadata
๐ŸŸก README hero GIF Tape script in promo/; recording pending
โ›” Comparison page vs cookiecutter-fastapi / full-stack-fastapi-template High-leverage SEO
โ›” Reference app fastforge-shop End-to-end demo with billing + auth + AI
โ›” First 5 case studies Social proof for the ecosystem story

Out of scope (won't build)

To keep the project focused, these are explicitly not planned:

  • Hosted gateway / managed runtime โ€” FastForge generates code, you run it.
  • Model evaluation harness โ€” use promptfoo / lm-eval-harness alongside.
  • Fine-tuning pipelines โ€” vendor-specific, doesn't belong in a scaffolding tool.
  • Web playground โ€” high cost, medium impact; CLI install is fast enough.

Suggest a feature

Open an issue on GitHub tagged roadmap or send a PR adding a row to this table. Plugins that don't fit core are welcome under your own namespace โ€” see Authoring a Plugin.

Requirements

  • Python 3.10+
  • pip

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

fastforge_cli-0.3.0.tar.gz (155.3 kB view details)

Uploaded Source

Built Distribution

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

fastforge_cli-0.3.0-py3-none-any.whl (193.5 kB view details)

Uploaded Python 3

File details

Details for the file fastforge_cli-0.3.0.tar.gz.

File metadata

  • Download URL: fastforge_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 155.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fastforge_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 9e462b820fa9b11f3faa3919eb2a75faebe7178f786dd4eabdf56108af7d76a4
MD5 9cbdb7a25f3fd264a1fb3b083d719005
BLAKE2b-256 39b6977e358dda1d23a25e7863df9c5b2fa5d1e7e495b7035a19384001649ce9

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastforge_cli-0.3.0.tar.gz:

Publisher: publish.yml on VibhuviOiO/fastforge-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fastforge_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: fastforge_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 193.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for fastforge_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a89f7ae398e2dd74b47b9e1a290a1989a2004c8b38bd7474158ecb4cefc126b
MD5 4f4528b289ac57e12b13512b8634d2e7
BLAKE2b-256 abc3ef5c5779e2bc71c9f5dd02f76d510986fd32357e0d6ff8a6cd4161e69a19

See more details on using hashes here.

Provenance

The following attestation bundles were made for fastforge_cli-0.3.0-py3-none-any.whl:

Publisher: publish.yml on VibhuviOiO/fastforge-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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