🧊 FCube CLI¶
Modern FastAPI Project & Module Generator
FCube CLI is a powerful code generation tool that creates production-ready FastAPI projects and modules following clean architecture principles, dependency injection patterns, and role-based access control.
What is FCube?¶
FCube is a CLI tool that generates production-ready FastAPI projects with:
- Complete Project Scaffolding - Generate full FastAPI projects with core infrastructure
- Modular User System - Add user module with configurable authentication (email, phone, or both)
- Plugin Architecture - Pre-built feature modules with automatic validation
- Modern Module Structure - Organized directories for models, schemas, crud, services, routes
- Docker Support - docker-compose with PostgreSQL, Redis, Celery, and Flower
- Alembic Migrations - Pre-configured async migrations
- Dependency Injection -
@lru_cachesingleton services with factory functions - Role-Based Routes - Separate public and admin route directories
- Permission System - RBAC with configurable permissions
- Transaction Management - "No Commit in CRUD" pattern
- Rich CLI - Beautiful terminal output with progress indicators
# Create a new project
fcube startproject MyApp
# Add user module with email authentication
fcube adduser --auth-type email
# Add referral plugin
fcube addplugin referral
# Create a custom module
fcube startmodule product
# Start the server
docker compose up -d
Why FCube?¶
The Problem¶
Starting a new FastAPI project means:
- Setting up project structure manually
- Configuring database connections
- Implementing auth from scratch
- Building common patterns repeatedly
This takes hours and often leads to inconsistent architectures across projects.
The Solution¶
FCube codifies our best practices into a generator:
| Without FCube | With FCube |
|---|---|
| 4+ hours of setup | 2 minutes |
| Inconsistent structure | Standardized architecture |
| Auth from scratch | Built-in JWT + role-based |
| Manual CRUD | Generated CRUD patterns |
| No plugin system | Extensible plugins |
Key Features¶
-
Modular Architecture
Each module is self-contained with its own models, schemas, CRUD, services, and routes.
-
Dependency Injection
Clean DI pattern with
@lru_cache()singleton services for testability. -
Database Patterns
SQLAlchemy 2.0 ORM, async sessions, Alembic migrations, and "No Commit in CRUD" pattern.
-
Authentication
Configurable auth with email/password, phone OTP, or both.
-
Plugin System
Add pre-built features like referral systems or deployment configs.
-
Code Generation
Templates for models, schemas, CRUD, services, and routes.
-
Docker Support
docker-compose with PostgreSQL, Redis, Celery, and Flower.
-
RBAC Permissions
Role-based access control with scoped permissions.
Quick Start¶
# Install FCube
pip install git+https://github.com/amal-babu-git/fcube.git
# Create a new project
fcube startproject MyApp
# Navigate to project
cd MyApp
# Add user module with email authentication
fcube adduser --auth-type email
# Add referral plugin
fcube addplugin referral
# Create a custom module
fcube startmodule product
# Start the server
docker compose up -d
That's it! Open http://localhost:8000/docs to see your API.
Documentation¶
-
Getting Started
Installation, first project, and basic usage.
-
Commands Reference
All CLI commands with options and examples.
-
Generated Architecture
Understand the project structure and patterns.
-
Plugin System
Use and create plugins for FCube.
-
Contributing
How to contribute to FCube development.