Menu

A FastAPI admin panel with Jinja and HTMX, without an admin framework
📰

A FastAPI admin panel with Jinja and HTMX, without an admin framework

DEV Community: fastapi·patrykkomow12·1 day ago
#bf1Ow1e8
#devtofastapi#devto#dev#user#admin
Reading 0:00
15s threshold

A SaaS admin panel isn't really a database browser. It's a few screens that answer "who is this customer, what are they paying for, and can I help them?". That's small enough to build with ordinary FastAPI routes, Jinja templates and a few HTMX attributes, and it gets the same CSRF protection, sessions and tests as the rest of your app.

Why not an admin framework?

Libraries like SQLAdmin generate list and edit screens for your models, and for internal CRUD over many tables they're a good fit. A SaaS panel has different needs. The useful operations aren't "edit this row" but "deactivate this account and sign it out everywhere" or "give this partner the Pro plan until March". Those belong to your service layer, and a generic form that lets you type into auth_stamp or status is a way to break things.

So this panel has no generic editing at all. Every button is one route that calls one service function, about 200 lines of routes in total.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.