Skip to main content

A command-line tool to scaffold and bootstrap FastAPI projects quickly.

Project description

FastAPI Project Generator CLI

A CLI tool that scaffolds FastAPI projects with optional database and API structure.


โœ… Features

Feature Description
Generate FastAPI project Creates a full FastAPI folder structure
Optional Database Create project with or without SQLAlchemy setup
Auto-creates virtualenv Creates .venv inside the project
Auto-installs requirements Installs dependencies based on options
Jinja2 Templates Clean and flexible template system
Developer friendly Simple prompts & automatic setup
CLI add commands Add routes, models, schemas, crud, services

๐Ÿ“‚ Project Output Structure

When DB and routes are enabled:

project_name/
 โ”œโ”€ app/
 โ”‚  โ”œโ”€ main.py
 โ”‚  โ”œโ”€ core/
 โ”‚  โ”‚   โ””โ”€ config.py
 โ”‚  โ”œโ”€ models/
 โ”‚  โ”‚   โ””โ”€ user.py
 โ”‚  โ”œโ”€ schemas/
 โ”‚  โ”‚   โ””โ”€ user.py
 โ”‚  โ”œโ”€ crud/
 โ”‚  โ”‚   โ””โ”€ user.py
 โ”‚  โ”œโ”€ services/
 โ”‚  โ”‚   โ””โ”€ example.py
 โ”‚  โ”œโ”€ api/
 โ”‚  โ”‚   โ””โ”€ router.py
 โ”‚  โ””โ”€ __init__.py
 โ”œโ”€ .fastapi                  # internal flag to detect project
 โ”œโ”€ .env
 โ”œโ”€ requirements.txt
 โ””โ”€ .venv/

If database or routes are disabled, the tool skips those folders.


๐Ÿงฐ Installation

Clone Repo

git clone https://github.com/aymen-Dahmoun/FApi.git
cd FApi

Install dependencies

pip install -r requirements.txt

Requires Python 3.10+


๐Ÿš€ Usage

Create a project

python cli.py myproject

Answer prompts

Example interaction:

Do you want to use a DB? [y/n]: y
Choose a Database (sqlite/postgres) [sqlite]: sqlite
Do you want to generate routes? [y/n]: y

or simply run

python cli.py myproject --db sqlite --routes

Add new components

fapi add route product
fapi add model product --schema --crud
fapi add service payment

Auto-detects if you're inside a FastAPI project using .fastapi


๐Ÿ Run the project

cd myproject
source .venv/bin/activate   # Linux/Mac
# or .venv\Scripts\activate on Windows

uvicorn app.main:app --reload

๐Ÿ“Œ Roadmap

Feature Status
Basic FastAPI scaffold โœ… Done
Optional DB โœ… Done
Optional API โœ… Done
fapi add commands โœ… Done
Auto router import ๐Ÿ”œ Planned
Alembic migrations ๐Ÿ”œ Planned
Docker support ๐Ÿ”œ Planned
Publish on PyPI ๐ŸŽฏ Future

๐Ÿค Contributing

Pull requests are welcome! ๐Ÿ‘


โญ If you like this tool, give the repo a star!

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

fapier-0.1.2.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

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

fapier-0.1.2-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file fapier-0.1.2.tar.gz.

File metadata

  • Download URL: fapier-0.1.2.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for fapier-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a56bf9ec18f0a6c3bfb7d0d02ccce0595c3d1b47e5894c1f815e20ba6aeb70f3
MD5 4b4f66d1a57f889279e8d5a924664671
BLAKE2b-256 6874e42f0ba814414cc117cee34899885b1b6b4c64e37189196a10554c4c956e

See more details on using hashes here.

File details

Details for the file fapier-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: fapier-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for fapier-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 98350a0cd6ce5f66fd540a7a001d5055597c97dd7983b3fb62559bdfdcf9b845
MD5 3e61fdfc76f173abc30791308d767b79
BLAKE2b-256 3c7de0094fc4866342e47cbd59ac8f4d4e66df8d219161b5945795303a226fae

See more details on using hashes here.

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