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.0.tar.gz (6.2 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.0-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fapier-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 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.0.tar.gz
Algorithm Hash digest
SHA256 790d179b0b24eac6eb5270e758a25b20e8857e0c3133a130e400dfe5e72b74b0
MD5 b4dd00b19a4772e450598c8d5c885c99
BLAKE2b-256 ba7cec0b5286198bb50d7ca3b0ea43c5e32287d1028afad10ac8e150e9748a93

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fapier-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.4 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cc76791e61173e09f1f90bd3550590e4f3c9fdcd897c26bcf5c23c6c0140c947
MD5 08245e297eae2049eb3d92e126e37103
BLAKE2b-256 ea2ae36937eaa2186edc3abe889315dc15b1e4d217d76bbfb75084db53e1a30d

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