Skip to main content

Production-ready FastAPI project generator — scaffold monoliths, microservices, and AI backends with built-in logging, Docker, Kubernetes, Celery, CI/CD, and 30+ pluggable modules in seconds.

Project description

PyPI version Python versions License Downloads GitHub stars

Fastix — Production-Ready FastAPI Project Generator

Generate complete FastAPI projects in seconds, not hours. Fastix is a CLI tool that scaffolds production-grade FastAPI applications with your choice of database, message queue, worker, container, orchestration, CI/CD, logging, and 30+ pluggable modules — all wired together and ready to deploy.

pip install fastix
fastix init my_api

That's it. You get a fully structured project with async database sessions, structured logging, Docker Compose, CI/CD pipelines, health checks, shared API response contracts, and more — all configured and connected.


Why Fastix?

Every FastAPI project starts the same way: create the folder structure, set up the database connection, configure CORS, add health checks, write a Dockerfile, set up CI/CD, configure logging... Fastix eliminates 2-4 hours of boilerplate setup and gives you a clean, opinionated starting point that follows production best practices.

Problem Without Fastix With Fastix
Project structure Manual folder creation Architecture-first wizard
Database setup Copy-paste from docs Async sessions, connection pools, migrations — ready
Logging print() statements Structured JSON logs, request tracking, web dashboard
Docker Write Dockerfile from scratch Multi-stage build + Compose with all services
CI/CD Google "GitHub Actions FastAPI" Production pipeline generated
Health checks Forget until production Liveness + readiness probes included
CORS allow_origins=["*"] forever Configurable from environment variables
API responses Every endpoint returns different shapes Shared typed response contracts

Quick Start

Install

# Basic install
pip install fastix

# With interactive wizard (recommended)
pip install "fastix[interactive]"

Generate a Project

Interactive mode — guided wizard with sensible defaults:

fastix init

Direct mode — specify everything in one command:

fastix init my_api --db postgres --container docker --cicd github_actions

Full microservices setup:

fastix init platform_api \
  --arch microservices \
  --services gateway,users,orders \
  --protocol grpc \
  --db postgres \
  --queue redis \
  --worker celery \
  --container docker \
  --k8s helm \
  --logging api_logger

Run Your Project

cd my_api
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev]'
uvicorn app.main:app --reload

Open http://localhost:8000/docs — your API is live with Swagger UI.


What Gets Generated

Monolith Architecture

my_api/
├── app/
│   ├── api/v1/endpoints/      # Versioned API routes
│   ├── core/                  # Settings, config
│   ├── db/                    # Database sessions, connection pools
│   ├── logging/               # Structured logging setup
│   ├── models/                # SQLAlchemy / Beanie models
│   ├── schemas/               # Pydantic request/response schemas
│   ├── services/              # Business logic layer
│   └── shared/                # Response contracts, error handlers
├── tests/                     # Pytest + async test client
├── alembic/                   # Database migrations (SQL databases)
├── Dockerfile                 # Multi-stage production build
├── docker-compose.yml         # All services orchestrated
├── .github/workflows/ci.yml   # CI/CD pipeline
├── pyproject.toml             # Dependencies, linting, typing config
├── .env.example               # Environment variable reference
└── Makefile                   # Common dev commands

Microservices Architecture

platform_api/
├── services/
│   ├── gateway/               # API gateway service
│   │   ├── app/               # Full FastAPI app structure
│   │   ├── Dockerfile
│   │   └── tests/
│   ├── users/                 # User service
│   └── orders/                # Order service
├── shared/                    # Cross-service contracts & utilities
├── infra/                     # Kubernetes manifests / Helm charts
├── docker-compose.yml         # Full local dev environment
└── pyproject.toml

Features

30+ Pluggable Modules

Fastix uses a module registry pattern — every feature is a self-contained module that you can include or exclude. Modules auto-resolve dependencies (e.g., selecting Celery automatically enables Redis).

Category Options
Architecture Monolith, Microservices
Database PostgreSQL, MySQL, MongoDB, Snowflake
Message Queue Redis, Kafka, RabbitMQ
Cache Redis
Workers Celery, RQ
Schedulers Celery Beat, Kubernetes CronJob
Containers Docker, Podman
Orchestration Helm, Kustomize, Raw K8s Manifests
CI/CD GitHub Actions, GitLab CI
Logging fastapi-api-logger (structured JSON logs, web dashboard, request tracking)
Task Runners Makefile, Justfile, Taskfile
Testing Pytest (async), Factory Boy
Dev Tools Pre-commit hooks, EditorConfig
Microservice Transport HTTP/REST, gRPC, Dapr

Built-in Structured Logging

Every generated project includes fastapi-api-logger by default — a zero-config structured logging middleware that provides:

  • Structured JSON logs with timestamps, status codes, response times
  • Request ID tracking — every request gets a unique ID propagated through headers
  • Sensitive field masking — passwords, tokens, and secrets are automatically redacted
  • Web dashboard at /logs — filter, search, and analyze your API logs in the browser
  • Async, non-blocking — logging never slows down your API
  • Day-wise log rotation with automatic cleanup
  • Loguru integration for colored terminal output during development
# Generated in your project — zero configuration needed
from app.logging.setup import configure_logging
configure_logging(app)
# That's it. Structured logging is active.

Production-Ready Defaults

Every generated project follows production best practices out of the box:

  • Configurable CORS — no more allow_origins=["*"] in production; origins loaded from environment variables
  • Typed API responsesSuccessResponse[T], ErrorResponse, PaginatedResponse[T] contracts shared across your entire API
  • Custom exception hierarchyNotFoundException, BadRequestException, ForbiddenException with consistent JSON error responses
  • Health endpoints/health (liveness) and /health/ready (readiness) probes for Kubernetes
  • Environment-based settings — Pydantic Settings with .env file support and env_nested_delimiter
  • Async database sessions — connection pooling, proper cleanup, and rollback-on-error
  • Strict linting — Ruff with 15+ rule sets, mypy strict mode, isort configured
  • Test scaffolding — async test client with httpx, pytest-asyncio, coverage targets

Lifecycle Commands

Fastix isn't just a one-time scaffolder. It tracks your project state and lets you evolve it:

# See your project's current configuration
fastix inspect .

# Add modules to an existing project
fastix add-module dapr --path .
fastix add-module container.podman --path .
fastix add-module orchestration.helm --path .

# Switch between alternatives (auto-cleans old files)
fastix add-module cicd.gitlab_ci --path .    # switches from GitHub Actions

# List all available modules
fastix list-modules

When you switch modules (e.g., Docker to Podman), Fastix automatically removes the old module's files while preserving any files you've modified.


Configuration Options

CLI Flags

Every option can be set via CLI flags for scripting and CI/CD:

fastix init my_api \
  --arch monolith \
  --db postgres \
  --migrations \
  --queue redis \
  --cache redis \
  --worker celery \
  --scheduler celery_beat \
  --container docker \
  --k8s helm \
  --logging api_logger \
  --scripting makefile \
  --cicd github_actions \
  --testing \
  --precommit \
  --api-versioning \
  --health-checks \
  --shared-responses

Smart Defaults

Fastix validates your choices and applies safe defaults:

  • Selecting Celery automatically enables Redis as the message broker
  • Selecting RQ automatically enables Redis as the cache backend
  • Selecting Celery Beat automatically enables Celery and Redis
  • Selecting CronJob scheduler automatically enables raw K8s manifests
  • MongoDB and Snowflake automatically disable SQL migrations
  • Microservices default to gateway + users services if none specified
  • gRPC transport auto-enables native gRPC scaffolding with .proto files

Compatibility

Platform Status
Python 3.10 — 3.14 Supported
Linux Supported
macOS Supported
Windows Supported

Lightweight by design — only 5 runtime dependencies:

Dependency Purpose
typer CLI framework
rich Terminal formatting
jinja2 Template rendering
pydantic Configuration validation
tomli TOML parsing (Python 3.10 only)

Interactive prompts are optional:

pip install "fastix[interactive]"   # adds questionary

Comparison

Fastix vs Alternatives

Feature Fastix Cookiecutter Manual Setup
Interactive wizard Yes No No
Module system 30+ modules Template-only N/A
Post-scaffold lifecycle add-module, inspect None N/A
Smart dependency resolution Yes No Manual
Module switching with cleanup Yes No Manual
Microservices support Full workspace Limited Manual
Structured logging Built-in No DIY
Production Docker setup Auto-generated Template-only Manual
K8s orchestration Helm, Kustomize, Raw No Manual
gRPC + Dapr support Built-in No Complex

Development

git clone https://github.com/paresh/fastix.git
cd fastix
python -m venv .venv && source .venv/bin/activate
pip install -e '.[dev,interactive]'
pytest -q

Running Tests

pytest -q -p no:cacheprovider

Building for Release

python -m build --no-isolation
python -m twine check dist/*

Contributing

Fastix is designed to be easy to extend. Adding a new module requires:

  1. Create a template directory under src/fastix/modules/<category>/<name>/templates/
  2. Add one ModuleRegistry.register() call in src/fastix/modules/register.py
  3. Add a config enum value if needed

That's it — the module system handles the rest.


License

MIT License. See LICENSE for details.


Built for developers who ship fast.
PyPI · GitHub · Issues

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

fastix-0.2.0.tar.gz (57.8 kB view details)

Uploaded Source

Built Distribution

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

fastix-0.2.0-py3-none-any.whl (110.4 kB view details)

Uploaded Python 3

File details

Details for the file fastix-0.2.0.tar.gz.

File metadata

  • Download URL: fastix-0.2.0.tar.gz
  • Upload date:
  • Size: 57.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastix-0.2.0.tar.gz
Algorithm Hash digest
SHA256 832b56287b3dd4b3e72660d44d34d7c3e85315c90ac6dae7a67d8d91092f8107
MD5 a9334d62f620321fc626bd89f74d304d
BLAKE2b-256 5cac7a5f59436b5994e58c73dbb2193077d1b1acec0854f30464e7479ceba091

See more details on using hashes here.

File details

Details for the file fastix-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: fastix-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 110.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for fastix-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df451853804d5249d40fba820bf7ae5046d6934133e700e157b86c954e07519e
MD5 55896d89c9b3bf4b312bc39ad9a639ce
BLAKE2b-256 f49cdcee17796d2a4eaab120cbfd1b6b33273a477860d41abd61d007941d82da

See more details on using hashes here.

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