Runique Admin
Runique's admin builds a full CRUD UI from a typed builder (ModelAdmin). No admin! macro, no generated files: you declare SeaORM columns, the framework serves routes, list views, forms and permissions.
Before you start
-
The
adminfeature is required. Without it, the admin module isn't compiled:with_admin,ModelAdmin,AdminSitedon't exist.runique = { version = "4.0.0", features = ["postgres", "admin"] } -
with_public_urlis required in production when the admin is enabled: without it, the boot is refused (links sent by email would be built from the request'sHostheader, which anyone can forge). In debug, the request'sHoststands in for it. -
Every
model!{}of the project must be registered in the admin (register, oraccounts_usersfor the accounts' extension). At boot, group rights targeting an unregistered model are deleted from the database. -
The framework's accounts, groups and rights are provided: you don't declare them.
Minimal example
use runique::admin::{AdminSite, ModelAdmin};
use runique::app::staging::AdminStaging;
use crate::entities::article;
pub fn config(admin: AdminStaging) -> AdminStaging {
admin
.site_title("Administration")
.path("/admin/")
.site(|site| site.register(articles()))
}
fn articles() -> ModelAdmin<article::Entity> {
use article::Column::*;
ModelAdmin::new()
.title("Articles")
.list(|l| {
l.display([Title, Status, Views])
.links([Title])
.sortable([Title])
.search([Title])
.filter([Status])
})
.form(|f| f.fields([Title, Body, Status]))
}
Then in main:
builder::new(config)
.routes(url::routes())
.with_database(db)
.with_admin(admin::config)
.build()
.await?
.run()
.await?;
| File | Contents |
|---|---|
| Setup | Wire the admin, path, prefix, superuser |
| Declaration | AdminStaging, AdminSite, registration |
ModelAdmin builder | List + form API, typed columns |
| Boot validation | Checks run at startup |
| User creation | Create → email → activation flow |
| List view | Pagination, sort, search, filters, actions |
| Permissions | Ranks, groups, rights grid |
| Templates | Override pages and blocks |
| Roadmap | Future ideas |