CLI tool for FastAPI scaffolding with router, models, database, and templates.
Project description
๐ Shafikul CLI
Lightning-fast FastAPI Project Scaffolding โ Generate production-ready boilerplate with user authentication, database models, and a complete folder structure in seconds.
๐ What is Shafikul CLI?
Shafikul CLI is a command-line scaffolding tool that generates complete FastAPI projects with best practices built-in. Instead of manually creating routers, models, templates, and configurations, let the CLI do it for youโinstantly.
Perfect for:
- ๐ฏ Rapid Prototyping โ Start building features, not boilerplate
- ๐ฅ User Authentication โ Pre-configured login, logout, and registration
- ๐๏ธ Database Setup โ SQLAlchemy models, Alembic migrations, auto-generated
- ๐จ Templates Ready โ Organized template structure for web routes
- โก Zero Config โ Works out of the box with sensible defaults
โจ Features
| Feature | Status |
|---|---|
| ๐๏ธ Auto-generate FastAPI project structure | โ |
| ๐ Built-in user authentication (login, logout, registration) | โ |
| ๐๏ธ SQLAlchemy models & Alembic migrations | โ |
| ๐ฃ๏ธ Auto-generate routers (Web & API) | โ |
| ๐ HTML templates (layouts, pages, error handling) | โ |
โ๏ธ Auto-update main.py and .env |
โ |
| ๐จ CSS, JavaScript, and static assets folders | โ |
| ๐งฉ Interactive CLI with multiple input options | โ |
| ๐ Colored console output | โ |
| ๐ฆ Pip installable package | โ |
๐ฆ Installation
From PyPI (Recommended)
pip install shafikul_cli
From Source (Development)
git clone https://github.com/build-with-shafikul/shafikul_cli.git
cd shafikul_cli
pip install -e .
๐ Quick Start
1๏ธโฃ Create a New FastAPI Project
mkdir project_name
shafikul_cli create app
2๏ธโฃ Follow the Interactive Prompts
The CLI will create folders, files, install dependencies, and initialize the database automatically.
3๏ธโฃ Start the Development Server
python main.py
Then visit http://127.0.0.1:8000 in your browser.
๐ CLI Commands
View Help
shafikul_cli --help
Check Version
shafikul_cli --version
# or
shafikul_cli -v
About
shafikul_cli --about
# or
shafikul_cli -a
Create Resources (Interactive)
shafikul_cli create app
๐ Project Structure
your-project/
โ
โโโ ๐ main.py # FastAPI application entry point
โโโ ๐ requirements.txt # Python dependencies
โโโ ๐ .env # Environment variables (gitignored)
โโโ ๐ .env.example # Environment template
โโโ ๐ .gitignore # Git ignore rules
โโโ ๐ alembic.ini # Database migration config
โ
โโโ ๐ app/ # Application core
โ โโโ database.py # Database connection & session
โ โโโ models.py # SQLAlchemy ORM models
โ
โโโ ๐ config/ # Configuration
โ โโโ app.py # App settings & constants
โ
โโโ ๐ router/ # Route handlers
โ โโโ web/ # Web routes (HTML responses)
โ โ โโโ auth.py # Login, logout, register
โ โ โโโ public.py # Public pages
โ โ โโโ error.py # Error pages
โ โโโ api/ # API routes (JSON responses)
โ โโโ users.py # User API endpoints
โ
โโโ ๐ templates/ # Jinja2 HTML templates
โ โโโ layouts/ # Base templates
โ โ โโโ main.html # Main layout
โ โ โโโ auth.html # Auth layout
โ โโโ pages/ # Page templates
โ โโโ public/ # Public pages
โ โ โโโ index.html
โ โโโ auth/ # Auth pages
โ โ โโโ login.html
โ โ โโโ register.html
โ โโโ authenticated/ # Protected pages
โ โ โโโ dashboard.html
โ โโโ error/ # Error pages
โ โโโ 404.html
โ
โโโ ๐ asset/ # Static assets
โ โโโ css/
โ โ โโโ style.css
โ โโโ js/
โ โ โโโ script.js
โ โโโ images/
โ โโโ icon.png
โ
โโโ ๐ static/ # Served static files
โ โโโ images/
โ โโโ logo.png
โ
โโโ ๐ utility/ # Helper functions
โ โโโ helper_function.py
โ
โโโ ๐ migrations/ # Alembic migrations
โ โโโ versions/
โ โโโ env.py
โ
โโโ ๐ test.db # SQLite database (example)
๐ Authentication Features
Shafikul CLI comes with pre-built authentication out of the box:
โ Included
- User Registration โ Form validation & password hashing
- User Login โ Session management with secure cookies
- User Logout โ Session cleanup
- Password Security โ Bcrypt & Argon2 hashing
- Protected Routes โ Dashboard & user pages
- Database Models โ User table with indexes
๐ฏ Routes
GET / โ Homepage
GET /register โ Registration form
POST /register โ Handle registration
GET /login โ Login form
POST /login โ Handle login
GET /dashboard โ Protected dashboard
POST /logout โ Logout user
GET /404 โ Not found page
๐๏ธ Database & Migrations
The CLI automatically sets up:
- SQLite Database (configurable)
- SQLAlchemy ORM โ Type-safe models
- Alembic Migrations โ Version control for schema
Run Migrations
alembic upgrade head
Create New Migration
alembic revision --autogenerate -m "Add new column"
Rollback
alembic downgrade -1
๐ฆ Dependencies
Shafikul CLI installs the following packages:
| Package | Purpose |
|---|---|
| FastAPI | Web framework |
| Uvicorn | ASGI server |
| Jinja2 | Template engine |
| SQLAlchemy | ORM |
| Alembic | Migrations |
| Passlib + Bcrypt | Password hashing |
| Argon2-CFFI | Advanced password hashing |
| python-dotenv | Environment variables |
| python-multipart | Form data parsing |
See requirements.txt for the complete list.
๐ ๏ธ Development
Fork & Contribute
- Fork the repository
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes and test thoroughly
- Commit with clear messages:
git commit -m "Add: description of your feature"
- Push to your fork:
git push origin feature/your-feature-name
- Open a Pull Request with a clear description
Development Setup
git clone https://github.com/build-with-shafikul/shafikul_cli.git
cd shafikul_cli
pip install -e ".[dev]" # Install with dev dependencies
๐ Example Usage
Generate a Complete Blog Project
# Create project
shafikul_cli create app
๐ Troubleshooting
Command not found: shafikul_cli
Make sure you've installed the package:
pip install shafikul_cli
Port 8000 already in use
Change the port in main.py:
uvicorn.run("main:app", host="127.0.0.1", port=8001, reload=True)
Database migration failed
Reset your database:
rm test.db
alembic upgrade head
๐ License
MIT License โ See LICENSE for details.
๐ค Author
Md Shafikul Islam
โญ Show Your Support
If you find this tool helpful, please give it a star on GitHub โ it means a lot! ๐
Made with โค๏ธ by Md Shafikul Islam
Simplifying FastAPI development, one command at a time.
Project details
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 shafikul_cli-2.1.3.tar.gz.
File metadata
- Download URL: shafikul_cli-2.1.3.tar.gz
- Upload date:
- Size: 28.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8d4e45aeed8caab762ede8d8841a3fa416cb59c9b7656f90439539d43f916cdb
|
|
| MD5 |
56cd71d616a225a21176f981c392b0a9
|
|
| BLAKE2b-256 |
0c68b8bb036088601ef7dfe69fbc45f551a2dbd0c6e449369fb9e42da8edbe71
|
Provenance
The following attestation bundles were made for shafikul_cli-2.1.3.tar.gz:
Publisher:
workflow.yml on build-with-shafikul/shafikul_cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shafikul_cli-2.1.3.tar.gz -
Subject digest:
8d4e45aeed8caab762ede8d8841a3fa416cb59c9b7656f90439539d43f916cdb - Sigstore transparency entry: 1439836949
- Sigstore integration time:
-
Permalink:
build-with-shafikul/shafikul_cli@2816f42395bfde3b6df31098a989fd3d64c4f91b -
Branch / Tag:
refs/tags/v2.1.3 - Owner: https://github.com/build-with-shafikul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@2816f42395bfde3b6df31098a989fd3d64c4f91b -
Trigger Event:
push
-
Statement type:
File details
Details for the file shafikul_cli-2.1.3-py3-none-any.whl.
File metadata
- Download URL: shafikul_cli-2.1.3-py3-none-any.whl
- Upload date:
- Size: 29.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3963eb8cb64ed114eb42958f3d22bfbbc49990694ff42e7f43d1c1b048fc77b
|
|
| MD5 |
8e1d58b286653f0a8e20debe7a6c862a
|
|
| BLAKE2b-256 |
550e881e9fa6709bf37659e85aec5f44064827a8f713f56fa62404072530f5d3
|
Provenance
The following attestation bundles were made for shafikul_cli-2.1.3-py3-none-any.whl:
Publisher:
workflow.yml on build-with-shafikul/shafikul_cli
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
shafikul_cli-2.1.3-py3-none-any.whl -
Subject digest:
c3963eb8cb64ed114eb42958f3d22bfbbc49990694ff42e7f43d1c1b048fc77b - Sigstore transparency entry: 1439836955
- Sigstore integration time:
-
Permalink:
build-with-shafikul/shafikul_cli@2816f42395bfde3b6df31098a989fd3d64c4f91b -
Branch / Tag:
refs/tags/v2.1.3 - Owner: https://github.com/build-with-shafikul
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@2816f42395bfde3b6df31098a989fd3d64c4f91b -
Trigger Event:
push
-
Statement type: