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.0rc1.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.0rc1-py3-none-any.whl (1.3 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: starlette_admin-1.0.0rc1.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.0rc1.tar.gz
Algorithm Hash digest
SHA256 98d4184d79259de36bc8033516ce934863f74e93833b7c110d75aee4c34a78f1
MD5 c78622cf8b64be9c1bb542ae123246d3
BLAKE2b-256 9e6443895b863067c82fe91d030d2ca4310952fbc574b59c147eeaa289e457a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: starlette_admin-1.0.0rc1-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.0rc1-py3-none-any.whl
Algorithm Hash digest
SHA256 4a3ae9473b3326e607225864cccdfe339c1d450b98f7ff80176e8a2306b8bc73
MD5 1b172905ab79330a1b4abe29197429a8
BLAKE2b-256 bb0d805e67a12dab84da9caf898bf79b87913d1679222bd5f85250f56b3301d8

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