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

pip install fapier

or

pipx install fapier

Requires Python 3.10+


Usage

Create a project

fapi create 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
fapi add schema product
fapi add crud product

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 โœ… Done

๐Ÿค 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.5.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.5-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: fapier-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 94526f120dbb13fed417cedaa25dfc23ca5e4f167e8891c98e1c2ba3ec6bc40d
MD5 485ef6948a40ef137b447c2d58c98bd5
BLAKE2b-256 5c04ff13a2e135408eab8c91f86c66654637409c7ea523aad0fb29c1d57d8eb2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fapier-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c3849c8d44f3686659920f0f3ae64d4a8024fbcf442849225a947a2f6dc168cb
MD5 e147afabc44102ce5ef107f41837454a
BLAKE2b-256 59a2666b3e45fdd6eb110abc4c3b63e1ffa72d43af02fe9ef17e33364a1edb7a

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