$ show jowilf/starlette-admin
starlette-admin is a comprehensive admin interface library for Starlette and FastAPI applications, providing auto-generated CRUD views with search, sorting, filtering, inline editing, batch actions, import/export, and a widget-based dashboard system. It is designed as an ASGI middleware that mounts onto a Starlette app, using Jinja2 templating, itsdangerous for cookie signing, and python-multipart for file uploads. The architecture is backend-agnostic: the core defines abstract interfaces for model views, fields, filters, storage, and authentication, while optional ORM integrations (SQLAlchemy, SQLModel, Beanie, MongoEngine, Tortoise) provide concrete implementations. The library also includes a plugin and theme system, internationalization (Babel), CSRF protection, flash messages, and a full event lifecycle for audit and custom logic. It is a pure application libraryβno data research or analytics components.
The LLM identified 3 files worth highlighting for reuse:
Implements a generic filter tree with FilterGroup (AND/OR) and FilterRule, plus a string-based serialization format that makes filter state bookmarkable. The base classes are ORM-agnostic; each backend provides concrete `apply()` implementations. This is a clean, decoupled pattern that could be extracted and reused in any web application needing query/filter state management.
Provides an AdminEventBus with typed context objects (BeforeCreateContext, AfterEditContext, etc.), priority-ordered subscribers, and decorator-based registration. Supports commit-aware hooks (e.g., AFTER_CREATE_COMMITTED). This pattern is reusable for any application needing clean separation of core CRUD logic from cross-cutting concerns like auditing, caching, or notifications.
Defines a suite of content widgets (StatWidget, ChartWidget, TableWidget) and layout widgets (RowWidget, ColumnWidget, TabsWidget, PanelWidget) with automatic CSS/JS asset collection. Supports shorthand syntax (string becomes FieldRef, tuple becomes RowWidget, list becomes ColumnWidget). This pattern can be reused for building any composable UI with server-rendered components and declarative asset management.