Smeltery
Get started

Reference

v0.1

The smeltery command

Command Does
smeltery new <name> create an app (questions or flags, see above)
smeltery serve run the app (work instead of serve in a headless app, which has no routes/), restart it when Rust files change, run Tailwind in watch mode when it is installed (TAILWIND_BIN, the binary of smeltery tailwind:install, or tailwindcss on PATH); in a React or Vue app (one with vite.config.ts) run the Vite dev server instead (node node_modules/vite/bin/vite.js, SMELTERY_NODE overrides node; without node_modules/ a warning) and delete storage/framework/vite.hot when it stops
smeltery work run the app's Watchfire agents, queue workers and scheduler without the HTTP server, until Ctrl-C / SIGTERM (then they stop within SHUTDOWN_TIMEOUT)
smeltery agents:list print the running app's agents (through its Watchfire API, see below)
smeltery agents:start / stop / pause / resume / restart <name> control an agent of the running app through its API
smeltery agents:logs <name> print an agent's last log lines from the running app
smeltery agents:token print the app's Watchfire API token
smeltery agents:runs <name> print an agent's latest runs from the database: run id, start, duration, outcome, job, error, counters (--limit N)
smeltery schedule:list print the scheduled tasks: name, kind, expression, next run (UTC)
smeltery schedule:run run the scheduled tasks due this minute once and exit
smeltery route:list print every route: method, path, name, middleware
smeltery migrate run the pending migrations (--force in production)
smeltery migrate:rollback revert the last batch of migrations; --step N reverts the last N
smeltery migrate:fresh drop every table and run every migration; --seed then seeds
smeltery migrate:status list the migrations with Ran / Pending and their batch
smeltery db:seed run the seeders; --class Name runs one (--force in production)
smeltery cache:clear [store] remove every entry of the default cache store, or of the named one (cache:clear redis), except Watchfire's leases and schedule claims (--all: those too)
smeltery key:generate write a new APP_KEY into .env (--show prints one instead and reads no .env); with APP_ENV=production (or no APP_ENV) an existing key is kept unless --force is given, since a new key signs every user out
smeltery storage:link link public/storage to storage/app/public; when that link is already there it says so and exits with 0, and anything else at public/storage is an error
smeltery test run the app's tests
smeltery build build public/assets/css/app.css from resources/css/app.css with tailwindcss --minify when Tailwind is installed (found as for serve; otherwise it prints a warning and builds on, and a failing Tailwind fails the build), then the release binary; in a React or Vue app instead of Tailwind: npm ci (or npm install without a package-lock.json) when node_modules/ is missing, then npm run build into public/build/ (SMELTERY_NPM overrides npm; without npm, or when a step fails, the build fails before cargo runs)
smeltery tailwind:install download the pinned Tailwind CSS standalone binary into the per-user folder (see Pages and CSS); a binary already there with the right checksum is kept
smeltery make:model <Name> [field:type ...] create a model in app/models/; fields are name:type with the types string, text, integer, bigint, bool, float, date, datetime, json, uuid, <name>_id:foreign, file (an upload: the forms post multipart/form-data with a file input, the controller stores the file in storage/app/public/<table>/ and the column holds its path under storage/app/public; its form rule mimes accepts jpg, jpeg, png, gif and webp when a part of the field's name says image (image, img, photo, picture, pic, avatar, logo, thumbnail, thumb, icon, cover, banner, poster: image, cover_image), else those and pdf, txt, csv, docx, xlsx; add types to the rule in the controller as needed, never html, svg, xml or js, which a browser runs as a page of the app), and a trailing ? for nullable (body:text?). Flags: -m migration, -c controller, -r resource controller with views (in a React or Vue app: pages, see The React and Vue starter kits) and routes, -f factory, -s seeder, --all (-mrfs), --searchable (in an app with the search building block: impl Searchable, the search index migration, the registration in app/providers/search.rs, and with -r a list page that searches, see Create an app)
smeltery make:controller <Name> create a controller with an index view and a GET route; --resource [--model Post] creates the seven resource actions (validated with Valid<…Form>, flash messages), their views (forms with @csrf, @error and old()) and the r.resource(...) route entries: in an app with authentication index and show are public and create, store, edit, update and destroy need a signed-in user (.middleware("auth")); without authentication all seven are public, as the comment above them, the controller's module doc and the generator's note say; in a React or Vue app the controller returns Alloy pages and the generator writes them under resources/js/pages/. In an app without routes/web.rs (headless) it refuses and writes nothing, and make:model -c/-r makes the other parts and skips the controller
smeltery make:migration <name> create a migration: create_posts_table creates a table (down drops it), add_slug_to_posts_table adds a nullable slug column (down drops it with ALTER TABLE … DROP COLUMN), any other name gives empty up / down
smeltery make:seeder <Name> create a seeder in database/seeders/ and register it
smeltery make:factory <Name> [--model Post] create a factory in database/factories/ filling every field of the model with fake values
smeltery make:command <Name> create a console command in app/commands/ and register it (SendReport runs as smeltery send-report)
smeltery make:mail <Name> create a mail class in app/mail/ and its HTML template resources/views/mail/<name>.mold.html, and print how to send it
smeltery make:middleware <Name> create a middleware function in app/middleware/ and print how to register it
smeltery bellows:install [--mcp] [--skills] [--guidelines] [--all] add Bellows files to the app (.mcp.json, .bellows/skills/, .bellows/guidelines.md); existing files are kept
smeltery pubsub:install add the migration of the pubsub_messages table (the database driver of PubSub) to database/migrations/ and register it; refuses when the app has it already
smeltery prospect:install add Search to a web app: app/providers/search.rs (where make:model --searchable registers models) and its mod line; it prints the bootstrap/app.rs lines to add (use smeltery::prospect::ProspectExt as _; and .prospect(app::providers::search::register)) and PROSPECT_DRIVER=database; it refuses when bootstrap/app.rs already calls .prospect( and in a headless app
smeltery hallmark:install add API tokens to an app with authentication: the personal_access_tokens migration, app/controllers/api/{tokens,user}.rs, the three token routes in routes/api.rs, tests/api_tokens.rs and, with Watchfire, the daily hallmark-prune schedule, as smeltery new writes them with the hallmark block; it prints the two bootstrap/app.rs lines to add (use smeltery::hallmark::{Hallmark, HallmarkExt as _}; and .hallmark(Hallmark::new())) and the optional .env lines; it refuses in an app without authentication and when the migration or a file exists
smeltery bellows:mcp run the app's MCP server on stdin / stdout (for coding agents; see Bellows)
smeltery make:spark <Name> create a Spark in app/sparks/ with its view resources/views/sparks/<name>.mold.html and register it in app/sparks/mod.rs; refuses in React and Vue apps. --listen <channel> --event <Event> (an app with Anvil) makes it a listener: a #[spark(stream)] component whose method #[on("anvil:<channel>", "App\\Events\\<Event>")] counts the events (--event order.shipped takes a name as sent), a field per {field} of the channel (i64 for id / *_id, else String) set from the page's props in mount, and an event struct to fill; it refuses without .anvil( in bootstrap/app.rs and for a channel name Anvil does not accept
smeltery make:page <Name> in a React or Vue app: create a page (resources/js/pages/about.tsx, Vue: About.vue), its controller app/controllers/about.rs and the route GET /about; refuses in Mold and headless apps
smeltery make:agent <Name> create a Watchfire agent in app/agents/ (restart on failure with backoff, heartbeat timeout, a 30-second tick loop) and register it with w.agent(...); in an app without Watchfire (no app/agents/mod.rs) it refuses and writes nothing
smeltery make:job <Name> create a queued job in app/jobs/ and register it with w.job::<...>() in app/agents/mod.rs; in an app without Watchfire it refuses and writes nothing

The make:* commands create new files only: they refuse when a target file exists, and they add pub mod and registration lines above the // smeltery:… marker comments, laid out as cargo fmt lays them out. When a marker is missing they print the line to add by hand. The Rust files they create go through rustfmt --edition 2024 (RUSTFMT picks another binary; the app's rustfmt.toml applies); without rustfmt the files stay as written and a note says to run cargo fmt.

smeltery new on a terminal shows a SMELTERY banner in block letters, one section per question, a ✓ line per created folder, a spinner while migrate and db:seed build and run the app, and a summary box with the choices, the one-line command and the next steps. Errors and warnings carry coloured ERROR / WARN labels. Output is plain text, without colours, banner or spinner, when stdout is not a terminal, when NO_COLOR is set, or with --no-color (accepted by every command).

Commands that need the app's code (route:list, migrate…, db:seed, work, agents:…, schedule:…, the app's own commands, serve of the app binary itself) run inside the app: the smeltery command forwards them to cargo run -- <command>, and the release binary accepts the same commands. The release binary also has key:generate (with --show and --force) and storage:link, the same code as the smeltery commands, so a server needs no smeltery CLI: ./my-app key:generate, ./my-app storage:link, ./my-app migrate --force.

↑↓ moveEnter openEsc close