Modern admin panel framework for Litestar with Cloudflare-inspired UI
Project description
litestar-admin
Modern admin panel framework for Litestar applications with a Cloudflare-inspired UI.
litestar-admin provides a production-ready admin interface for managing SQLAlchemy models in Litestar applications, featuring:
- Cloudflare Dashboard-inspired UI - Modern dark theme with clean card layouts
- Full CRUD Operations - Create, read, update, delete with bulk actions
- RBAC Authorization - Role-based access control with granular permissions
- Audit Logging - Track all admin actions for compliance
- SQLAlchemy Integration - Works with SQLAlchemy 2.x and Advanced-Alchemy
- Auto-discovery - Automatically discovers and registers models
- JWT & OAuth2 Authentication - Flexible, pluggable auth backends
- Static Export Frontend - Next.js frontend with no runtime Node.js required
Installation
# Basic installation
pip install litestar-admin
# With JWT authentication
pip install litestar-admin[jwt]
# With OAuth support
pip install litestar-admin[oauth]
# With sqladmin bridge
pip install litestar-admin[sqladmin]
# All extras
pip install litestar-admin[all]
Quick Start
from litestar import Litestar
from litestar_admin import AdminPlugin, AdminConfig, ModelView
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
# Define your models
class Base(DeclarativeBase):
pass
class User(Base):
__tablename__ = "users"
id: Mapped[int] = mapped_column(primary_key=True)
email: Mapped[str] = mapped_column(unique=True)
name: Mapped[str]
# Create admin views
class UserAdmin(ModelView, model=User):
column_list = ["id", "email", "name"]
column_searchable_list = ["email", "name"]
can_delete = False # Disable deletion
# Create the app
app = Litestar(
plugins=[
AdminPlugin(
config=AdminConfig(
title="My Admin",
views=[UserAdmin],
)
)
]
)
Configuration
from litestar_admin import AdminConfig
from litestar_admin.auth import JWTAuthBackend
config = AdminConfig(
# Basic settings
title="My Admin Panel",
base_url="/admin",
theme="dark", # or "light"
# Authentication
auth_backend=JWTAuthBackend(
secret_key="your-secret-key",
algorithm="HS256",
),
# Model views
views=[UserAdmin, PostAdmin],
auto_discover=True, # Auto-discover models
# Rate limiting
rate_limit_enabled=True,
rate_limit_requests=100,
rate_limit_window_seconds=60,
)
Model Views
from litestar_admin import ModelView
class UserAdmin(ModelView, model=User):
# Display settings
name = "User"
name_plural = "Users"
icon = "user"
category = "User Management"
# Column configuration
column_list = ["id", "email", "name", "created_at"]
column_exclude_list = ["password_hash"]
column_searchable_list = ["email", "name"]
column_sortable_list = ["id", "email", "created_at"]
column_default_sort = ("created_at", "desc")
# Form configuration
form_columns = ["email", "name"]
form_excluded_columns = ["id", "created_at"]
# Permissions
can_create = True
can_edit = True
can_delete = False
can_export = True
# Pagination
page_size = 25
page_size_options = [10, 25, 50, 100]
# Custom access control
async def is_accessible(self, connection) -> bool:
user = connection.user
return user and user.is_admin
RBAC Guards
from litestar_admin.guards import require_permission, Permission
@get("/admin/users", guards=[require_permission(Permission.MODELS_READ)])
async def list_users() -> list[User]:
...
@post("/admin/users", guards=[require_permission(Permission.MODELS_WRITE)])
async def create_user(data: UserCreate) -> User:
...
Development
# Clone the repository
git clone https://github.com/JacobCoffee/litestar-admin.git
cd litestar-admin
# Install development dependencies
make dev
# Run tests
make test
# Run linting
make lint
# Build frontend
make frontend
# Build documentation
make docs
Documentation
Full documentation is available at jacobcoffee.github.io/litestar-admin.
Related Projects
- litestar - The ASGI framework
- advanced-alchemy - SQLAlchemy toolkit
- sqladmin-litestar-plugin - SQLAdmin bridge
License
MIT License - see LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file litestar_admin-0.1.0.tar.gz.
File metadata
- Download URL: litestar_admin-0.1.0.tar.gz
- Upload date:
- Size: 172.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf6602a7d5d218af9384bb9141db1f3bfe458040380c2ef5bbb5a500f2e35f5e
|
|
| MD5 |
eb337bcd5d67dca6958154ef178c345a
|
|
| BLAKE2b-256 |
3f07ae36fce2cdf1faca1e445a09eec0b61a8af062b2e13976d0a3f5b04ef154
|
Provenance
The following attestation bundles were made for litestar_admin-0.1.0.tar.gz:
Publisher:
publish.yml on JacobCoffee/litestar-admin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_admin-0.1.0.tar.gz -
Subject digest:
bf6602a7d5d218af9384bb9141db1f3bfe458040380c2ef5bbb5a500f2e35f5e - Sigstore transparency entry: 998504905
- Sigstore integration time:
-
Permalink:
JacobCoffee/litestar-admin@13acb2caa517ba8bb707e0e698325b69418b0893 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/JacobCoffee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@13acb2caa517ba8bb707e0e698325b69418b0893 -
Trigger Event:
push
-
Statement type:
File details
Details for the file litestar_admin-0.1.0-py3-none-any.whl.
File metadata
- Download URL: litestar_admin-0.1.0-py3-none-any.whl
- Upload date:
- Size: 222.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7be7eca4dfedea1c0e3eb012d0ca7697bc2459ca849c5d04d1d9523c1e44c57e
|
|
| MD5 |
b9345aaac551e6ccb8362ed0ceae749c
|
|
| BLAKE2b-256 |
76631964e11e0d67312cfc175557d594ba6a23dcc2eed264985fd3d02a9495a9
|
Provenance
The following attestation bundles were made for litestar_admin-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on JacobCoffee/litestar-admin
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
litestar_admin-0.1.0-py3-none-any.whl -
Subject digest:
7be7eca4dfedea1c0e3eb012d0ca7697bc2459ca849c5d04d1d9523c1e44c57e - Sigstore transparency entry: 998504970
- Sigstore integration time:
-
Permalink:
JacobCoffee/litestar-admin@13acb2caa517ba8bb707e0e698325b69418b0893 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/JacobCoffee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@13acb2caa517ba8bb707e0e698325b69418b0893 -
Trigger Event:
push
-
Statement type: