Skip to main content

fhadmin

A lightweight, customizable admin panel for FastHTML applications with SQLite databases.

Features

  • 🔐 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

Installation

pip install fhadmin

Quick Start

from 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.

Configuration

The AdminConfig dataclass accepts:

Parameter Type Default Description
db_path str | Path required Path to SQLite database file
password str "admin123" Admin login password

How It Works

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

Routes

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

Requirements

  • Python 3.10+
  • fasthtml
  • fastlite
  • fhdaisy
  • fh-heroicons

License

MIT

Metadata

Release files for fhadmin 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fhadmin 0.0.2
File Size Uploaded
fhadmin-0.0.2.tar.gz 14.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fhadmin 0.0.2
File Interpreter ABI Platform
fhadmin-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.2 kB

Release files / fhadmin-0.0.2.tar.gz

Download URL fhadmin-0.0.2.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
20f7361e3a8fdc8353c75027dc3f882998689eb5d01df8aedd782da079c1b935
BLAKE2b-256 checksum
How to use checksums
a952c8ac290d068dcc636893e76ac6b257662535dc5518da9fc0812b9af0b358
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / fhadmin-0.0.2-py3-none-any.whl

Download URL fhadmin-0.0.2-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2299955d42b71992c4f9781c4f21b79f983ea18e30720a35dedfed0c8068c62
BLAKE2b-256 checksum
How to use checksums
20cc125aad00e96c97e512a7e82eccbd6148f7803a5fab1c8b9fcd7039a28c2b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page