Production-ready CLI to scaffold FastAPI and Flask projects with security, reliability, and 10+ boilerplate templates.
Project description
๐ BoilerPy
Lightning-fast FastAPI & Flask project scaffolding CLI
Installation โข Quick Start โข Templates โข Documentation
๐ฏ Why BoilerPy?
Stop wasting time setting up the same project structure over and over. BoilerPy generates production-ready FastAPI and Flask projects in seconds with:
- โ 10 Professional Templates - 5 FastAPI + 5 Flask templates
- ๐ Security First - JWT auth, password hashing, CORS, input validation
- โก Lightning Fast - Generate projects in < 5 seconds
- ๐จ Clean Architecture - Industry best practices built-in
- ๐ก๏ธ Production Ready - Error handling, logging, rollback on failure
- ๐ง Zero Configuration - Works out of the box
- ๐ Python 3.9+ - Modern Python support
- ๐ณ Docker Ready - Docker Compose for databases
๐ฆ Installation
Using pipx (Recommended)
pipx install boilerpy
Using pip
pip install boilerpy
From source
git clone https://github.com/Faizgeeky/boilerpy.git
cd boilerpy
pip install -e .
๐ Quick Start
1. List available templates
bpy list
2. Create a new project
bpy init fastapi
3. Follow the interactive prompts
- Select your template (1-5)
- Enter project name
- Done! Your project is ready ๐
Example
$ bpy init fastapi
============================================================
Available FASTAPI Templates
============================================================
1. API Only
Basic FastAPI project with routers and clean architecture
2. Authentication
FastAPI with JWT authentication, user management
3. SQL (SQLAlchemy + PostgreSQL)
FastAPI with SQLAlchemy, PostgreSQL, and Alembic migrations
Select template (1-5): 2
Enter project name: my-awesome-api
๐ Creating Authentication project: my-awesome-api
โ
Project created successfully!
๐ Next steps:
cd my-awesome-api
python -m venv venv
source venv/bin/activate
pip install -r requirements.txt
uvicorn app.main:app --reload
๐ API Docs: http://localhost:8000/docs
๐ Templates
๐ท FastAPI Templates
1. API Only - Clean REST API
Perfect for microservices and REST APIs
app/
โโโ main.py # FastAPI application
โโโ api/v1/
โ โโโ router.py # API router
โ โโโ endpoints/ # API endpoints
โโโ core/
โ โโโ config.py # Configuration
โโโ schemas/ # Pydantic models
2. Authentication - JWT Auth System
Production-ready authentication with JWT tokens
app/
โโโ main.py
โโโ api/v1/endpoints/
โ โโโ auth.py # Login, register
โ โโโ users.py # User management
โโโ core/
โ โโโ security.py # JWT utilities
โ โโโ dependencies.py # Auth dependencies
โโโ schemas/
โโโ user.py
โโโ token.py
3. SQL - SQLAlchemy + PostgreSQL
Full database setup with migrations
app/
โโโ models/ # SQLAlchemy models
โโโ crud/ # CRUD operations
โโโ core/
โ โโโ database.py # Database config
โโโ alembic/ # Migrations
โโโ docker-compose.yml # PostgreSQL setup
4. MongoDB - Motor Async Driver
MongoDB integration with async support
app/
โโโ core/
โ โโโ database.py # MongoDB connection
โโโ models/ # MongoDB models
โโโ crud/ # Database operations
5. CRM - Complete Application
Full CRM with users, customers, products, orders
app/
โโโ models/
โ โโโ user.py
โ โโโ customer.py
โ โโโ product.py
โ โโโ order.py
โโโ api/v1/endpoints/
โ โโโ auth.py
โ โโโ customers.py
โ โโโ orders.py
โโโ core/
โโโ database.py
โโโ security.py
๐ถ Flask Templates
1. API Only - Clean REST API
Blueprint-based Flask API with CORS and clean architecture
app/
โโโ api/v1/
โ โโโ endpoints/ # API endpoints
โ โ โโโ items.py # CRUD operations
โ โโโ __init__.py # Blueprint registration
โโโ core/
โ โโโ config.py # Configuration
โโโ schemas/ # Data validation
2. Authentication - JWT Auth System
Flask with JWT authentication and user management
app/
โโโ api/v1/endpoints/
โ โโโ auth.py # Register, login
โ โโโ users.py # User management
โโโ core/
โ โโโ security.py # JWT + password hashing
โ โโโ config.py # JWT settings
โโโ models/ # User models
3. SQL - SQLAlchemy + PostgreSQL
Flask with SQLAlchemy 2.0 and PostgreSQL
app/
โโโ models/ # SQLAlchemy models
โโโ crud/ # CRUD operations
โโโ schemas/ # Validation schemas
โโโ core/
โ โโโ database.py # SQLAlchemy setup
โโโ docker-compose.yml # PostgreSQL
4. MongoDB - PyMongo Integration
Flask with PyMongo and advanced querying
app/
โโโ core/
โ โโโ database.py # MongoDB connection
โโโ models/ # MongoDB models
โโโ api/v1/endpoints/
โ โโโ items.py # CRUD with filtering
โโโ docker-compose.yml # MongoDB
5. Full-Stack - Complete Web App
Flask with Jinja2 templates and authentication
app/
โโโ routes/
โ โโโ main.py # Main routes
โ โโโ auth.py # Auth routes
โโโ templates/ # Jinja2 templates
โ โโโ base.html
โ โโโ index.html
โ โโโ auth/ # Login, register
โโโ static/
โ โโโ css/style.css # Modern responsive CSS
โ โโโ js/main.js # Form validation
โโโ models/ # User models
โโโ forms/ # WTForms
## ๐จ Features
### Core Features
- ๐๏ธ **Production-Ready** - All templates follow industry best practices
- ๐ **Clean Structure** - Organized, scalable architecture
- โก **Async Support** - FastAPI with async/await, Motor for MongoDB
- ๐ณ **Docker Included** - docker-compose.yml for databases
- ๐ **Type Hints** - Full typing support with Pydantic
- ๐งช **Testing Ready** - Structured for easy testing
- ๐ **Documentation** - Comprehensive README in each project
### Security Features
- ๐ **JWT Authentication** - Access & refresh tokens
- ๐ **Password Hashing** - PBKDF2-SHA256 with Werkzeug/Passlib
- ๐ก๏ธ **Input Validation** - Server-side validation with detailed errors
- ๐ **CORS Configuration** - Configurable allowed origins
- ๐ **CSRF Protection** - Built into fullstack templates
- ๐ซ **SQL Injection Prevention** - Parameterized queries/ORM
- ๐ **Security Headers** - X-Frame-Options, X-Content-Type-Options
### Reliability Features
- ๐ **Comprehensive Logging** - Structured logging throughout
- ๐ **Rollback on Failure** - Automatic cleanup if generation fails
- โ
**Input Validation** - Project name validation, path security
- ๐ก๏ธ **Directory Traversal Protection** - Secure file operations
- โ ๏ธ **Error Handling** - Comprehensive error messages
- ๐ **Verbose Mode** - `--verbose` flag for debugging
### Database Support
- ๐๏ธ **PostgreSQL** - SQLAlchemy with Alembic migrations
- ๐ **MongoDB** - Motor (async) & PyMongo support
- ๐ **Database Migrations** - Alembic configured
- ๐ณ **Docker Compose** - One-command database setup
- ๐ **Connection Pooling** - Optimized database connections
## ๐ Documentation
### After Creating a Project
```bash
cd my-awesome-api
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run the application
uvicorn app.main:app --reload
FastAPI Projects:
uvicorn app.main:app --reload
Visit http://localhost:8000/docs for interactive API documentation.
Flask Projects:
flask run
Visit http://localhost:5000 for your application.
Project Structure
Every generated project includes:
- โ
requirements.txt- All dependencies - โ
.env.example- Environment variables template - โ
.gitignore- Comprehensive Python gitignore (auto-generated) - โ
README.md- Complete setup guide with examples - โ
docker-compose.yml- Database setup (SQL/MongoDB templates) - โ Secure file permissions - Proper file modes set automatically
CLI Options
# Basic usage
bpy init fastapi # Interactive template selection
bpy init flask my-project # Specify project name upfront
bpy list # List all available templates
# With verbose logging
bpy --verbose init fastapi # See detailed generation logs
# Get help
bpy --help # Show all commands
bpy init --help # Show init command help
๐ฆ Version History
v1.0.1 (Latest)
- โ Added 5 Flask templates (API, Auth, SQL, MongoDB, Full-Stack)
- โ Enhanced security: input validation, directory traversal protection
- โ Added logging and error handling with rollback
- โ Auto-generated .gitignore files
- โ Improved CLI with verbose mode
- โ Added MongoDB and CRM templates for FastAPI
- โ Enhanced documentation
v0.1.0
- Initial release with 3 FastAPI templates
๐ Security Best Practices
All templates include security features out of the box:
Authentication Templates
- Password hashing with PBKDF2-SHA256
- JWT tokens with configurable expiration
- Secure secret key management via environment variables
- Protected routes with authentication middleware
API Security
- CORS configuration with allowed origins
- Input validation with Pydantic (FastAPI) or WTForms (Flask)
- SQL injection prevention via ORM
- Security headers (X-Frame-Options, X-Content-Type-Options)
File Security
- Directory traversal attack prevention
- Secure file permissions (644 for files, 755 for directories)
- Validation of project names and paths
- Safe template variable replacement
Production Checklist
Before deploying to production:
- โ
Change
SECRET_KEYin.env(min 32 characters) - โ
Set
DEBUG=False - โ Configure production database URLs
- โ Set up HTTPS/SSL certificates
- โ Configure allowed CORS origins
- โ Set up monitoring and logging
- โ Use environment-specific configs
๐ ๏ธ Development
Requirements
- Python 3.9+
- pip or pipx
Contributing
We welcome contributions! Please see CONTRIBUTING.md for details.
Building from Source
git clone https://github.com/Faizgeeky/boilerpy.git
cd boilerpy
python -m build
๐ License
MIT License - see LICENSE for details.
๐ค Support
- ๐ Issues: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- โญ Star us on GitHub: github.com/Faizgeeky/boilerpy
๐ Acknowledgments
Built with โค๏ธ by Faiz
Inspired by:
- create-react-app
- vue-cli
- cookiecutter
Made with โค๏ธ for the Python community
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file boilerpy-1.0.1.tar.gz.
File metadata
- Download URL: boilerpy-1.0.1.tar.gz
- Upload date:
- Size: 85.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f6785a33aeb4fb81e2e275fff106059ab02888e79dddd2a9bd5f281b2474889
|
|
| MD5 |
9c23ea1788acd3745f36c1c16d7e7c31
|
|
| BLAKE2b-256 |
3088b88b5202c3183bcb19645e6b287c2d54312e53265fcee5e99960e1309822
|
Provenance
The following attestation bundles were made for boilerpy-1.0.1.tar.gz:
Publisher:
publish.yml on Faizgeeky/boilerpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boilerpy-1.0.1.tar.gz -
Subject digest:
9f6785a33aeb4fb81e2e275fff106059ab02888e79dddd2a9bd5f281b2474889 - Sigstore transparency entry: 1205865959
- Sigstore integration time:
-
Permalink:
Faizgeeky/boilerpy@e375aa1169385384a5738d09ac7eb17600d1582f -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Faizgeeky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e375aa1169385384a5738d09ac7eb17600d1582f -
Trigger Event:
release
-
Statement type:
File details
Details for the file boilerpy-1.0.1-py3-none-any.whl.
File metadata
- Download URL: boilerpy-1.0.1-py3-none-any.whl
- Upload date:
- Size: 144.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7512bf2c7d1e35c968067669f34c32f58d9dd46e000985cfadeae3535cc56ec
|
|
| MD5 |
93b9e2eec16446788bd507ac74c1aed6
|
|
| BLAKE2b-256 |
a111498c1807f6f4756ef184e9b09db357e403b99ee015864ba08ed0c51d8449
|
Provenance
The following attestation bundles were made for boilerpy-1.0.1-py3-none-any.whl:
Publisher:
publish.yml on Faizgeeky/boilerpy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
boilerpy-1.0.1-py3-none-any.whl -
Subject digest:
b7512bf2c7d1e35c968067669f34c32f58d9dd46e000985cfadeae3535cc56ec - Sigstore transparency entry: 1205865981
- Sigstore integration time:
-
Permalink:
Faizgeeky/boilerpy@e375aa1169385384a5738d09ac7eb17600d1582f -
Branch / Tag:
refs/tags/v1.0.1 - Owner: https://github.com/Faizgeeky
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e375aa1169385384a5738d09ac7eb17600d1582f -
Trigger Event:
release
-
Statement type: