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
  • 📄 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 custom SQL

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.1.tar.gz (15.2 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.1-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for fhadmin-0.0.1.tar.gz
Algorithm Hash digest
SHA256 908f26df719c03584234f9156a988188e5217ec63a59b942518da7c4d5825eeb
MD5 35c515dfa00d470ee151fde7fd4c7ebe
BLAKE2b-256 9b0b219371d27101337cfa07f5920538debff25658b05adbdb63e5d03d7bf42f

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for fhadmin-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37fd21228a92b001c6a9f3561ac1eb5847c46b85312e113ce1053ed1831d5470
MD5 893927eb7b734c468a9f71425764a2f8
BLAKE2b-256 a1f13ef0619dd6d3c722d8333bd4912b4a18f690155c3b540f5698fbe2e49eac

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