Skip to main content

A FastAPI package with CRUD endpoints and a Vue + AG Grid frontend for SQLAlchemy models.

Project description

fastapi_agmin

fastapi_agmin is an open-source Python package that provides an autogenerated admin interface for SQLAlchemy models.
It delivers an interactive, in-table CRUD experience using FastAPI + Vue 3 + AG Grid, a CRUD Admin interface for FastAPI SQLAlchemy backed models.

Using it should be as simple as:

from fastapi import FastAPI
from fastapi_agmin import create_agmin

# SQLAlchemy setup
Base = declarative_base()
engine = create_engine("sqlite:///test.db")
SessionLocal = sessionmaker(autocommit=False, autoflush=False, bind=engine)

# Dependency for FastAPI: yields a session and always closes it
def get_db() -> Generator:
    db = SessionLocal()
    try:
        yield db
    finally:
        db.close()

app = FastAPI()
# BELOW IS THE PART THAT MATTERS
create_agmin(Base, get_session=get_db, app=app_test)  # your Base, app, and session here

Then just start your server with uvicorn as normally and access localhost:8000/agmin (if running a local server).

Setup for development

  1. Install backend dependencies
pip install uv  # in case it is not installed 
uv venv
uv pip install '.[dev]'
  1. Build frontend
cd frontend
npm install
npm run build

or, if you prefer serving the frontend separately for quicker iteration

cd frontend
npm install
npm run dev

but remeber to build before commiting, because the project is designed to be served by fastapi without an extra frontend server.

  1. Run fastapi test app
uvicorn tests.fastapi_agmin.app_test:app_test --reload --log-level debug

Project Goal

Build a plug-and-play admin interface that:

  • Works with any project using SQLAlchemy models.
  • Automatically exposes CRUD endpoints without manual wiring.
  • Provides a rich, interactive web interface with inline edits, add/remove, and relationship handling.
  • Ships as a single Python package with html and Vue built assets builtin.

🐍 Python Backend Responsibilities

The backend is powered by FastAPI and provides:

✅ A create_agmin function you can import use with your SQLAlchemy Base.
✅ Automatic model introspection (fields, relationships, many-to-many).
✅ A JSON/YAML metadata endpoint at /models/metadata that describes the models + relationships.
✅ Standardized CRUD API endpoints:

  • GET /models/{model}
  • POST /models/{model}
  • PUT /models/{model}/{id}
  • DELETE /models/{model}/{id}

✅ A FastAPI router that serves the prebuilt Vue app at /admin.

Everything is bundled — no extra setup on the Python side.


🌐 Vue 3 Frontend Responsibilities

The frontend (under frontend/) is a standalone TypeScript + Vue 3 app that:

✅ Dynamically loads the backend's model metadata.
✅ Renders AG Grid tables for each model with:

  • Editable cells.
  • Add/delete row buttons.
  • Support for many-to-many and foreign key relationships.

✅ Talks to the backend only over REST APIs using Axios. ✅ Builds into static assets (HTML, JS, CSS) using Vite. ✅ Outputs to src/fastapi_agmin/static/ for Python to serve.

Work to be done

  1. Pagination and pushed down columns filters: the agmin can handle small databases now. To handle big ones, we need to paginate results fetched from the backend. If we do so, column level filters need to be pushed to the API, otherwise they will only filter the results in the current page.
  2. Add Column names and Modal Form fields comming from backend defined names. The same for help text and alike.

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

fastapi_agmin-0.1.1.tar.gz (8.1 MB view details)

Uploaded Source

Built Distribution

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

fastapi_agmin-0.1.1-py3-none-any.whl (8.0 MB view details)

Uploaded Python 3

File details

Details for the file fastapi_agmin-0.1.1.tar.gz.

File metadata

  • Download URL: fastapi_agmin-0.1.1.tar.gz
  • Upload date:
  • Size: 8.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.7

File hashes

Hashes for fastapi_agmin-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ec47ca2bc66acdd592c74830f857af35b07d2e416afcb3b2d6fe7ec3d80b474c
MD5 5669356f3dfe86fb61dffa2292eec10c
BLAKE2b-256 8cb9ffca7a0a087a087bf9eeafa69e4bff55d123a266d2e870bc23ecd2206bf1

See more details on using hashes here.

File details

Details for the file fastapi_agmin-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for fastapi_agmin-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e9d5a2b83bc9d063b20431780990cee4e79e2964b3b6307fd1aa680b3f087076
MD5 4ba0226b6048fe2d4e34f28fd55ba79f
BLAKE2b-256 59a73fdbed3714068c630d8707c76f951ced64245bedc17d63ffb0955f7d20b0

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