Skip to main content

A plug-and-play SQLite admin panel for FastAPI — beautiful, fast, and intelligent by default.

Project description

sqlite-panel

A plug-and-play SQLite admin panel for FastAPI — beautiful, fast, and intelligent by default.

Python FastAPI License


Features

  • One-line mount — works with any FastAPI app
  • Auto-discovery — detects all tables and columns automatically
  • Smart cell rendering — JSON formatting, inline image previews, boolean badges, long text expand/collapse, file & URL links
  • Pagination, sorting, filtering, search — all built-in
  • Inline editing — double-click any cell to edit in place
  • Real-time change detection — toast notifications + auto-refresh when the DB changes
  • Read-only mode — disable all writes with a single flag
  • Light & dark mode — with smooth toggle and localStorage persistence
  • Keyboard shortcuts/ to search, n for new row, Esc to close modals
  • SQL injection safe — all user input is parameterised or strictly validated
  • Zero heavy dependencies — HTMX for partial refreshes, vanilla JS, Geist font via Google Fonts

Installation

pip install sqlite_webpanel

Quick start

from sqlite_webpanel import run_panel
run_panel(app, db_path="app.db")
# → Visit http://localhost:8888/admin

Usage example

# dbview.py
from sqlite_webpanel import run_panel
import sqlite3

app = FastAPI()

# Create some demo data
conn = sqlite3.connect("demo.db")
conn.execute("CREATE TABLE IF NOT EXISTS users (id INTEGER PRIMARY KEY, name TEXT, email TEXT)")
conn.execute("INSERT OR IGNORE INTO users VALUES (1,'Alice','alice@example.com')")
conn.commit()
conn.close()

run_panel(db_path="demo.db", title="Demo DB")

# uvicorn main:app --reload

Development

git clone https://github.com/yourname/sqlite_webpanel
cd sqlite_webpanel
pip install -e ".[dev]"
pytest

Architecture

sqlite_panel/
├── __init__.py        # Public API: mount_sqlite_panel
├── mount.py           # FastAPI mounting + static files
├── router.py          # All HTTP endpoints (web layer)
├── db.py              # Core DB logic (pure Python, no web deps)
├── renderers.py       # Smart cell → HTML conversion
├── static/
│   ├── panel.css      # All styles (CSS variables, light/dark)
│   └── panel.js       # Interactivity (vanilla JS)
└── templates/
    ├── base.html      # Layout with sidebar
    ├── table.html     # Table view with toolbar
    ├── row_detail.html
    ├── empty.html
    ├── redirect.html
    └── partials/
        └── rows.html  # HTMX partial for table body

Key design decisions:

  • db.py has zero FastAPI/web imports — testable in isolation
  • renderers.py has zero DB imports — pure value → HTML transformation
  • All SQL uses parameterised queries or _safe_identifier() validation
  • HTMX partial endpoints allow row refresh without full page reload
  • Change detection via polling /api/fingerprint (row count hash)

Keyboard shortcuts

Key Action
/ Focus search
n Open "New Row" modal
Esc Close modal / cancel edit
Double-click cell Inline edit

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

sqlite_webpanel-0.1.1.tar.gz (28.6 kB view details)

Uploaded Source

Built Distribution

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

sqlite_webpanel-0.1.1-py3-none-any.whl (27.6 kB view details)

Uploaded Python 3

File details

Details for the file sqlite_webpanel-0.1.1.tar.gz.

File metadata

  • Download URL: sqlite_webpanel-0.1.1.tar.gz
  • Upload date:
  • Size: 28.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for sqlite_webpanel-0.1.1.tar.gz
Algorithm Hash digest
SHA256 cf0b516069ec27974c414295da9ec959af1e99cab08b7d4de365cfabb55c040d
MD5 98c462d45eeac31849c837049ad9114b
BLAKE2b-256 36e2b07c7393d8e40ca908d7e2dd09dfd975e2f8ccf0d2067bee03464e70efac

See more details on using hashes here.

File details

Details for the file sqlite_webpanel-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlite_webpanel-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89b9b60ea3dcbb8ee93d3abf72ef16d97051b74094eb9da74729bca8bf32aef4
MD5 36372c64ca6875d79b1d0ef96df4d34f
BLAKE2b-256 938bd0c861b1146134f7a45f160d7417ddd8786b0f5c0d71a998744d03a5ebae

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