Admin toolkit for Rust, server-rendered on Topcoat (UI and reactivity) and Toasty (ORM). Declare a resource per model and get its list, create, edit, detail and delete pages, with no SPA build step.
Tablo is experimental: until 1.0, a minor version may break the API.
Try the live demo at demo.tablo.y-l.fr.
Tablo needs Rust 1.100 or newer; every crate declares that as its rust-version.
Run the showcase, a blog's admin panel that exercises every feature, through the Topcoat CLI:
cargo install topcoat-cli --version 0.12 --locked
topcoat dev -p showcase
# open http://localhost:3000/admin/userstopcoat dev builds the showcase, bundles its assets beside the binary, serves it, and rebuilds it
when a source file changes. cargo run -p showcase alone stops with an error: it finds no asset
bundle.
Depend on the tablo facade and pick a database driver (the
first-panel chapter has the full manifest, including the
topcoat and toasty pins):
cargo add tablo --features sqliteThe panel styles itself with Tablo's prebuilt stylesheet. To change the theme or style your own
pages with Tailwind, build the stylesheet with tablo-build instead (cargo add --build tablo-build).
sqlite, postgresql, mysql and turso each turn on Toasty's driver of the same name; the
toolkit enables none of them itself, and the testing feature adds the in-memory client
tablo::testing.
examples/quickstart is the smallest complete app; CI builds it from outside this repository.
A model derives the table and detail page it reads as by default, and a resource names it, its form and its policy:
use tablo::prelude::*;
#[derive(Debug, Clone, toasty::Model, tablo::PanelModel)]
pub struct User {
#[key]
#[auto]
pub id: uuid::Uuid,
pub name: String,
#[default(jiff::Timestamp::now())]
pub created_at: jiff::Timestamp,
}
pub struct UserResource;
impl Resource for UserResource {
type Model = User;
type Form = NoForm<Self::Model>; // list-only: no create or edit pages
fn declare() -> ResourceDef<Self> {
ResourceDef::new().policy(ReadOnly) // the default policy denies everything
}
}The panel registers it and frames its pages in the shell, and the app mounts the panel on its own router, beside its other routes:
fn router(db: toasty::Db) -> topcoat::Result<Router> {
let mut builder = Router::builder().discover().with(db);
builder.panel(
Panel::new("admin")
.resource::<UserResource>()
.auth(Auth::disabled()), // drop this line to require a login
)?;
Ok(builder.build())
}One router mounts several panels at distinct prefixes, each with its own resources, shell and
login. To add create and edit pages, derive tablo::ModelForm on the model, name the UserForm it
writes as the resource's Form, and give it a policy that allows Create and Update. The
first panel chapter builds a complete app with forms and login.
- Tablo's site, with the examples gallery
- User guide
- API reference
- Technical atlas
- Showcase
- Vocabulary
- Design decisions
- Toasty
- Topcoat
Small fixes can go straight to a pull request; open an issue first for larger changes. The contributing guide covers the layout, the checks and the rules.
MIT, see LICENSE.