Expand description
Auto-generated CRUD admin backed by crate::orm.
Build an Admin by chaining .model::<T>() calls, then mount it with
Admin::register. This attaches list / create / edit / delete routes
at /admin/<admin_name> for each model and an index page at /admin
listing every registered model.
§UI ownership
The admin HTML shell, layout, forms, tables, auth pages, and error
states are framework-owned: there is no hook for a project to
replace these templates. Visual customisation — logo mark, project
display name, primary/accent colour, density — flows through the
design::Design config (loaded from rustio.design.json if
present). The public templates/ + static/ directories of a
generated project are for public site pages, not for admin
overrides.
For a single-model app, register is a convenience wrapper.
Re-exports§
pub use crate::http::FormData;
Modules§
- admin_
form_ bridge - AdminUiModel → Form bridge + model registry.
- admin_
generator - Config-driven admin model generator.
- audit
- Admin action log — every create / update / delete driven through
the admin writes a row to
rustio_admin_actions. The audit trail powers two user-visible surfaces: - auto_
form - Auto form generation — derive a
FormConfigfrom a Rust type that implementsFormModel, no manual field-by-field wiring. - design
- Admin design customisation.
- entry_
builder - Dynamic AdminEntry construction — 0.7.3.
- form
- Admin-new form engine.
- intelligence
- Admin Intelligence Layer — 0.7.0.
- layout
- Admin page assembler.
- persistence
- Persistence helpers for the admin engine — basic CREATE + UPDATE.
- rbac
- Role-based access control for the admin UI (0.10+).
- relations
- Relation Intelligence Layer — runtime registry.
- schema_
cache - Process-local schema cache — 0.7.2.
- schema_
introspect - Database-driven
AdminModelConfiggeneration. - suggestions
- Actionable suggestion engine — 0.7.1.
- templating
- Admin UI template engine.
- ui
- HTML-escape helper used by Rust code that still concatenates
small fragments outside the main minijinja templates (e.g. FK
cell links inside
list_render, form-field controls insideform_render). Every shell element — topbar, sidebar, page header — is rendered through templates as of 0.10.
Structs§
- Admin
- Builder that collects admin models and mounts them with a shared
/adminindex page. - Admin
Entry - Metadata about one registered admin model.
- Admin
Field - Metadata about one struct field, generated by
#[derive(RustioAdmin)]and consumed by the admin renderer + the schema exporter. - Admin
Relation - Compile-time mirror of
crate::schema::Relation. Uses&'static strso the whole thing isconst-constructible by the#[derive(RustioAdmin)]macro and can live inside theAdminField-typedconst FIELDSslice without a runtime allocation.
Enums§
- Field
Type - The primitive types the admin + schema layers know how to render, validate, and serialise.
Constants§
- CSRF_
FIELD - Name of the hidden form field that carries the per-session CSRF token.
- MAX_
FORM_ BODY_ BYTES - Maximum size of an admin form body.
- USER_
FIELDS - Fields the built-in
Usermodel exposes via the schema. Kept as aconstso tests and the schema exporter reference the same source of truth.password_hashis markededitable: falseso no future UI layer accidentally surfaces the hash in a form;created_atmirrors therustio_users.created_atcolumn so the schema doesn’t under-describe the actual table shape.
Traits§
Functions§
- parse_
datetime_ local - Parse the
YYYY-MM-DDTHH:MM[:SS]value emitted by the browser’s<input type="datetime-local">widget into aDateTime<Utc>. - register
- Convenience: mount CRUD routes and an
/adminindex for a single model. - register_
from_ table - Schema-driven counterpart to
register_generated. Reads the table’s columns viaPRAGMA table_info, builds anAdminModelConfigfrom them, and registers it under the derived slug. The table must already exist — this helper does not issueCREATE TABLE. - register_
generated - Register a config-driven model under its own slug. The closure
captures
cfgand clones it on every lookup, so the registry’sFnfactory can build a freshBox<dyn AdminUiModel>per request without any global state.