FastAPI project scaffolding tool
Project description
FastScaff
FastAPI project scaffolding tool - quickly create standardized FastAPI project structures.
Features
- One-click creation of standardized FastAPI project structure
- Multiple ORM support (Tortoise ORM / SQLAlchemy)
- Built-in JWT authentication
- Structured logging with structlog
- Unified exception handling
- Docker deployment support
- Testing framework integration
- SQLite by default (zero configuration)
Installation
pip install fastscaff
Quick Start
Create a New Project
# Using SQLAlchemy (with SQLite by default)
fastscaff new myproject --orm sqlalchemy
# Using Tortoise ORM
fastscaff new myproject --orm tortoise
# Specify output directory
fastscaff new myproject --output /path/to/dir
Generated Project Structure
myproject/
├── app/
│ ├── main.py
│ ├── core/
│ │ ├── config.py
│ │ ├── database.py
│ │ ├── logger.py
│ │ ├── lifespan.py
│ │ ├── security.py
│ │ └── redis.py
│ ├── api/
│ │ └── v1/
│ │ ├── router.py
│ │ ├── deps.py
│ │ └── endpoints/
│ ├── models/
│ ├── schemas/
│ ├── repositories/
│ ├── services/
│ ├── middleware/
│ ├── exceptions/
│ └── utils/
├── tests/
├── .env.example
├── Dockerfile
├── docker-compose.yml
├── Makefile
└── requirements.txt
Run the Generated Project
cd myproject
pip install -r requirements.txt
make dev
The project runs out of the box with SQLite - no configuration needed.
CLI Reference
# Show help
fastscaff --help
# Create new project
fastscaff new <project_name>
--orm ORM choice: tortoise or sqlalchemy (default: tortoise)
--output Output directory (default: current directory)
--force Force overwrite existing directory
--with-rbac Enable RBAC with Casbin
# Show version
fastscaff version
Project Layers
| Layer | Directory | Responsibility |
|---|---|---|
| API | api/ |
HTTP request handling, parameter validation |
| Service | services/ |
Business logic, transaction management |
| Repository | repositories/ |
Data access, CRUD operations |
| Model | models/ |
Database table definitions |
| Schema | schemas/ |
Request/response data structures |
Development
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Code formatting
ruff check --fix .
ruff format .
License
MIT
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
fastscaff-0.1.1.tar.gz
(35.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
fastscaff-0.1.1-py3-none-any.whl
(55.0 kB
view details)
File details
Details for the file fastscaff-0.1.1.tar.gz.
File metadata
- Download URL: fastscaff-0.1.1.tar.gz
- Upload date:
- Size: 35.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7187507c9c2111300b994ced8499cbdd91edddffd1b39e19731f2f88622b3368
|
|
| MD5 |
58b8d47d21d68679d711bd37df4dcada
|
|
| BLAKE2b-256 |
c217f2ae53a7ee791e2da229e95aa9a665197536fe854a2e9f6bdb0ef1a38ad1
|
File details
Details for the file fastscaff-0.1.1-py3-none-any.whl.
File metadata
- Download URL: fastscaff-0.1.1-py3-none-any.whl
- Upload date:
- Size: 55.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9f3a9126f3992cf9495f0d554a8853971fc080c713fad36f60ba394d5af743ff
|
|
| MD5 |
5509e61ad76e7601c1ed6f834aab5388
|
|
| BLAKE2b-256 |
4ce7a7886af3d157fb7636fd0ee303269906216184354f5d5666741b2fba2acc
|