Skip to main content

A CLI tool to generate a FastAPI project with a Repo-Service-Controller architecture.

Project description

Fast Boiler 🚀

Generate production-ready FastAPI projects with a modern, scalable architecture in seconds.

PyPI version License: MIT


fast-boiler is a command-line tool that scaffolds a complete FastAPI application using the robust Repository → Service → Controller layering pattern. Stop writing boilerplate and start building features.

The generated project is not just a skeleton—it comes with a complete, secure authentication system, a powerful database layer, and self-documenting APIs right out of the box.

Core Features

  • Scalable Architecture: Cleanly separates database logic (Repositories), business logic (Services), and API endpoints (Controllers) for maximum maintainability.
  • Batteries-Included: Scaffolds a complete authentication system with registration, JWT login, and password reset powered by FastAPI Users.
  • OAuth Ready: Optionally include social login (e.g., Google) with a single command.
  • Advanced CRUD: Generated endpoints come with pagination, sorting, and filtering built-in and automatically documented in Swagger UI.
  • Developer-Friendly: An interactive CLI wizard guides you through project setup, and a generate command automates the creation of new resources.
  • Modern Tech Stack: Uses the latest, non-deprecated syntax for FastAPI, Pydantic, SQLAlchemy, and modern Python.

Prerequisites

Before you begin, you need to have Python 3.8+ and pipx installed on your system.

pipx is a tool for installing and running Python CLI applications in isolated environments. It is the recommended way to install tools like this one. If you don't have it, you can install it with:

python3 -m pip install --user pipx
python3 -m pipx ensurepath

(You may need to restart your terminal after running pipx ensurepath.)


📦 Installation

Installing fast-boiler is a one-line command:

pipx install fast-boiler```

To verify the installation, run `fast-boiler --help`.

---

## 🚀 Quickstart: Create Your First Authenticated API

Let's build a new API in under two minutes.

### 1. Initialize a New Project

Run the `init` command. It will launch an interactive wizard to configure your project.

```bash
fast-boiler init

Answer the prompts. For this tutorial, accept the defaults (press Enter for each):

What is the name of your project?: myapi
▶ Use asynchronous (async/await) code? [Y/n]: Y
▶ Include FastAPI Users for authentication? (Recommended) [Y/n]: Y
  ▶ Add social OAuth login (e.g., Google)? [y/N]: N

2. Run the API Server

Navigate into your new project, install its dependencies, and run the server.

# Navigate into the project
cd myapi

# (Recommended) Create and activate a virtual environment
python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the dev server
uvicorn app.main:app --reload```

Your API is now live! Open your browser to **`http://127.0.0.1:8000/docs`**.

### 3. Test The Authentication Flow

Your generated API is fully functional. Let's create a user and log in.

1.  **Register:**
    -   In the docs, expand `POST /auth/register`.
    -   Click "Try it out" and enter your details:
        ```json
        {
          "email": "user@example.com",
          "password": "a-strong-password"
        }
        ```
    -   Execute. You should get a `201 Created` response.

2.  **Login:**
    -   Expand `POST /auth/jwt/login`.
    -   Enter your credentials in the form. **Note:** The `username` field is standard for OAuth2, but `fastapi-users` is smart enough to accept an **email address** here.
    -   Execute. You will get a `200 OK` response. An authentication cookie (`fastboilerauth`) has been set in your browser.

3.  **Access a Protected Endpoint:**
    -   Expand `GET /users/me`.
    -   Execute. It will succeed and return your user object, because the browser automatically sent the authentication cookie!

### 4. Generate a New Resource

Now, let's add a new "product" resource to our API.

```bash
# From the root of your 'myapi' project
fast-boiler generate product

The tool will automatically create all the files for the product resource and integrate its router into your application. When the server reloads, you will see a brand new, fully functional CRUD API for /products in your documentation!


What's Generated? The Architecture

fast-boiler creates a clean, layered architecture to keep your code organized:

  • app/controllers/: Handles HTTP requests, responses, and calls the service layer. Contains a dependencies.py for query parsing.
  • app/services/: Contains all business logic. It's the "brain" of your application.
  • app/repositories/: Contains all database interaction logic using a reusable CRUDBase.
  • app/models/: Defines your SQLAlchemy database models.
  • app/schemas/: Defines your Pydantic data schemas (DTOs).
  • app/auth/: If selected, contains the complete fastapi-users authentication setup.

Roadmap

fast-boiler is actively being developed. Future releases will include optional integrations for:

  • Database Migrations (Alembic)
  • Background Tasks (Celery)
  • Caching (Redis)
  • CI/CD (Docker, GitHub Actions)

Contributing

Contributions, issues, and feature requests are welcome! Please feel free to open an issue or submit a pull request.

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

fast_boiler-0.1.3.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

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

fast_boiler-0.1.3-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file fast_boiler-0.1.3.tar.gz.

File metadata

  • Download URL: fast_boiler-0.1.3.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fast_boiler-0.1.3.tar.gz
Algorithm Hash digest
SHA256 455ab871b1579122b5c7e2fad35a820095b58c532a18a9b3ea54d10e18f81e72
MD5 8720f17614d01c77899c48f4d40d7e4f
BLAKE2b-256 fbe32e7e59bdea46eebce721fbd7b5697768f8fbcad1792e362a320dc50da3d3

See more details on using hashes here.

File details

Details for the file fast_boiler-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: fast_boiler-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for fast_boiler-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 e9f32309f5e7f2b488f0dac6a83c92d7b8958265c58e0da1468f0d10e33a1363
MD5 60761ff061ae519860d9524dbd5da7bc
BLAKE2b-256 cfc8be843651886c7dd4347f0ab3f59b694141e284b462225cafeb65a1a13c01

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