FastAPI Boiler
fastapi-boiler is a command-line tool for quickly generating a boilerplate FastAPI application. It streamlines the setup process, allowing you to get started with your FastAPI project quickly and efficiently.
Features
- FastAPI boilerplate generation
- Dynamic project naming
- Customizable project metadata (author, description)
- Automatic Docker and Poetry configuration updates
Installation
Install fastapi-boiler using pip.
pip install fastapi-boiler
Usage
To create a new FastAPI application, run:
fastapi-boiler
You will be prompted to enter your app directory, description and email, which will be used to update the boilerplate configuration files.
Example
$ fastapi-boiler
Project directory: testing
Python version (3.10, 3.11, etc.): 3.11
Description: test
Author: john.doe@mail.com
Copied template from fastapi_boilerplate to testing
Updated pyproject.toml with the new project details
Updated docker-compose.yml with the new app name
New FastAPI app created at testing
Configuration
To make fastapi-boiler available globally, you may need to add the installation path to your shell configuration file.
Bash
Add the following line to your ~/.bashrc file:
export PATH="$HOME/.local/bin:$PATH"
Then, reload the ~/.bashrc file:
source ~/.bashrc
Zsh
Add the following line to your ~/.zshrc file:
export PATH="$HOME/.local/bin:$PATH"
Then, reload the ~/.zshrc file:
source ~/.zshrc
Project Structure
After running the fastapi-boiler command, your new FastAPI application will have the following structure:
my_new_app/
├── app/
│ └── v1/
│ ├── health/
│ │ ├── __init__.py
│ │ ├── router.py
│ │ └── views.py
│ ├── __init__.py
│ └── views.py
├── core/
│ ├── __init__.py
│ ├── database.py
│ ├── exception_handlers.py
│ ├── exceptions.py
│ ├── extensions.py
│ ├── factory.py
│ └── middlewares.py
├── settings/
│ └── config.py
├── tests/
│ └── __init__.py
├── .gitignore
├── docker-compose.yml
├── Dockerfile
├── pyproject.toml
├── README.md
├── requirements.txt
└── server.py
Files and Directories
- app/: Contains the main application code.
- v1/: API version 1.
- health/: Health check endpoints.
- init.py: Package initializer.
- router.py: Router configuration.
- views.py: Endpoint views.
- v1/: API version 1.
- core/: Core functionality and utilities.
- database.py: Database configuration.
- exception_handlers.py: Custom exception handlers.
- exceptions.py: Custom exception definitions.
- extensions.py: Extensions and third-party integrations.
- factory.py: Application factory.
- middlewares.py: Custom middlewares.
- settings/: Configuration settings.
- config.py: Main configuration file.
- tests/: Unit and integration tests.
- docker-compose.yml: Docker Compose configuration.
- Dockerfile: Dockerfile for containerizing the application.
- pyproject.toml: Poetry configuration file.
- README.md: Project readme file.
- requirements.txt: Project dependencies.
- server.py: Entry point for running the application.
- create_app.py: Script for creating a new FastAPI project.
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 more information.
Contact
For questions or support, please contact ali.heyderli@gmail.com.
Metadata
Release files for fastapi-boiler 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fastapi_boiler-0.1.4.tar.gz | 13.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fastapi_boiler-0.1.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 31.5 kB
Release files / fastapi_boiler-0.1.4.tar.gz
| Download URL | fastapi_boiler-0.1.4.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
252bdeca41047cf2ba547d5389c8a0063060bccdbb30fc47b7e97d38949418e1
|
|
BLAKE2b-256 checksum How to use checksums |
1d7211e0c65e9b12b2e00811a3585cfeff8f52b987f17ecb90cbac5842abc413
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/23.4.0
|
Release files / fastapi_boiler-0.1.4-py3-none-any.whl
| Download URL | fastapi_boiler-0.1.4-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0cce9891cf24fb78912c3134c2ee92395d26e9758bc8944fb3db5f1e5b9668cf
|
|
BLAKE2b-256 checksum How to use checksums |
02591e29d3956723abbce154ac6188196c00a32748e23c6e7c2ce47f757b316b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.4.2 CPython/3.11.3 Darwin/23.4.0
|