A CLI tool to scaffold FastAPI projects with ML, DB, Auth, and Docker options.
Project description
fastapi-scaffold
fastapi-scaffold is a CLI tool that generates a scalable FastAPI project template with advanced features including authentication, machine learning endpoints, background tasks, caching, rate limiting, and more.
Installation
Install the CLI tool via pip:
pip install fastapi-scaffold
Usage
Create a New FastAPI Project
To create a new project, run:
fastapi-scaffold create my_project
This command generates a new project with optional features:
--ml
→ Includes machine learning endpoints and model setup.--db
→ Adds database configuration and ORM setup.--auth
→ Includes authentication endpoints.--docker
→ Generates Dockerfile and docker-compose.yml for container support.
Example:
fastapi-scaffold create my_project --ml --db --auth --docker
Install Project Dependencies
After generating your project, navigate into the project directory and install dependencies:
fastapi-scaffold install
Alternatively, run:
pip install -r requirements.txt
Delete an Existing Project
To delete a project directory, use:
fastapi-scaffold delete my_project
Project Structure
A generated project will have the following structure:
my_project/
├── app/
│ ├── api/
│ │ ├── __init__.py
│ │ ├── users.py
│ │ ├── items.py
│ │ ├── admin.py
│ │ ├── ml.py
│ │ └── health.py
│ ├── schemas/
│ │ ├── __init__.py
│ │ ├── user.py
│ │ ├── item.py
│ │ ├── ml.py
│ │ └── stats.py
│ ├── models/
│ │ ├── __init__.py
│ │ ├── user.py
│ │ ├── item.py
│ │ └── ml_model.pkl
│ ├── crud/
│ │ ├── __init__.py
│ │ ├── user.py
│ │ ├── item.py
│ │ └── stats.py
│ ├── services/
│ │ ├── __init__.py
│ │ ├── auth.py
│ │ ├── tasks.py
│ │ └── ml.py
│ ├── utils/
│ │ ├── __init__.py
│ │ ├── dependencies.py
│ │ ├── cache.py
│ │ └── rate_limit.py
│ ├── middleware.py
│ ├── database.py
│ ├── auth.py
│ ├── logger.py
│ ├── config.py
│ └── main.py
├── tests/
│ ├── test_main.py
│ └── test_users.py
├── .env
├── requirements.txt
├── Dockerfile
├── docker-compose.yml
└── README.md
Running the Project
- Navigate to the project directory:
cd my_project
- Install dependencies:
pip install -r requirements.txt
- Start the FastAPI server:
uvicorn app.main:app --reload
The API will be available at http://127.0.0.1:8000.
Contributing
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
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
Built Distribution
File details
Details for the file fastapi_scaffold-0.2.1.tar.gz
.
File metadata
- Download URL: fastapi_scaffold-0.2.1.tar.gz
- Upload date:
- Size: 11.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
29029a59f9f855b0bad1761caf82b68e1de2cb312868b14d7fa1a640f093c84f
|
|
MD5 |
6349dfcca75092380aa8aa6021c042c9
|
|
BLAKE2b-256 |
064467ca44dfe442fbaff4c649091fc9e9be46395e3bf62153184c6e7c3609b2
|
File details
Details for the file fastapi_scaffold-0.2.1-py3-none-any.whl
.
File metadata
- Download URL: fastapi_scaffold-0.2.1-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d41e5538ffbf5f62d2241e93bff2b555d126f1468b1ce781564e7b0b692503c1
|
|
MD5 |
1ab175a4793fe97f14997ee571b1e30c
|
|
BLAKE2b-256 |
5b7547fbeafb9c4633f8337c56548984d55b503d7fd57c95d70bab3dc8b69b91
|