From repetitive FastAPI setups to a modular CLI generator

Published: (January 18, 2026 at 10:02 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Problem Statement

I’ve been building FastAPI projects in production for a while, and I kept running into the same problem every time I started a new service:

  • setting up database connections (PostgreSQL / MySQL / SQLite)
  • implementing JWT authentication
  • wiring up Redis for caching
  • configuring Celery for background tasks
  • writing Docker & Docker Compose configs
  • setting up Alembic migrations
  • configuring pytest (async, fixtures, etc.)

You know the drill.

Solution: Forge CLI

After doing this repeatedly, I extracted everything into a reusable, interactive CLI tool called Forge, which generates a FastAPI project based on the features you actually need.

pip install ningfastforge
forge init

The CLI walks you through a series of prompts, and based on your choices, it generates a complete project.

Features

  • ✅ A clean, production‑oriented FastAPI project structure
  • ✅ Database setup (PostgreSQL / MySQL / SQLite) using SQLModel or SQLAlchemy
  • ✅ JWT authentication (basic or full flow with email verification)
  • ✅ Redis integration for caching
  • ✅ Celery configuration for background tasks
  • ✅ Docker & Docker Compose ready to use
  • ✅ Alembic migrations
  • ✅ pytest setup with async support

The generator is modular:

  • Don’t need Redis? Skip it.
  • No authentication required? Skip it.
  • Only want a simple API with a database? That’s fine too.

Forge only generates the files and configuration for the features you select, instead of forcing a one‑size‑fits‑all template.

Feedback

I’d love to get feedback from other FastAPI users:

  • How do you usually bootstrap new FastAPI projects?
  • What parts do you find most annoying to set up repeatedly?
  • Are there features you’d expect from a tool like this but don’t see yet?

Thanks for reading 🙌

Back to Blog

Related posts

Read more »