Skip to main content

A CLI tool to scaffold FastAPI projects with CRUD and schema support

Project description

# ⚡ FasterAPI — Scaffold FastAPI Apps with Ease

`nats-fasterapi` is a **CLI tool** that helps you scaffold and supercharge FastAPI projects.  

It generates schemas, CRUD repositories, services, routes, and authentication utilities — so you can focus on building features instead of repetitive boilerplate. Think of it as a **FastAPI project generator + productivity booster 🚀**.  

---

## ✨ Features

- 🏗️ Generate **Pydantic schemas** with a single command.  
- 🗄️ Generate **CRUD repositories** backed by MongoDB (`motor`), Redis, or custom logic.  
- 🔧 Generate **service layers** to connect repositories and routes.  
- 🌐 Generate **API routes** with versioning support (`latest-modified` / `highest-number`).  
- 🔑 Generate **token-based authentication utilities** (repository + dependencies).  
- **Mount routes automatically** into `main.py`.  
- 🎯 Interactive prompts or automation-friendly `-y` (yes) flag.  
- 📦 Designed for **scalable microservices** using FastAPI.  

---

## 📦 Installation

```bash
pip install nats-fasterapi

Upgrade to the latest version anytime:

fasterapi update

🚀 Usage

Run fasterapi --help to see all available commands:

Usage: fasterapi [OPTIONS] COMMAND [ARGS]...

  ⚡ FasterAPI CLI — Scaffold and supercharge your FastAPI projects

Options:
  -v, --version  Show the FasterAPI version and exit
  --help         Show this message and exit

Commands:
  make-crud       Generate CRUD repository functions
  make-schema     Generate Pydantic schemas
  make-service    Generate service layer templates
  make-route      Generate route files (with versioning)
  make-token-repo Generate token repository for roles
  make-token-deps Generate token dependency utilities
  mount           Mount routes into main.py
  run-d           Run the dev server (uvicorn --reload)
  update          Upgrade FasterAPI CLI to latest

🛠️ Commands Overview

make-schema

Generate a Pydantic schema.

fasterapi make-schema user

✅ Good:

fasterapi make-schema product

❌ Bad:

fasterapi make-schema User   # Avoid uppercase
fasterapi make-schema        # Missing name

make-crud

Generate CRUD repository functions for a schema.

fasterapi make-crud user

make-service

Generate a service layer for a schema.

fasterapi make-service user

make-route

Generate an API route with a versioning strategy.

fasterapi make-route user --version-mode latest-modified
fasterapi make-route product --version-mode highest-number
fasterapi make-route order      # Will ask interactively
fasterapi make-route order -y   # Skips prompt, defaults to highest-number

make-token-repo

Generate a token repository for authentication.

fasterapi make-token-repo admin user staff

If no roles are provided, it defaults to:

admin, user, staff, guest-editor

make-token-deps

Generate token dependency utilities.

fasterapi make-token-deps

mount

Mount all API routes into main.py.

fasterapi mount

run-d

Run the development server with uvicorn.

fasterapi run-d

Equivalent to:

uvicorn main:app --reload

update

Upgrade FasterAPI CLI to the latest version.

fasterapi update

👨‍💻 Development

Clone the repository and install it in editable mode:

git clone https://github.com/yourusername/nats-fasterapi.git
cd nats-fasterapi
pip install -e .

Run tests:

pytest

🛣️ Roadmap

Here’s what’s coming next for FasterAPI 🚀:

Database Support

  • SQLAlchemy (PostgreSQL / MySQL) repository generator
  • SQLite lightweight repository scaffolding
  • Cassandra & DynamoDB templates
  • Neo4j graph database integration

Global Config Support

  • Central config file (fasterapi.yaml) to scaffold schema, repo, service, and routes automatically
  • Environment-specific overrides for config-driven scaffolding

Authentication Enhancements

  • Social logins (Google, GitHub, Facebook, Twitter) with OAuth2
  • JWT refresh token rotation utilities
  • API key and HMAC authentication scaffolding

Project Scaffolding

  • fasterapi new myproject to bootstrap a full FastAPI project
  • Opinionated folder structure with best practices baked in

DX (Developer Experience) Improvements

  • Global --yes flag (applies to all commands for CI/CD)
  • Configurable templates for schema, CRUD, services, routes
  • Built-in Dockerfile & docker-compose scaffolding
  • Built-in GitHub Actions CI/CD workflow generator

Other Ideas

  • CLI autocompletion for bash/zsh/fish
  • Schema-first API generator (OpenAPI → code scaffolding)
  • Hot reload template customization

📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

© 2025 Nathaniel Uriri

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nats-fasterapi-0.2.56.tar.gz (31.4 kB view details)

Uploaded Source

Built Distribution

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

nats_fasterapi-0.2.56-py3-none-any.whl (39.9 kB view details)

Uploaded Python 3

File details

Details for the file nats-fasterapi-0.2.56.tar.gz.

File metadata

  • Download URL: nats-fasterapi-0.2.56.tar.gz
  • Upload date:
  • Size: 31.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.10

File hashes

Hashes for nats-fasterapi-0.2.56.tar.gz
Algorithm Hash digest
SHA256 b0af8944c2a009ebad38f8ccbf3c6d041a8c86d41a736f395d3f1ada9f08ce61
MD5 b1937807ac5f4068b68f2bf7eeee8ece
BLAKE2b-256 3907e99f3e3df784a74ceb89551f5ad2e6317fdea9c73521e5e9283ee9238ffe

See more details on using hashes here.

File details

Details for the file nats_fasterapi-0.2.56-py3-none-any.whl.

File metadata

File hashes

Hashes for nats_fasterapi-0.2.56-py3-none-any.whl
Algorithm Hash digest
SHA256 1620188e0ad9dc362e8d29872fee24768941cfee0b1a7eb4c6414a4ff3490998
MD5 42cb7f35030dd276c08ab6790453f580
BLAKE2b-256 a81673234e3b51699d8ed5cdaa9c117aad402db4a2981502f89979d5454f3842

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