Skip to main content

FastAPI Scaffolding Tool

Project description

 ____        _ _     _                 _   _       _   
| __ ) _   _(_) | __| | ___ _ __ ___  | | | |_   _| |_ 
|  _ \| | | | | |/ _` |/ _ \ '__/ __| | |_| | | | | __|
| |_) | |_| | | | (_| |  __/ |  \__ \ |  _  | |_| | |_ 
|____/ \__,_|_|_|\__,_|\___|_|  |___/ |_| |_|\__,_|\__|
  

๐Ÿ  FastAPI Scaffolding Tool

PyPI Version Python Versions License


Overview

Builders Hut is a powerful command-line tool that scaffolds production-ready FastAPI projects in seconds. Stop wasting time on boilerplateโ€”start building features immediately with a clean, scalable project structure.

Why Builders Hut?

  • โšก Instant Setup โ€” Generate a complete FastAPI project with one command
  • ๐Ÿ—๏ธ Production-Ready Architecture โ€” Clean separation of concerns with repositories, services, and schemas
  • ๐ŸŽจ Beautiful Defaults โ€” Stunning landing page and Scalar API documentation out of the box
  • ๐Ÿ”ง Zero Configuration โ€” Auto-creates virtual environment and installs dependencies
  • ๐ŸŒ Cross-Platform โ€” Works seamlessly on Windows and Linux

Installation

pip install builders-hut

Requires Python 3.13+


Quick Start

Create a new FastAPI project in seconds:

# Interactive mode (prompts for details)
hut build

# Or provide all options directly
hut build --name "my-api" --description "My awesome API" --version "1.0.0" --path ./my-project

CLI Options

Option Short Description Default
--name -n Project name (prompted)
--description -d Project description A new project
--version -v Project version 0.1.0
--path -p Output directory ./demo

Generated Project Structure

Builders Hut creates a clean, scalable architecture following best practices:

my-project/
โ”œโ”€โ”€ .venv/                    # Virtual environment (auto-created)
โ”œโ”€โ”€ .env                      # Environment configuration
โ”œโ”€โ”€ pyproject.toml            # Project metadata & dependencies
โ”‚
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ main.py               # FastAPI application entry point
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ api/                  # API route definitions
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ common.py         # Common routes (health, docs, home)
โ”‚   โ”‚   โ””โ”€โ”€ v1/               # Version 1 endpoints
โ”‚   โ”‚       โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ core/                 # Core configuration
โ”‚   โ”‚   โ”œโ”€โ”€ config.py         # Pydantic settings management
โ”‚   โ”‚   โ””โ”€โ”€ logger.py         # Logging configuration
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ database/             # Database connections & sessions
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ models/               # ORM / data models
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ schemas/              # Pydantic request/response schemas
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ services/             # Business logic layer
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ repositories/         # Data access layer
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ workers/              # Background jobs & async workers
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ utils/                # Utility functions
โ”‚   โ”‚   โ””โ”€โ”€ __init__.py
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ scripts/              # Server run scripts
โ”‚   โ”‚   โ”œโ”€โ”€ dev.py            # Development server (with hot reload)
โ”‚   โ”‚   โ””โ”€โ”€ prod.py           # Production server
โ”‚   โ”‚
โ”‚   โ””โ”€โ”€ templates/            # Jinja2 templates
โ”‚       โ””โ”€โ”€ index.html        # Beautiful landing page
โ”‚
โ””โ”€โ”€ tests/                    # Unit & integration tests
    โ””โ”€โ”€ __init__.py

Features

๐ŸŽจ Beautiful Landing Page

Every project comes with a stunning, responsive landing page that displays API status in real-time with automatic health checks.

Dark theme with purple accents โ€ข Real-time status monitoring โ€ข Link to API docs

๐Ÿ“š Scalar API Documentation

Forget Swagger UIโ€”your API ships with Scalar, a modern, beautiful API documentation interface.

  • Dark mode by default
  • Interactive API testing
  • Clean, developer-friendly design

Access at: http://localhost:8000/docs

โš™๏ธ Pydantic Settings

Type-safe configuration management with automatic environment variable loading:

from app.core.config import settings

print(settings.TITLE)        # Your project name
print(settings.DEBUG)        # True/False
print(settings.PORT)         # 8000

๐Ÿ”„ Health Check Endpoint

Built-in health monitoring at /health:

{ "status": "ok" }

Running Your Project

After scaffolding, navigate to your project and run:

cd my-project

# Activate virtual environment
# Windows:
.venv\Scripts\activate
# Linux/macOS:
source .venv/bin/activate

# Start development server (with hot reload)
run_dev_server

# Or run directly with uvicorn
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000

Then open:

  • Landing Page: http://localhost:8000
  • API Docs: http://localhost:8000/docs
  • Health Check: http://localhost:8000/health

Included Dependencies

Your scaffolded project comes with these essential packages pre-installed:

Package Purpose
fastapi High-performance web framework
uvicorn Lightning-fast ASGI server
pydantic-settings Type-safe configuration management
python-dotenv Environment variable loading
scalar-fastapi Modern API documentation
jinja2 Template rendering
email-validator Email validation support
tzdata Timezone data
pytest Testing framework (dev)

Environment Configuration

The generated .env file contains essential configuration:

TITLE="my-api"
DESCRIPTION="My awesome API"
VERSION="1.0.0"
DEBUG=True
PORT=8000
HOST="0.0.0.0"

All values are automatically loaded via Pydantic Settings and accessible through settings.


Architecture Philosophy

Builders Hut follows a layered architecture pattern for clean, maintainable code:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚            API Routes               โ”‚  โ† HTTP request/response handling
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚            Services                 โ”‚  โ† Business logic
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚           Repositories              โ”‚  โ† Data access abstraction
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚         Database / Models           โ”‚  โ† Data persistence
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • API Layer โ€” Handles HTTP requests, validation, and responses
  • Service Layer โ€” Contains business logic, orchestrates operations
  • Repository Layer โ€” Abstracts database access, enables testing
  • Model Layer โ€” Defines data structures and ORM models

Examples

Create a Simple CRUD API

After scaffolding, add a new endpoint in app/api/v1/:

# app/api/v1/users.py
from fastapi import APIRouter

router = APIRouter(prefix="/users", tags=["Users"])

@router.get("/")
async def get_users():
    return [{"id": 1, "name": "John"}]

@router.post("/")
async def create_user(name: str):
    return {"id": 2, "name": name}

Register in app/api/__init__.py:

from app.api.common import router as common_router
from app.api.v1.users import router as users_router

__all__ = ["common_router", "users_router"]

Include in app/main.py:

from app.api import common_router, users_router

app.include_router(common_router)
app.include_router(users_router, prefix="/api/v1")

Roadmap

  • Logger configuration
  • Database setup wizards (PostgreSQL, SQLite, MongoDB)
  • hut add command for adding components to existing projects
  • Authentication templates (JWT, OAuth)
  • Docker & docker-compose generation
  • CI/CD pipeline templates

Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

# Clone the repository
git clone https://github.com/Agsdovah95/builders-hut.git
cd builders-hut

# Install in development mode
pip install -e .

License

This project is licensed under the BSD-3-Clause License โ€” see the LICENSE.txt file for details.


Author

Arnab Gupta
๐Ÿ“ง arnabgupta84@gmail.com
๐Ÿ”— GitHub


Built with โค๏ธ for the FastAPI community

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

builders_hut-0.3.1.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

builders_hut-0.3.1-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file builders_hut-0.3.1.tar.gz.

File metadata

  • Download URL: builders_hut-0.3.1.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for builders_hut-0.3.1.tar.gz
Algorithm Hash digest
SHA256 48930abce9ad4f1ce404ce3cc08d6d1977bd85f338b91a3558b1b89ad5bde056
MD5 23dc6154092e405dd31d7686170c09dc
BLAKE2b-256 3321d846f0c5da923322b1cdb1ec70b9a8a3584ffa69408383bec6d942d629cd

See more details on using hashes here.

File details

Details for the file builders_hut-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: builders_hut-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 19.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for builders_hut-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 84dc4907985b2bf38e45c6a682e84a785d1be8e80e1861a534f54737f79a3a08
MD5 19fcca571f50b678dc3daede151ee2e5
BLAKE2b-256 7789a9191302a5e1b4536f872bf6ee847f088577a7eb68b771432a3d5a4c99ca

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