Getting started
You need mise. It loads the tools, and Vite+ (vp) does everything else: install, dev
server, checks, tests, builds, and the app's other tasks.
Create an app
Copy the example into a new directory and install it:
npx degit joeblew999/hotwire-skills/example my-app
cd my-app
mise install # the tools in mise.toml: Node, Vite+, mkcert, and the phone apps' tools
vp install # the npm packages
vp dev
Open https://hotwire.localhost:5173: a name under .localhost is your own machine to a browser, with nothing to set
up. The dev server runs your app on Cloudflare's own runtime, with local KV, D1 and Durable
Objects, so what works here works when deployed. It serves https with a certificate from
mkcert's local CA, which vite.config.ts makes the first time; vp run setup:certs makes your browsers trust that CA (it asks for your password once). Change a file and the page updates
by itself.
Rename the app in package.json ("name"). That name becomes the Worker's name on Cloudflare.
The copy is a whole project. It brings its tests, its CI (.github/workflows/check.yml, which GitHub runs once the
app is a repository of its own), and the rules an AI agent works by in it (AGENTS.md, and .mcp.json for
looking at the app).
The commands
| Command | Does |
|---|---|
vp dev |
Runs the app locally |
vp check |
Checks formatting, lint and types (vp check --fix formats) |
vp test |
Tests the server's answers, in a second (Testing) |
vp build |
Builds for production |
vp preview |
Serves the production build locally, with BETTER_AUTH_SECRET in .env for sign-in (Signing in) |
vp run deploy --platform cloudflare |
Deploys to your Cloudflare account (Deploying) |
mise puts vp on your PATH, the version in mise.toml, and it hands over to the project's own vite-plus.
The app's other commands are tasks in vite.config.ts (run.tasks), and vp run lists them:
| Task | Does |
|---|---|
vp run setup |
Once: the git hook that checks staged files before each commit (vp staged), mkcert's CA trusted, the simulators and the emulators |
vp run workspace |
The dev server, the web app and both phone apps side by side; a change to a page shows in all three by itself (Hotwire Native) |
vp run test:browser |
The Maestro flows (flows/) for Turbo, Stimulus, live updates and signing in, in Chromium: those a change touched (Testing) |
vp run ci |
What CI runs: vp check, vp test, vp build and vp run test:browser |
vp run test:all |
Everything, on a Mac, before a pull request: what CI runs, then the same flows in both phone apps (test:ios, test:android) |
vp run flows:web, flows:ios, flows:android |
The flows your changes touched, against the dev server you keep running, with no build |
vp run record |
A video of each flow in both phone apps, in .dev/videos/ |
The tasks' code is TypeScript in tasks/, and what they make is in .dev/, which git ignores.
What is where
routes/ one file for each address: its path is the address, and it exports GET, POST…
index.tsx / the messages
messages/ /messages the form's POST; new.tsx, the form on its own page
stats.tsx /stats a frame's own page
about.tsx, theme.ts /about, /theme a plain page, and the form that sets its appearance
login.tsx, account/ signing in, the account and its passkeys
guide/ /guide this guide, on the site
*_historical_location.ts where a form's answer sends the phone apps
live.ts the live stream's endpoint
.well-known/ the files that tie the domain to the phone apps, for their passkeys
src/ what the routes share, and the browser's code
components/ HTML that several pages use, as Hono JSX: the layout, the navigation, a message, the account
turbo.tsx what Turbo needs from the server, written once
bundle.tsx the browser bundle's tags, for the layout's <head>
main.ssr.tsx Void's renderer, for an address no route answers: the "not found" page
main.client.ts the browser's bundle: Turbo, Stimulus, the CSS
app.css Tailwind CSS and daisyUI
controllers/ Stimulus controllers, one file each; index.ts registers them, and joemasilotti/bridge-components'
cookies.ts, notice.ts the app's cookies, and the notice a form leaves for the next page
theme.ts the appearance chosen on the About page, from its cookie
live.ts the live stream that broadcasts go through
guide.ts the guide's pages, read on GitHub and made HTML
live-stream-source.ts the element that hands broadcasts to Turbo
messages.ts the example's data: messages, rows in D1
sign-in.ts, passkeys.tsx what the sign-in forms, and the passkeys' routes, share
email.ts the email the app sends (the sign-in code), with Void's email
auth-client.ts Better Auth in the browser, for passkeys
routes.test.tsx the server tests
auth.test.ts auth.ts on the real Better Auth: signing up with a passkey
flows/ the Maestro flows: each written once, for the browser and both phone apps
native/ the iOS and Android apps, and a test keeper of passkeys for the Android emulator
tasks/ the code of the tasks in vite.config.ts (vp run), in TypeScript
mise.toml the tools (Node, Vite+, mkcert, Java, XcodeGen, Maestro, Android's), and nothing else
auth.ts sign-in: Better Auth's email codes and passkeys (Signing in)
env.ts the environment variables the app reads
middleware/ what runs before every request: the D1 bookmark cookie
db/ the tables (schema.ts) and their migrations
public/ static files, served as they are (path configurations, favicon)
vite.config.ts Vite+ and Void: the plugins, the checks, the tests, and the tasks (`vp run`)
void.config.ts Worker settings, and the sender of the app's email
AGENTS.md the rules an AI agent works by in the app: its commands, and what a change must keep in step
.mcp.json Maestro's MCP server, for an agent to look at the running app
.github/workflows/ CI: check.yml runs `vp run ci` on every pull request
The folders are Void's own (its project structure): routes/,
middleware/, db/ and public/ mean what they mean in any Void app, and src/ is yours.
How a request goes through the app
Void looks for a file in
routes/for the path:routes/about.tsxanswers/about, androutes/messages/index.tsxanswers/messages. It calls the handler the file exports for the request's method,GETorPOST.The handler renders a page, answers a form, or answers a frame, always with HTML. Who is signed in comes from
void/auth:getUser(),requireAuth(c), andgetAuth(c)for Better Auth itself.A path with no route gets the file of its name in
public/(public/favicon.svganswers/favicon.svg). One with neither goes tosrc/main.ssr.tsx, Void's own renderer, which answers "not found":export default defineRender((c) => notFound(c));In the browser, Turbo takes over links and forms. It fetches the next page and swaps the body instead of reloading, applies stream answers, and loads frames.
Read Pages next.
Adding Hotwire to an existing Void app
vp add @hotwired/turbo @hotwired/stimulus stimulus-vite-helpers honoandvp add -D tailwindcss @tailwindcss/vite daisyui @types/hotwired__turbo vite-plugin-stimulus-hmr.- In
vite.config.ts, addoxc: { jsx: { runtime: "automatic", importSource: "hono/jsx" } }and thetailwindcss()andstimulusHMR()(fromvite-plugin-stimulus-hmr) plugins. Intsconfig.json, set"jsx": "react-jsx"and"jsxImportSource": "hono/jsx". - Copy
src/main.ssr.tsx,src/main.client.ts,src/bundle.tsx,src/turbo.tsxandsrc/components/from the example, and write your pages inroutes/. Void needs bothmain.ssrandmain.client, or neither: with both it builds the browser's bundle.