Metadata-Version: 2.4
Name: fastix
Version: 0.2.0
Summary: 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-URL: Homepage, https://github.com/paresh/fastix
Project-URL: Repository, https://github.com/paresh/fastix
Project-URL: Documentation, https://github.com/paresh/fastix#readme
Project-URL: Issues, https://github.com/paresh/fastix/issues
Project-URL: Changelog, https://github.com/paresh/fastix/blob/main/CHANGELOG.md
Author: Paresh
License: MIT
License-File: LICENSE
Keywords: alembic,api boilerplate,api generator,async,backend generator,celery,cicd,code generator,cookiecutter alternative,dapr,devops,docker,fastapi,fastapi boilerplate,fastapi cli,fastapi project generator,fastapi scaffold,fastapi starter,fastapi template,github actions,gitlab ci,grpc,helm,kafka,kubernetes,microservices,mongodb,monolith,postgresql,production ready,project scaffolding,project template,pydantic,python,rabbitmq,redis,rest api generator,sqlalchemy,uvicorn
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Code Generators
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: jinja2>=3.1.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: tomli>=2.0.1; python_version < '3.11'
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: interactive
Requires-Dist: questionary>=2.0.0; extra == 'interactive'
Description-Content-Type: text/markdown

<p align="center">
  <img src="https://img.shields.io/pypi/v/fastix?color=blue&label=PyPI" alt="PyPI version">
  <img src="https://img.shields.io/pypi/pyversions/fastix" alt="Python versions">
  <img src="https://img.shields.io/pypi/l/fastix" alt="License">
  <img src="https://img.shields.io/pypi/dm/fastix?color=green" alt="Downloads">
  <img src="https://img.shields.io/github/stars/paresh/fastix?style=social" alt="GitHub stars">
</p>

# 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.

```bash
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

```bash
# Basic install
pip install fastix

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

### Generate a Project

**Interactive mode** — guided wizard with sensible defaults:

```bash
fastix init
```

**Direct mode** — specify everything in one command:

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

**Full microservices setup:**

```bash
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

```bash
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](https://pypi.org/project/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](https://pypi.org/project/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

```python
# 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 responses** — `SuccessResponse[T]`, `ErrorResponse`, `PaginatedResponse[T]` contracts shared across your entire API
- **Custom exception hierarchy** — `NotFoundException`, `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:

```bash
# 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:

```bash
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:

```bash
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

```bash
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

```bash
pytest -q -p no:cacheprovider
```

### Building for Release

```bash
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](LICENSE) for details.

---

<p align="center">
  <b>Built for developers who ship fast.</b><br>
  <a href="https://pypi.org/project/fastix/">PyPI</a> ·
  <a href="https://github.com/paresh/fastix">GitHub</a> ·
  <a href="https://github.com/paresh/fastix/issues">Issues</a>
</p>
