Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Command Line

lat scaffolds, runs and maintains an application. Every command accepts --database-url <URL>, falling back to DATABASE_URL, then to the configuration of the application found from the current directory upward.

cargo install laterite-cli
lat --help
lat <command> --help

Scaffold

CommandDescriptionOptionsExample
new [NAME]Scaffold and set up a new application, or a static website (interactive).--static: a static website. --content files|folder|git|database: where its content lives, default files. --plugin <SOURCE>: install a plugin, repeatable. --framework-path <PATH>: build against a local framework checkout, also read from LATERITE_FRAMEWORK_PATH. --url, --timezone, --listen, --admin <USERNAME> with --admin-email, --admin-name and the password in LAT_NEW_ADMIN_PASSWORD: answer the prompts up front.lat new "Acme" --static --content git --url https://acme.example --timezone UTC --listen 127.0.0.1:8080 --admin admin --admin-email admin@acme.example --admin-name Ana
make:migration <DESCRIPTION>Scaffold a migration file in this crate’s src/migrations/.--path <PATH>: the crate directory, default ..lat make:migration create_articles
make:plugin <ID>Scaffold a plugin crate; <ID> is vendor.name.--path <PATH>: where to create it, default .. --admin: scaffold the admin half.lat make:plugin acme.blog --admin
make:resource <NAME>Scaffold an entity’s migration, schema, store and admin screen.--path <PATH>: the crate, default .. --field <name:type>: columns beyond id and timestamps; types text, integer, boolean, datetime; repeat or comma-separate. --source <DIR>: keep the records as files in that folder, keyed by a slug column; `–format yamljson
make:model <NAME>Scaffold a typed model struct for a table in src/models/.--path <PATH>: the crate, default .. --field <name:type>: columns beyond id; types text, integer, boolean, datetime. --table <TABLE>: when it is not the plural. See Models.lat make:model article --field title:text,views:integer
seed [MODULE]Run the application’s seeders, or one module’s.--release; -p <PACKAGE>: the binary’s package in a workspace. See Seeding.lat seed acme.blog

Run and check

CommandDescriptionOptionsExample
serveRun this application, or preview a static website’s theme folder, optionally overriding the address.--host <HOST>, --port <PORT>, --listen <HOST:PORT>, --release: build and run optimised.lat serve --port 3000
doctorCheck that this application is set up to run, plugin dependencies included.None.lat doctor
help-appList the application’s commands, its modules’ included.None.lat help-app
any otherRun the application’s command of that name, added by a module (Console Commands).The command’s own.lat pdf check
routesList every URL the application answers: method, path, kind, owner, permission.--path <TEXT>, --method <GET|POST|QUERY>, --kind <resource|screen|settings|public|page|framework>, --owner <MODULE>, --permission <CODE>, --public: keep matching rows, combined. --json: print JSON. --release. -p <PACKAGE>: the binary’s package in a workspace.lat routes --path events --method POST

Local domains

CommandDescriptionOptionsExample
domain setupRoute *.<tld> to 127.0.0.1 via dnsmasq and a macOS resolver entry.--tld <TLD>, default test. --dry-run.lat domain setup --dry-run
domain statusReport the current local-domain DNS state.--tld <TLD>.lat domain status
domain teardownUndo the wildcard DNS configuration.--tld <TLD>. --dry-run.lat domain teardown

Admin users

CommandDescriptionOptionsExample
admin create <USERNAME>Create a superuser.--email <EMAIL> and --first-name <NAME> required; --last-name <NAME>; --password <PASSWORD>, else prompted; --generate: print a strong random password.lat admin create editor --email editor@acme.test --first-name Editor
admin reset-password <USERNAME>Set a new password for a user.--password <PASSWORD>, else prompted; --generate.lat admin reset-password editor --generate
admin listList the admin users.None.lat admin list
admin unlock <USERNAME>Clear a user’s failed-login lockout.None.lat admin unlock editor
admin purgeRemove expired sessions and stay-signed-in credentials.None.lat admin purge

Plugins

CommandDescriptionOptionsExample
plugin add <SOURCE>Add a plugin from a local path or a git URL, and record it.--as <FOLDER>: the folder under plugins/, default the crate’s name. In a static website the first add writes its Cargo project and a plugin needs static = true.lat plugin add ../blog-plugin
plugin remove <NAME>Remove a plugin from the list by crate name or folder.--delete: also delete its folder.lat plugin remove acme-blog --delete
plugin syncRegenerate the plugins-manifest crate from plugins/plugins.toml, then check the plugins’ dependencies.None.lat plugin sync
plugin listList the plugins this application compiles in.None.lat plugin list
plugin checkCheck each installed plugin against the expected layout and its dependencies, listing every crate built twice.None.lat plugin check

Translations

CommandDescriptionOptionsExample
i18n extractRegenerate each crate’s lang/messages.pot from its source strings.None.lat i18n extract
i18n checkFail if any committed messages.pot is out of date.None.lat i18n check
i18n update <LOCALE>Merge each crate’s messages.pot into a locale’s .po, keeping existing translations; creates the .po if absent.None.lat i18n update fr
i18n statusReport translation coverage for each crate’s locale catalogs.None.lat i18n status

Themes

CommandDescriptionOptionsExample
theme export <CODE>Write a theme and its templates to a zip.-o, --out <FILE>, default <code>.zip.lat theme export acme -o acme.zip
theme import <CODE> <FILE>Create or update a theme from a zip.--replace: replace templates and config the theme already has; each replaced template keeps a revision.lat theme import acme acme.zip --replace
theme listList the themes.None.lat theme list
theme build [CODE]Render a theme’s fixed pages and assets to a directory, for a static host.--from <DIR>: a theme folder instead of the database, default theme.folder. -o, --out <DIR>, default dist. --base-url <URL>, default app.url, else one derived from server.listen. --copy <SRC>:<DEST>: a directory copied into the output; repeatable, added to theme.copy.lat theme build --copy docs/book:docs
theme servePreview a theme folder, rebuilt on every change.--from <DIR>, default theme.folder. --listen <HOST:PORT>, default server.listen. --copy <SRC>:<DEST>.lat theme serve
theme publishMake the theme’s saved changes visible to the host: the source’s publish step, then theme.publish.hook.None.lat theme publish

Media

CommandDescriptionOptionsExample
media gcRemove files outside the library that nothing links to, and the blobs no record names any more.--grace <HOURS>: leave younger files alone, default 24. --dry-run. --storage <DIR>, default backend.storage.lat media gc --dry-run
media verifyRe-hash every stored file against its record.--storage <DIR>, default backend.storage.lat media verify

Key

CommandDoes
lat key generateWrites a new application key as app.key in config/local.toml; --rotate keeps the old key under previous_keys, --print prints without writing.
lat key showThe id of the key in use and of the previous keys.
lat crypt rotateRe-seals every sensitive column under the key in use, after lat key generate --rotate.

Cache

CommandDoes
lat cache clearMoves every cache namespace on; every process reads afresh. --namespace records::posts moves one.
lat cache listEvery namespace the deployment knows, with its generation.

Queue

CommandDoes
lat queue workRuns the application’s worker (cargo run -- queue work); --once, --stop-when-empty, --queue high,default, --release.
lat queue listHow many jobs wait and run on each queue.
lat queue failedThe failed list.
lat queue retry <id|all>Puts a failed job back on its queue.
lat queue forget <id|all>Drops a failed job.
lat queue flush [--queue name]Drops every waiting job, or one queue’s.

Schedule

CommandDoes
lat schedule runRuns the application’s ticker (cargo run -- schedule run); --once evaluates this minute and exits.
lat schedule listEvery entry that has run on this deployment, with its last run.

Mail

CommandDoes
lat mail test <address>Sends the built-in test template to the address through [mail].