fastapiadmin
A beautiful, minimal admin panel for FastAPI + SQLAlchemy.
Install
pip install fastapiadmin
Quick Start
from fastapi import FastAPI
from sqlalchemy import create_engine, Column, Integer, String, Boolean
from sqlalchemy.orm import DeclarativeBase
from fastapiadmin import AdminSite, ModelAdmin
engine = create_engine("sqlite:///./app.db")
class Base(DeclarativeBase): pass
class User(Base):
__tablename__ = "users"
id = Column(Integer, primary_key=True)
name = Column(String(100))
email = Column(String(200))
active = Column(Boolean, default=True)
Base.metadata.create_all(engine)
app = FastAPI()
admin = AdminSite(
app=app,
engine=engine,
title="My Admin",
username="admin",
password="secret",
)
@admin.register(User)
class UserAdmin(ModelAdmin):
list_display = ["id", "name", "email", "active"]
search_fields = ["name", "email"]
Visit http://localhost:8000/admin — done.
AdminSite options
| Parameter | Default | Description |
|---|---|---|
app |
— | FastAPI instance |
engine |
— | SQLAlchemy Engine |
title |
"Admin" |
Sidebar/page title |
prefix |
"/admin" |
URL prefix |
username |
None |
Login username (no auth if omitted) |
password |
None |
Login password |
brand_color |
"#6366f1" |
Accent color (any hex) |
secret_key |
"change-me-in-production" |
Signs session cookies |
ModelAdmin options
| Attribute | Default | Description |
|---|---|---|
list_display |
all columns | Columns shown in list view |
search_fields |
[] |
Columns searched by the search bar |
exclude |
[] |
Fields hidden from create/edit form |
readonly_fields |
[] |
Fields shown but not editable |
per_page |
20 |
Rows per page |
verbose_name_plural |
model name + "s" | Label in the sidebar |
Run the demo
git clone https://github.com/fastapiadmin/fastapiadmin
cd fastapiadmin
pip install -e ".[dev]"
uvicorn example.main:app --reload
Open http://localhost:8000/admin — login: admin / admin123
License
MIT
Metadata
Release files for btn-fastapiadmin 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| btn_fastapiadmin-0.1.0.tar.gz | 21.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| btn_fastapiadmin-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 47.1 kB
Release files / btn_fastapiadmin-0.1.0.tar.gz
| Download URL | btn_fastapiadmin-0.1.0.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e655502998c5538e44ca15d8472aba1ce3b4ecd97636fef114784fbb7406f027
|
|
BLAKE2b-256 checksum How to use checksums |
22f0a29c9f09832943a747674b0ed8b89273d1d14e05cc31e024666146a18987
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|
Release files / btn_fastapiadmin-0.1.0-py3-none-any.whl
| Download URL | btn_fastapiadmin-0.1.0-py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6e99a5649973f210cca09b620b8082c6f2774fdb88363245e11a4a2eac279505
|
|
BLAKE2b-256 checksum How to use checksums |
055e529fd10d7726878a552115a96b9aaed4c94da9bd37232d51ef836ab870cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.14
|