Skip to main content

React SPA admin for SQLAlchemy with FastAPI and Starlette

Project description

Build Status


spa-sqladmin: React SPA Admin for Starlette/FastAPI

spa-sqladmin is a modern React SPA rewrite of sqladmin providing a better UI/UX.

Main features include:


Installation

$ pip install spa-sqladmin

Or with uv:

$ uv add spa-sqladmin

Screenshots

spa-sqladmin-screenshot-1 spa-sqladmin-screenshot-2 spa-sqladmin-screenshot-3

Quickstart

Let's define an example SQLAlchemy model:

from sqlalchemy import Column, Integer, String, create_engine
from sqlalchemy.orm import declarative_base


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


class User(Base):
    __tablename__ = "users"

    id = Column(Integer, primary_key=True)
    name = Column(String)


Base.metadata.create_all(engine)  # Create tables

If you want to use SQLAdmin with FastAPI:

from fastapi import FastAPI
from spa_sqladmin import Admin, ModelView


app = FastAPI()
admin = Admin(app, engine)


class UserAdmin(ModelView, model=User):
    column_list = [User.id, User.name]


admin.add_view(UserAdmin)

Or if you want to use SQLAdmin with Starlette:

from spa_sqladmin import Admin, ModelView
from starlette.applications import Starlette


app = Starlette()
admin = Admin(app, engine)


class UserAdmin(ModelView, model=User):
    column_list = [User.id, User.name]


admin.add_view(UserAdmin)

Now visiting /admin on your browser you can see the SQLAdmin interface.

Find an extensive example in the example folder.

For a full overview of Admin(...) parameters, icon formats, palette syntax, and custom admin patterns, see docs/USAGE.md.

Acknowledgements

This project would not have been possible without sqladmin.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spa_sqladmin-0.3.0.tar.gz (246.7 kB view details)

Uploaded Source

Built Distribution

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

spa_sqladmin-0.3.0-py3-none-any.whl (255.2 kB view details)

Uploaded Python 3

File details

Details for the file spa_sqladmin-0.3.0.tar.gz.

File metadata

  • Download URL: spa_sqladmin-0.3.0.tar.gz
  • Upload date:
  • Size: 246.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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 spa_sqladmin-0.3.0.tar.gz
Algorithm Hash digest
SHA256 225b3e55e7d543e1c84fff9701faa9fb75476f2315dea30acca3f504c4aababd
MD5 63006dd6cb5cdbb274737ddb1fcb8add
BLAKE2b-256 6d686276cc1680d9d64562ded2223b233dc19337fa30ed64279fd17239a27e33

See more details on using hashes here.

File details

Details for the file spa_sqladmin-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: spa_sqladmin-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 255.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","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 spa_sqladmin-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a193759a193a9c05d5ab81ca5dcc72c6a5216e691ceeaec6449916f80ebb7c5
MD5 d45347eb216971ee9694fe3d69304199
BLAKE2b-256 856b874a22de60382ffb051f278206a70b5d512c030a2f59c8d0760acdcc05b8

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