Skip to main content

This is a boilerplate project for building a web application using FastAPI

Project description

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.
  • 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.

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

fastapi_boiler-0.1.4.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

fastapi_boiler-0.1.4-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file fastapi_boiler-0.1.4.tar.gz.

File metadata

  • Download URL: fastapi_boiler-0.1.4.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/23.4.0

File hashes

Hashes for fastapi_boiler-0.1.4.tar.gz
Algorithm Hash digest
SHA256 252bdeca41047cf2ba547d5389c8a0063060bccdbb30fc47b7e97d38949418e1
MD5 d62bad4f61ba28fd23598b1d715be021
BLAKE2b-256 1d7211e0c65e9b12b2e00811a3585cfeff8f52b987f17ecb90cbac5842abc413

See more details on using hashes here.

File details

Details for the file fastapi_boiler-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: fastapi_boiler-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.11.3 Darwin/23.4.0

File hashes

Hashes for fastapi_boiler-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0cce9891cf24fb78912c3134c2ee92395d26e9758bc8944fb3db5f1e5b9668cf
MD5 8aeca1a6faf261de4b210305c5c04d1f
BLAKE2b-256 02591e29d3956723abbce154ac6188196c00a32748e23c6e7c2ce47f757b316b

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page