Skip to main content

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

Project description

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

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

fhadmin-0.0.2.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

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

fhadmin-0.0.2-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file fhadmin-0.0.2.tar.gz.

File metadata

  • Download URL: fhadmin-0.0.2.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fhadmin-0.0.2.tar.gz
Algorithm Hash digest
SHA256 20f7361e3a8fdc8353c75027dc3f882998689eb5d01df8aedd782da079c1b935
MD5 8239433e683b40399228c8db9fdb2142
BLAKE2b-256 a952c8ac290d068dcc636893e76ac6b257662535dc5518da9fc0812b9af0b358

See more details on using hashes here.

File details

Details for the file fhadmin-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: fhadmin-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for fhadmin-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b2299955d42b71992c4f9781c4f21b79f983ea18e30720a35dedfed0c8068c62
MD5 4fcca385ad3fb3a519e1ccf4a6fd8e4f
BLAKE2b-256 20cc125aad00e96c97e512a7e82eccbd6148f7803a5fab1c8b9fcd7039a28c2b

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