Skip to content

CLI tool to scaffold production-ready FastAPI projects with Tailwind CSS v4, DaisyUI, and Jinja2 templates

License

Notifications You must be signed in to change notification settings

MichielMe/fastplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸš€ 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.

About

CLI tool to scaffold production-ready FastAPI projects with Tailwind CSS v4, DaisyUI, and Jinja2 templates

Topics

Resources

License

Stars

Watchers

Forks