A lightweight, customizable admin panel for FastHTML applications with SQLite databases.
- 🔐 Simple password authentication
- 📊 Table browser with card-based overview
- 🔍 Full-text search across text columns
- ✏️ Inline cell editing
- ➕ Create new records via modal
- 🗑️ Delete records
- 💻 SQL console for custom queries
⚠️ Dangerous SQL query detection with confirmation prompts- 📄 Pagination with smart page buttons
- 🎨 Beautiful UI with DaisyUI/Tailwind
pip install fhadminfrom fasthtml.common import *
from fhadmin.core import AdminConfig, create_admin
from fastlite import database
# Create your main app
app = FastHTML()
# Configure and mount the admin panel
cfg = AdminConfig(db_path="data/mydata.sqlite", password="secret")
admin_app = create_admin(cfg)
app.mount("/admin", admin_app)Visit /admin/login to access the admin panel.
The
AdminConfig
dataclass accepts:
| Parameter | Type | Default | Description |
|---|---|---|---|
db_path |
str | Path |
required | Path to SQLite database file |
password |
str |
"admin123" |
Admin login password |
fhadmin uses a configuration-based architecture that stores settings in
app.state.cfg. Routes read the configuration at request time, making
it:
- Notebook-friendly — Rerun any route cell without side effects
- Easy to debug — Routes are plain functions, no closures
- Flexible — Change database or password at runtime if needed
| Route | Method | Description |
|---|---|---|
/login |
GET/POST | Authentication |
/logout |
POST | End session |
/tables |
GET | Table overview cards |
/tables/{tbl} |
GET | Browse table with search & pagination |
/tables/{tbl}/new |
GET/POST | Create new record |
/tables/{tbl}/{pk} |
DELETE | Delete record |
/tables/{tbl}/{pk}/edit/{col} |
GET/PUT | Inline cell editing |
/tables/{tbl}/sql |
POST | Execute SQL query |
/tables/{tbl}/sql/confirm |
POST | Confirm dangerous SQL queries |
- Python 3.10+
- fasthtml
- fastlite
- fhdaisy
- fh-heroicons
MIT