Skip to main content

Fast, beautiful and extensible administrative interface framework for FastAPI & Starlette applications

Project description

starlette-admin

An extensible administrative interface framework for FastAPI and Starlette applications.

Tests Coverage PyPI version Python versions

Admin panel

Installation

# Using uv
uv add starlette-admin

# Using pip
pip install starlette-admin

Quickstart

Get a fully functional administrative dashboard up and running in minutes. This example demonstrates an integration with FastAPI and SQLAlchemy.

from contextlib import asynccontextmanager
from datetime import datetime, timezone

from fastapi import FastAPI
from sqlalchemy import create_engine
from sqlalchemy.orm import DeclarativeBase, Mapped, mapped_column
from starlette_admin.contrib.sqla import Admin, ModelView

engine = create_engine("sqlite:///blog.db", connect_args={"check_same_thread": False})


class Base(DeclarativeBase):
    pass


class Post(Base):
    __tablename__ = "posts"

    id: Mapped[int] = mapped_column(primary_key=True)
    title: Mapped[str]
    content: Mapped[str]
    published: Mapped[bool] = mapped_column(default=False)
    created_at: Mapped[datetime] = mapped_column(
        default=lambda: datetime.now(timezone.utc)
    )


class PostView(ModelView):
    fields = ["id", "title", "content", "published", "created_at"]
    searchable_fields = ("title", "content")


@asynccontextmanager
async def lifespan(app: FastAPI):
    Base.metadata.create_all(engine)
    yield


app = FastAPI(lifespan=lifespan)
admin = Admin(engine, title="Blog Admin", secret_key="change-me")
admin.add_view(PostView(Post, icon="fa fa-newspaper"))
admin.mount_to(app)

Run with fastapi dev and open http://127.0.0.1:8000/admin.

Features

  • Generated CRUD pages for your models
  • Pagination, sorting, search, and shareable URLs
  • Nested AND/OR filter builder
  • Inline editing for related models
  • Bulk actions and custom row actions
  • CSV, Excel, JSON, and PDF export
  • CSV, JSON and Excel import with dry-run validation
  • Local and S3-compatible file storage (Amazon S3, MinIO, ...)
  • Event hooks before and after CRUD operations
  • Pluggable authentication, storage, fields, actions, and model views
  • Theme customization, dark mode, internationalization, and timezone support

Supported ORMs & Backends

starlette-admin is built to be agnostic. It ships with built-in support for popular ORMs and databases:

Backend Package Path
SQLAlchemy starlette_admin.contrib.sqla
SQLModel starlette_admin.contrib.sqlmodel
Tortoise ORM starlette_admin.contrib.tortoise
Beanie (MongoDB) starlette_admin.contrib.beanie
MongoEngine starlette_admin.contrib.mongoengine
Custom Data Sources Subclass BaseModelView

Documentation & Resources

Live Demo

Explore the interface in action: starlette-admin-demo.jowilf.com

Contributing

Contributions are always welcome! Whether it is reporting a bug, discussing improvements, or submitting a pull request, your input helps make this project better.

Please review our CONTRIBUTING.md guidelines before opening a pull request.

License

This project is licensed under the MIT License.

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

starlette_admin-1.0.0rc2.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

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

starlette_admin-1.0.0rc2-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

Details for the file starlette_admin-1.0.0rc2.tar.gz.

File metadata

  • Download URL: starlette_admin-1.0.0rc2.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starlette_admin-1.0.0rc2.tar.gz
Algorithm Hash digest
SHA256 46371172eca728fa179a559f8e52f4b41708656bda629f41023ca41b0cc13b2a
MD5 aa7d1e5bca1cff741ee1985103896ac5
BLAKE2b-256 fd5c03bfbf277d5441fc0690a83ec061cb17bb8f7aeae08cd7da30986f51fc1d

See more details on using hashes here.

File details

Details for the file starlette_admin-1.0.0rc2-py3-none-any.whl.

File metadata

  • Download URL: starlette_admin-1.0.0rc2-py3-none-any.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.32 {"installer":{"name":"uv","version":"0.11.32","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for starlette_admin-1.0.0rc2-py3-none-any.whl
Algorithm Hash digest
SHA256 6b217898ab60cb86e5610804fe1b4abefca3f6c6621ae536254d2e1ec5614286
MD5 4dd5f6be9416ee506e504c870cab3123
BLAKE2b-256 a4d767e97b319d2bf88968ad7bd0ab9e37cccb2157b4aca004b0b74cfe8de810

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