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.3.tar.gz (9.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.3-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fapier-0.1.3.tar.gz
  • Upload date:
  • Size: 9.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.3.tar.gz
Algorithm Hash digest
SHA256 952c02e2187d37d42315f24ff93749efa09630a639d5ac2951f8d8859663e21b
MD5 cd15373f10ee3b226d2a5fd7c3ba57dc
BLAKE2b-256 4c6087a09d2f6c46b62cad1b8d88b3c39d89282e92dbc583ffd3e8f4d63314b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fapier-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c36b36140f7ea9e1a35ab0ac4516a96f45582f6e230459070da831a253438479
MD5 8a1dd7d1d6eaa93d559d0fe6f777a298
BLAKE2b-256 42a4a2c6393e1cd5a17652fd8aa1553ebfc815f8eb9830ec904241fa2f303528

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