Alloy
The React and Vue starter kits
smeltery new my-app --frontend react (or vue) writes the Rust side of a Mold app with Alloy instead of Mold pages
and Sparks:
bootstrap/app.rsinstalls.alloy(…)with the root templateresources/views/app.mold.html, the entryresources/js/app.tsx(Vue:resources/js/app.ts),.encrypt_history()(with authentication) and the shared props ofapp/providers/alloy.rs(app, andauth.userthroughSharedUser). Apps with the Watchfire building block also call.sparks(|_| {}), for the Watchfire dashboard's live panels.resources/js/: the entry,pages/(React:welcome.tsx,dashboard.tsx,auth/login.tsx, …; Vue:Welcome.vue,Dashboard.vue,auth/Login.vue, …),layouts/(the app layout with the navigation and the flash messages, the auth layout),components/andtypes/global.d.ts(the shared props' and the flash's TypeScript types). The forms useuseFormand showform.errors; the welcome page loads an optional prop withrouter.reload({ only: ['forge'] }), and the dashboard shows a deferred prop with<Deferred>.package.json(exact versions: Vite 8.3.2,@inertiajs/reactor@inertiajs/vue33.8.0, React 19.3.0 or Vue 3.5.43, TypeScript 6.0.3) with the scriptsdev,buildandtypes(tsc --noEmit, Vue:vue-tsc --noEmit),tsconfig.jsonandvite.config.ts.tests/http.rstests every page with the helpers above.
The generators write pages in these apps (the kit is frontend in the app's Cargo.toml, under
[package.metadata.smeltery]):
| Command | Writes |
|---|---|
smeltery make:model Post title:string body:text? published:bool --all (or -r) |
app/controllers/posts.rs returning the pages, resources/js/pages/posts/index.tsx, create.tsx, show.tsx, edit.tsx (Vue: posts/Index.vue, Create.vue, Show.vue, Edit.vue) and resources/js/types/post.ts, besides the model, migration, factory, seeder and routes |
smeltery make:controller Reports [--resource] |
a controller returning reports/index (Vue: reports/Index) and its page, or the resource pages of an existing model |
smeltery make:page About |
app/controllers/about.rs, resources/js/pages/about.tsx (Vue: About.vue) and the route GET /about named about |
The forms use useForm, send number fields as numbers, post multipart/form-data when the model has a file field,
and show the messages of a failed validation under each field. make:spark refuses in these apps; make:page refuses
in Mold apps. The apps' CLAUDE.md, AGENTS.md and Bellows guides describe Alloy pages, and the Bellows skill
alloy-page replaces spark.
Inertia's prefetch links work with Alloy: a prefetch is an ordinary GET with Purpose: prefetch. The client
keeps a prefetched page for 30 seconds by default, so after a form changes a record, a page prefetched before can
show the old data until the cache expires. A prefetch request takes the
session's flash like any request: when it runs between the request that flashes and the page that shows the flash,
the flash goes into the prefetched response. The kits' pages do not prefetch.