Skip to main content

CLI to scaffold FastAPI projects with Tailwind CSS, DaisyUI, and Jinja2 templates

Project description

๐Ÿš€ Fastplate

PyPI version Python 3.12+ License: MIT

Fastplate is a CLI tool that scaffolds production-ready FastAPI projects with Tailwind CSS, DaisyUI, and Jinja2 templates in seconds.

โœจ Features

  • ๐Ÿ—๏ธ FastAPI backend with async support and automatic OpenAPI docs
  • ๐ŸŽจ Tailwind CSS v4 + DaisyUI for beautiful, responsive UIs
  • ๐Ÿ“„ Jinja2 server-side templating with component-based structure
  • ๐Ÿ“ฆ uv for fast Python dependency management
  • ๐Ÿณ Docker & docker-compose ready for deployment
  • โšก Hot reload for both backend and CSS during development
  • ๐Ÿ”ง Makefile with common development commands

๐Ÿ“ฆ Installation

With uv (recommended)

uv add fastplate

With pip

pip install fastplate

With pipx (global install)

pipx install fastplate

๐Ÿš€ Quick Start

Using uv (recommended)

# Create a new project directory and add fastplate
mkdir my-app && cd my-app
uv init
uv add fastplate

# Initialize the project
uv run fastplate init --name "My App"

# Start development
make dev          # FastAPI server at http://localhost:8000
make npm-watch    # Tailwind CSS watcher (in another terminal)

Using pip/pipx

# Create in a new directory
fastplate init ./my-app --name "My App"
cd my-app

# Start development
make dev
make npm-watch

๐Ÿ“– CLI Reference

Fastplate uses a command-based CLI structure.

Commands

Command Description
init Initialize a new FastAPI + Tailwind CSS project

fastplate init

Scaffolds a new project with the full FastAPI + Tailwind CSS stack.

fastplate init [OPTIONS] [PATH]
# or with uv
uv run fastplate init [OPTIONS] [PATH]

Arguments

Argument Description Default
PATH Directory to create the project in . (current directory)

Options

Option Short Description
--name TEXT -n Project name (prompts if not provided)
--skip-install Skip automatic dependency installation
--force -f Overwrite existing project files
--help Show help message and exit

Examples

# Interactive mode - prompts for project name
uv run fastplate init

# Specify project name directly
uv run fastplate init --name "My Awesome App"

# Create in a specific directory
uv run fastplate init ./projects/my-app --name my-app

# Skip automatic dependency installation
uv run fastplate init --skip-install

# Overwrite existing project files
uv run fastplate init --force

# Short flags
uv run fastplate init -n "My App" -f

What it does

  1. Copies template - Scaffolds the full project structure into the target directory
  2. Replaces placeholders - Injects your project name into config files (pyproject.toml, templates, etc.)
  3. Installs Python deps - Runs uv sync to install FastAPI and dependencies
  4. Installs npm deps - Runs npm install in frontend/ for Tailwind CSS

Use --skip-install if you want to handle dependency installation manually.

๐Ÿ“ Generated Project Structure

my-app/
โ”œโ”€โ”€ app/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ main.py              # FastAPI application entry point
โ”‚   โ”œโ”€โ”€ api/                  # API routes (REST endpoints)
โ”‚   โ”œโ”€โ”€ core/
โ”‚   โ”‚   โ”œโ”€โ”€ config.py        # Settings & configuration
โ”‚   โ”‚   โ””โ”€โ”€ middleware.py    # Custom middleware
โ”‚   โ”œโ”€โ”€ models/              # Database models (SQLAlchemy, etc.)
โ”‚   โ”œโ”€โ”€ schemas/             # Pydantic schemas for validation
โ”‚   โ”œโ”€โ”€ services/            # Business logic layer
โ”‚   โ””โ”€โ”€ views/               # HTML view routes (Jinja2)
โ”‚       โ””โ”€โ”€ index.py
โ”œโ”€โ”€ frontend/
โ”‚   โ”œโ”€โ”€ package.json         # npm dependencies (Tailwind)
โ”‚   โ”œโ”€โ”€ static/
โ”‚   โ”‚   โ””โ”€โ”€ css/
โ”‚   โ”‚       โ”œโ”€โ”€ input.css    # Tailwind source
โ”‚   โ”‚       โ””โ”€โ”€ output.css   # Compiled CSS
โ”‚   โ””โ”€โ”€ templates/
โ”‚       โ”œโ”€โ”€ base.html        # Base template with layout
โ”‚       โ”œโ”€โ”€ components/      # Reusable Jinja2 components
โ”‚       โ”‚   โ”œโ”€โ”€ card.html
โ”‚       โ”‚   โ””โ”€โ”€ navbar.html
โ”‚       โ””โ”€โ”€ pages/           # Page templates
โ”‚           โ””โ”€โ”€ index.html
โ”œโ”€โ”€ Dockerfile
โ”œโ”€โ”€ docker-compose.yml
โ”œโ”€โ”€ Makefile                 # Development commands
โ”œโ”€โ”€ pyproject.toml           # Python project config
โ””โ”€โ”€ README.md                # Project-specific docs

๐Ÿ› ๏ธ Development Commands

The generated project includes a Makefile with these commands:

make dev          # Start FastAPI dev server with hot reload
make run          # Start production server
make npm-watch    # Watch & compile Tailwind CSS
make npm-build    # Build minified CSS for production
make docker-up    # Start with Docker Compose
make docker-down  # Stop Docker containers
make clean        # Remove generated files

๐ŸŽจ Styling with Tailwind & DaisyUI

The template uses Tailwind CSS v4 with DaisyUI components.

Edit frontend/static/css/input.css to customize your styles:

@import "tailwindcss";
@plugin "daisyui";

/* Your custom styles here */

Run make npm-watch during development to auto-compile CSS changes.

๐Ÿณ Docker Deployment

# Build and run with Docker Compose
make docker-up

# Or manually
docker build -t my-app .
docker run -p 8000:8000 my-app

๐Ÿ“‹ Requirements

  • Python 3.12+
  • Node.js 18+ (for Tailwind CSS)
  • uv (recommended) or pip

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“„ License

MIT License - see LICENSE for details.

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

fastplate-0.1.0.tar.gz (74.5 kB view details)

Uploaded Source

Built Distribution

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

fastplate-0.1.0-py3-none-any.whl (43.7 kB view details)

Uploaded Python 3

File details

Details for the file fastplate-0.1.0.tar.gz.

File metadata

  • Download URL: fastplate-0.1.0.tar.gz
  • Upload date:
  • Size: 74.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.10

File hashes

Hashes for fastplate-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0c79222faf3e55e7aa6820ef5c91cfdf1aa44ed13968f25342453be10604864c
MD5 17a977464f7b02b2de67099a6f9fa2de
BLAKE2b-256 2d9fe427a917fca27a3e41781e36ecd5bcb1a06ed869e48bfc76827b43af255f

See more details on using hashes here.

File details

Details for the file fastplate-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: fastplate-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 43.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.10

File hashes

Hashes for fastplate-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f31688723173282f11d0e66855aa8aad3fe2cb5f12272cfe62c1ed2d2966790
MD5 c2d204b298d614e4aa5f4a66da1a614e
BLAKE2b-256 a5f7ffa261ff1c3db226042c29c1ef63ea890d6f1a93f6ce6cff7980faf83074

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