Starter template for FastHTML applications with plugins, workers, settings, and resource management built-in.
- Schema-driven Settings - Auto-generated settings UI from JSON schemas
- Plugin System - Extensible plugin architecture
- Background Workers - Long-running job processing (optional)
- Resource Monitoring - CPU/GPU/memory tracking (optional)
- DaisyUI Styling - Themed components
- Minimal Boilerplate - Helper functions eliminate repetitive code
pip install -r requirements.txtpython demo_app.pyThe app will open in your browser at http://localhost:5000
- Homepage (
/): Overview and quick links - Settings (
/settings): Configure app title, theme, server settings
fasthtml-app-template/
├── app
│ ├── core
│ │ ├── html_ids.py
│ │ ├── navbar.py
│ │ └── page_layout.py
│ ├── main
│ │ ├── components
│ │ │ └── homepage.py
│ │ └── routes.py
│ └── settings
│ ├── config.py
│ ├── schemas.py
│ └── utils.py
├── demo_app.py
└── requirements.txt
Edit app/settings/schemas.py to add new settings:
MY_SCHEMA = {
"name": "my_settings",
"title": "My Settings",
"type": "object",
"properties": {
"my_option": {
"type": "string",
"title": "My Option",
"default": "default_value",
"enum": ["option1", "option2", "option3"]
}
}
}
registry.register(MY_SCHEMA)The settings UI is automatically generated and accessible at /settings.
- Create a new router:
# app/mymodule/routes.py
from fasthtml.common import *
mymodule_ar = APIRouter(prefix="/mymodule")
@mymodule_ar
def index():
return Div("My Module")- Register it in
demo_app.py:
from app.mymodule.routes import mymodule_ar
register_routes(app, settings_ar, main_ar, mymodule_ar)Edit app/core/navbar.py to modify navigation links:
nav_items = [
("Home", main_rt.home),
("My Page", mymodule_rt.index),
("Settings", settings_rt.index),
]Visit /settings to change themes in the UI, or modify the default in app/settings/schemas.py.
Uncomment the plugin system code in demo_app.py and customize:
from my_plugin_system.plugin_interface import MyPlugin
plugin_registry.register_plugin_system(
category="my_category",
plugin_interface=MyPlugin,
display_name="My Plugins",
auto_discover=True
)Uncomment the worker system code in demo_app.py to enable background job processing with resource management and SSE support.
This template uses helper functions from the cjm-fasthtml libraries to minimize boilerplate:
configure_settings()- Configure settings system in one callregister_routes()- Register multiple routers at onceregister_plugin_system()- Setup plugin systems in one stepcreate_standard_adapters()- Zero adapter boilerplate for workers
See the library documentation for detailed usage.
- cjm-fasthtml-app-core - Core utilities (layout, HTMX, navbar, routing)
- cjm-fasthtml-settings - Schema-driven settings system
- cjm-fasthtml-plugins - Plugin registry and management
- cjm-plugin-system - Generic plugin system
- cjm-fasthtml-workers - Background job processing
- cjm-fasthtml-resources - Resource monitoring
- cjm-fasthtml-sse - Server-sent events
- cjm-fasthtml-workflows - Workflow state management
- cjm-fasthtml-tailwind - Tailwind CSS utilities (no hardcoded CSS!)
- cjm-fasthtml-daisyui - DaisyUI components