Skip to main content

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.

Version Python License GitHub


๐Ÿ“‹ 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:

  1. SQLite Database (configurable)
  2. SQLAlchemy ORM โ€” Type-safe models
  3. 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

  1. Fork the repository
  2. Create a feature branch:
    git checkout -b feature/your-feature-name
    
  3. Make your changes and test thoroughly
  4. Commit with clear messages:
    git commit -m "Add: description of your feature"
    
  5. Push to your fork:
    git push origin feature/your-feature-name
    
  6. 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

shafikul_cli-2.1.3.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shafikul_cli-2.1.3-py3-none-any.whl (29.0 kB view details)

Uploaded Python 3

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

Hashes for shafikul_cli-2.1.3.tar.gz
Algorithm Hash digest
SHA256 8d4e45aeed8caab762ede8d8841a3fa416cb59c9b7656f90439539d43f916cdb
MD5 56cd71d616a225a21176f981c392b0a9
BLAKE2b-256 0c68b8bb036088601ef7dfe69fbc45f551a2dbd0c6e449369fb9e42da8edbe71

See more details on using hashes here.

Provenance

The following attestation bundles were made for shafikul_cli-2.1.3.tar.gz:

Publisher: workflow.yml on build-with-shafikul/shafikul_cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for shafikul_cli-2.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c3963eb8cb64ed114eb42958f3d22bfbbc49990694ff42e7f43d1c1b048fc77b
MD5 8e1d58b286653f0a8e20debe7a6c862a
BLAKE2b-256 550e881e9fa6709bf37659e85aec5f44064827a8f713f56fa62404072530f5d3

See more details on using hashes here.

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

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page