Check it out here: supfastapi on npm
- CLI Tool: Easily generate new FastAPI projects from the command line.
- Template System: Uses Handlebars templates for flexible project generation.
- Modular Structure: Includes pre-built modules for authentication, database integration (Supabase), configuration, and more.
- Best Practices: Follows modern Python and FastAPI best practices for project layout and code organization.
- Extensible: Add or customize templates to fit your needs.
- π Quick Setup: Generate a complete FastAPI project in seconds
- ποΈ Database Options: Choose between PostgreSQL (with Docker), Supabase, or no database
- π Authentication: Optional Supabase authentication integration
- π³ Docker Ready: Optional Docker and docker-compose configuration
- π¦ Poetry Integration: Modern Python dependency management with Poetry
- π§ CRUD Operations: Pre-built CRUD directory structure for PostgreSQL projects
- π§ͺ Migration Support: Alembic integration for database migrations
- β‘ Database Scripts: Automated
db.shscript for database management - π Well Documented: Generated projects include comprehensive documentation
- π― Best Practices: Follows FastAPI and Python best practices
- Node.js 14+ (for running the CLI)
- Python 3.11+ (for generated projects)
- Poetry (for Python dependency management)
- Docker (optional, for PostgreSQL database)
Install SuperFastAPI globally via npm:
npm install -g supfastapiOr use it directly with npx (no installation required):
npx supfastapi my-api-projectCreate a new FastAPI project:
superfastapi my-awesome-apiThe CLI will guide you through the setup process with interactive prompts:
-
Database Setup: Choose your database option
- No database setup
- Supabase (cloud database)
- PostgreSQL (requires Docker)
-
Authentication: Enable Supabase authentication (if using Supabase)
-
Docker Setup: Include Docker configuration files
When you select PostgreSQL, SuperFastAPI automatically includes:
- Docker Configuration:
Dockerfile,docker-compose.yml,.dockerignore - Database Client: SQLAlchemy setup with PostgreSQL
- Migrations: Alembic configuration for database migrations
- CRUD Operations: Pre-built CRUD directory structure
- Database Management:
db.shscript for common database operations
Supabase option provides:
- Database Client: Supabase Python client setup
- Authentication: Optional JWT-based authentication system
- Environment Configuration: Pre-configured environment variables
- API Routes: Ready-to-use authentication endpoints
my-awesome-api/
βββ app/
β βββ __init__.py
β βββ main.py # FastAPI application entry point
β βββ core/
β β βββ __init__.py
β β βββ config.py # Application configuration
β βββ api/
β β βββ __init__.py
β β βββ routes/ # API route handlers
β β βββ schemas/ # Pydantic models
β β βββ middleware/ # Custom middleware
β βββ db/
β β βββ __init__.py
β β βββ postgres.py # Database connection (if PostgreSQL)
β βββ crud/ # CRUD operations (PostgreSQL only)
β β βββ __init__.py
β βββ models/ # Database models
β βββ services/ # Business logic
β βββ utils/ # Utility functions
βββ tests/
β βββ __init__.py
βββ alembic/ # Database migrations (PostgreSQL only)
βββ docker-compose.yml # Docker services (if Docker enabled)
βββ Dockerfile # Application container (if Docker enabled)
βββ db.sh # Database management script (PostgreSQL only)
βββ pyproject.toml # Poetry configuration
βββ example.env # Environment variables template
βββ start.sh # Application startup script
βββ README.md # Project documentation
For projects with PostgreSQL, use these commands:
# Start PostgreSQL database only
docker-compose up -d postgres
# Install Python dependencies
poetry install
# Run database migrations
./db.sh migrate
# Start the FastAPI application
poetry run uvicorn app.main:app --reloadThe generated db.sh script provides convenient database operations:
# Check database status
./db.sh status
# Create a new migration
./db.sh create "add_users_table"
# Apply migrations
./db.sh migrate
# Show current migration
./db.sh current
# Show migration history
./db.sh history
# Open PostgreSQL shell
./db.sh shell
# Show all available commands
./db.sh helpGenerated projects include an example.env file. Copy it to .env and configure:
cp example.env .envDATABASE_URL=postgresql://postgres:postgres@localhost:5432/my_awesome_apiSUPABASE_URL=your_supabase_project_url
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key # For auth featuressuperfastapi basic-api
# Select: No database setup
# Select: No Docker setupsuperfastapi postgres-api
# Select: PostgreSQL (requires Docker)
# Docker setup is automatically includedsuperfastapi supabase-api
# Select: Supabase (cloud database)
# Select: Yes for authentication
# Select: Yes/No for Docker setupnpm testWe welcome contributions! Please see our Contributing Guidelines for detailed information on how to contribute to this project.
This project is licensed under the MIT License - see the LICENSE file for details.
- π§ Email: mohdmursaleen1207@gmail.com
- π Issues: GitHub Issues
Made with β€οΈ for the FastAPI community