Tablo
01

Admin toolkit for Rust

Declare the model.
Get the back office.

One resource declaration gives a model its list, forms, detail page and delete, behind sign-in, policies and an audit log. Tablo renders every page on the server with Topcoat and queries your Toasty models, with no JavaScript build.

cargo add tablo --features sqlite

MITcrates.io/crates/tabloRust 1.100+Experimental until 1.0

The code, then the page it servestablo-demo · src/blog/post.rs, condensed
impl Resource for PostResource {    type Model = Post;    type Form = PostForm;     fn declare() -> ResourceDef<Self> {        let col = Post::columns();        ResourceDef::new()            .policy(access::policy(Domain::Blog))            .list_widget::<PostStatusWidget>()            .table(Table::new((                col.image.image(),                col.title.text()                    .searchable()                    .sortable(),                RelationColumn::of::<AuthorResource>(                    relation!(Post.author)),                col.published_at.date().sortable(),            ))            .filters((DateFilter::new(                lens!(Post.published_at)).range(),)))            .action::<TogglePostPublish>()    }}
The demo's post list: a Create Post button, published and draft counts, a search box, column and filter menus, and a table of posts with image, title, author, status, tags and publishing date.

Point at a highlighted line, or a number, to see what it puts on the page.

02
0lines of JavaScript to write or bundle. The pages are HTML from the server.
5.8msmedian for the demo's post list, signed in, rendered whole. How we measured
5themes, each in light and dark, and your own tokens on top.
22resources in the demo: a shop, HR, projects and a blog, on one panel.
03
Topcoat and Toasty alone, versus with TabloWhat you stop writing

A framework serves pages. A back office needs everything else.

Topcoat renders views and routes requests. Toasty reads and writes your models. Between them and a back office someone can trust sits everything below. Tablo is that part, declared beside the model.

ConcernOn a bare framework, you buildWith Tablo, you write
ListsPagination, sort and search parameters, filter forms, empty states, CSV export, bulk delete with a confirmationTable::new((col.title.text().searchable().sortable(), …))
FormsMarkup, parsing, error messages, CSRF tokens, uploads, relation pickers, and a refusal of any field the form does not show#[derive(tablo::RecordForm)] struct PostForm { title: String, … }
Sign-inArgon2id hashing, sessions stored as hashes, throttling, reset and verification mail, authenticator appsAuth::password().two_factor(TwoFactor::new())
PermissionsA check on every page, action, export and search result, and a mask for the fields a role may not read.policy(when(is_editor)) .field_access(…)
TenancyA tenant filter on every query, a guard on every write, a team switcher.tenancy(Tenancy::column(lens!(Post.team_id)))
AuditA trail table, a hook in each write's transaction, a diff of the fields, a page to read itpanel.audit_log(|log| log)
LookA design system, dark mode, a shell with navigation, global search, notificationsBrand::new("Acme").theme(Theme::Ledger)
LanguagesEvery label, message and mail, in each language, with the reader's pick rememberednothing: English and French ship, and .locales(…) picks
TestsA client that signs in, carries the CSRF pair and reads rows back out of the HTMLclient.submit("/admin/posts/-/create", body)
04
Auth, policy, tenancyFails closed

Locked until you open it.

A panel requires sign-in unless you say otherwise. Every policy predicate denies until you allow it. A missing tenant, session or token refuses the request; nothing falls back to a laxer default.

  • Passwords hashed with Argon2id, sign-ins throttled per login and address.
  • Sign-up with email verification, and password reset by mail.
  • Two-factor by authenticator app or emailed code, optional or required.
  • Google or any OpenID Connect provider, bound to the browser that started it.
  • Acting as a user when a rule allows it, named in the audit log.
  • Your own sign-in in front, through Auth::external.
Two-factor setupdemo.tablo.y-l.fr/app/settings/two-factor
The two-factor setup page: a QR code, the key spelled out, a field for the six-digit code, and Turn on.
05
FormsChecked when the server starts

The form is a struct.

Derive it, lay it out in sections, grids and tabs, and pick a control per field: rich text, image uploads, searchable relation pickers, tags, repeaters, conditional fields, wizard steps.

Mounting checks every declaration against the model before the first request. A required column nothing writes stops the server with the fix:

panel '/admin' cannot mount:
  - `PostResource` form: nothing writes the non-nullable column `status` on create: the record form has no such field, toasty fills no `#[default(..)]` for it, and no `create_column` names it, so every create would fail at the driver; a resource that creates nothing declares `without_page(ResourcePage::Create)`
#[derive(tablo::RecordForm)]#[form(model = Post)]pub struct PostForm {    pub title: String,    pub content: String,    #[form(relationship = AuthorResource)]    pub author_id: Option<u64>,    #[form(relationship = TagResource)]    pub tags: Vec<u64>,    #[form(file, optional)]    pub image: String,}
The same form, refusing an empty title/admin/posts/16/edit
The post edit form with a Title field marked in red and the message Title is required, a rich text editor, and author, category and tag pickers.
06
Audit logIn the write's transaction

Who changed what, field by field.

.audit_log(|log| log) keeps an entry for each record a write names, inside that write's transaction, with the fields it changed. Sign-ins and changes of credentials land beside them.

A write that never committed leaves no entry, and one that committed always has one. An administrator acting as a colleague is named next to the colleague. The log is a resource like any other: searchable, exportable, behind its own policy.

Three writes and a sign-in/admin/audit-log
The audit log: rows for a post's title change, a product's price change and a sign-in, each with the old value struck through beside the new one.
07
ThemesOne line, five looks, two schemes

Pick a look. Keep your tokens.

Every theme speaks one grammar: captions in small capitals, ruled heads, the current page notched in the primary, a highlighter on what you point at. Each sets it in its own voice. Redeclare any token in your stylesheet to make it yours.

Ledger, lightThe demo's panel home
The demo's panel home in the Ledger theme: record counts with sparklines, revenue and hours charts, and the latest posts.
Panel::new("admin").brand(Brand::new("Acme").theme(Theme::Ledger))
08
RustCompiled, typed, measured

Milliseconds, with the checks on.

Every figure is a full request to the demo's release build: session lookup, policy, query, the whole page rendered. Nothing is cached.

RequestMedian, then 99th percentile
/admin/posts16 posts with authors and tags, a status widget, the shell
5.8 / 7.0 ms
/admin/employees25 of 126 employees, their pay behind a field access rule
7.9 / 8.8 ms
/admin/orders25 of 600 orders with their customers and status badges
8.4 / 10.0 ms
/adminthe panel home: four counts with sparklines, two twelve-week charts, the latest posts
17.4 / 19.4 ms
How

400 sequential requests after 30 to warm up, one keep-alive connection, an Intel i7-8700 from 2017, in-memory SQLite, signed in as the administrator.

On the wire

The 391 kB order list leaves as 25 kB of Brotli. One binary serves the pages, the assets and Topcoat's runtime: no Node, no bundler, no WASM.

Typed

Columns, fields and filters name a model field through a lens such as lens!(Post.title). Rename the field and the panel stops compiling.

09
10
The stackThree projects, one binary

A layer, not a cage.

Tablo sits on two upstream projects and hides neither. Your own pages use the same view! and #[component] as the panel, and your own queries the same Toasty models.

The Atlas maps how the parts fit: the core's layers, a request's path, where each check runs.

Your app

Models, resources, policies, and any page of your own beside the panel.

Tablo

Panels, resources, tables, forms, actions, auth, tenancy, audit, themes.

Repository
TopcoatRepository

Views, routing, the request context, reactivity, assets, cookies.

ToastyRepository

The ORM: models, relations, queries on SQLite, PostgreSQL, MySQL, Turso.