Robodev lean frontend: what's inside

What each part runs on, how you use it, and where the speed comes from. Code is from the local branch; numbers are from bench/lean-fe on an M4 Mac, measured on the real Povio Diagrams app ported over.

It is React. Not HTML, not HTMX. React 19 with React DOM and react-router on the web; React Native with Expo Router on iOS and Android. Pages are normal React components with hooks and state.

The app itself renders as fast as any React app. What got faster is everything around React: how the bundle is built, how the dev server starts and reloads, and how few steps sit between a page file and the browser.

The stack

Each part and what runs it

PartWhat runs itInstead of (Povio Diagrams today)
UIReact 19, React DOMsame
Routingreact-router 6.30, routes made from src/pages at build timeTanStack Router + generated route tree
BundlerBun.build (native, written in Zig), called in-processVite 8 + Rolldown + plugins
CSSTailwind v4 through @tailwindcss/node + oxide (Rust scanner)@tailwindcss/vite
Hot reloadBun's reactFastRefresh transform + our chunk differVite HMR
API clientHooks generated from robodev/api/**, types from the Robodev SDKOpenAPI spec → codegen client
Data cache~350 lines on useSyncExternalStoreTanStack Query
AuthBuilt in: export const auth = "required"hand-written guards + glue
MobileReact Native + Expo Router + Metro, driven by robodev mobilea separate app
E2Epyro, run by robodev testPlaywright setup
Layer 1 · Pages

A file is a route

No router config. Each file under src/pages is a page; its default export is the component. Optional named exports set auth and the tab title.

src/pages/
  _layout.tsx      → wraps every page
  index.tsx        → /
  todos/index.tsx  → /todos
  todos/[id].tsx   → /todos/:id
  (info)/about.tsx → /about  (group, no URL part)
  board/[id].native.tsx → phone-only version
src/pages/todos/[id].tsx
import { type PageProps } from "@robodev-ai/app";
import { useGetTodosById } from "../../api.gen";

export const auth = "required"; // login redirect
export const title = "Todo";

export default function TodoDetail(
  { params }: PageProps<{ id: string }>
) {
  const todo = useGetTodosById(params);
  ...
}

At build time Robodev writes the entry file you'd normally write yourself. Each page becomes a lazy import(), so each page is its own chunk:

generated entry (packages/app/src/build.ts → generateAppEntry)
// Generated by Robodev from src/pages. Do not edit; add pages instead.
import { createApp } from "@robodev-ai/app";
import app from "/…/src/app.ts";
import "/…/src/app.css";

createApp({
  app,
  pages: {
    "_layout.tsx":     () => import("/…/src/pages/_layout.tsx"),
    "index.tsx":       () => import("/…/src/pages/index.tsx"),
    "todos/[id].tsx":  () => import("/…/src/pages/todos/[id].tsx"),
  },
});

createApp turns that map into react-router routes with lazy loaders:

packages/app/src/app.tsx
const lazy = async () => {
  const mod = await pages[file]!();
  const page = asPage(mod, file);   // reads default + auth/title/render exports
  return { element: <PageView page={page} file={file} /> };
};
return spec.index ? { index: true, lazy } : { path: spec.path, lazy };
...
const router = createBrowserRouter([...extra, rootRoute]);
Why this is fast

The route table is a plain string generated in a few milliseconds. There's no route-tree codegen pass, no server bundle and no prerender step. The browser loads the entry, then only the layout and the page it is on.

Layer 2 · API hooks

Every backend route is a typed hook

The backend is files in robodev/api. Each exported get/post/patch/del becomes a hook in src/api.gen.ts. No endpoint strings and no types written by hand.

robodev/api/todos.ts (backend)
export const get = defineApi({
  auth: "required",
  query: z.object({
    status: z.enum(["all","open","done"]).optional(),
  }),
  handler: async (ctx) => {
    const rows = await ctx.db.select()
      .from(todos)
      .where(eq(todos.userId, ctx.user!.id));
    return rows.map(toTodo);
  },
});

export const post = defineApi({
  body: z.object({ title: z.string().min(1) }),
  handler: ...
});
src/pages/todos/index.tsx (frontend)
import { useGetTodos, usePostTodos }
  from "../../api.gen";

const todos = useGetTodos({
  query: { status },   // checked against the zod schema
});
const create = usePostTodos();

todos.data   // Todo[], from what the handler returns
todos.loading
await create.mutate({ title }); // refetches /api/todos
src/api.gen.ts (generated)
import type * as api0 from "../robodev/api/todos";

export function useGetTodos(
  options?: ApiHookOptions<typeof api0.get>) {
  return useApi<typeof api0.get>("/api/todos", options);
}
Why this is fast

Generating the hooks is string work, around a millisecond, with no OpenAPI spec and no codegen CLI. At runtime it is a thin wrapper around fetch and useSyncExternalStore, not a query library.

Layer 3 · Build

One native bundler call

robodev dev, robodev deploy and the hosted build all go through buildApp, which makes one Bun.build call inside the CLI process:

packages/cli/src/app-dev.ts → buildApp
await writeApiHooks(root);                       // layer 2
const entrySource = generateAppEntry({ paths, ... });  // layer 1

result = await bun.build({
  entrypoints: [input.entry],
  format: "esm",
  target: "browser",
  splitting: true,                    // a chunk per page
  minify: production,
  sourcemap: production ? "none" : "linked",
  jsx: { runtime: "automatic", importSource: "react" },
  ...(hmr ? { reactFastRefresh: true, metafile: true } : {}),
  define,                              // import.meta.env.*
  plugins: [appPlugin({ tailwind: await loadTailwind(bun, root) })],
});

Tailwind runs inside that same call. The CSS plugin loads the project's own @tailwindcss/node compiler and @tailwindcss/oxide, a Rust scanner that finds class names in the source. The compiled CSS is reused when no class names changed.

Why this is fast
  • Native code. Bun's parser, transpiler, minifier and linker are Zig, multi-threaded, in one pass.
  • No plugin chain. Vite runs transforms through JavaScript plugin hooks; here there are two small plugins.
  • Less work. The Diagrams Vite build also makes a server bundle and a prerender pass for index.html; lean does neither.
  • No process start. The build runs inside the already-running CLI.
Production build, Povio DiagramsColdWarm median
Vite (vite build --mode robodev)2,760 ms2,275 ms
Lean (buildApp, minified, split)267 ms192 ms
Output JS, gzipVite 1.79 MB · lean 1.85 MB (+3%; mostly mermaid in both)

So the output is about the same size. It isn't fast because it ships less; it's fast because it builds faster.

Layer 4 · Dev server and hot reload

Start in under a second, edits keep state

save file→15 ms debounce→Bun.build in memory→diff chunks→SSE to browser→re-import changed→performReactRefresh()
packages/cli/src/app-hmr.ts
/**
 * The dev build runs Bun's reactFastRefresh transform and writes chunks under stable
 * names (/__robodev/src/pages/todos.js, no content hash). After each rebuild
 * planHotUpdate compares the new output with the last good one:
 * - changed chunks, plus every chunk that statically imports one of them, are re-run
 *   as copies under /__robodev/hot/<gen>/
 * - when that set reaches the entry chunk (React, the router, src/app.ts) the page reloads
 * - CSS swaps in place.
 */

Chunks are renamed so a name depends only on what's inside. An edit to one page changes one chunk, not every hashed file name, so the browser re-runs just that chunk and React Fast Refresh swaps the component in place.

DevViteLean
Start → login page ready in the browser1,425 ms (no backend)848 ms (with Postgres + backend)
Requests to load the page18120
Edit → visible, state kept (Diagrams)185 ms221 ms
Edit → visible, state kept (lean starter)–77 ms
Where it is not faster: hot reload. Vite's dev server transforms one file per request and only redoes the file you changed. Lean rebuilds the whole bundle on every save (~185 ms for Diagrams). The upside of the whole-bundle approach is that dev starts fast and loads with 20 requests instead of 181, because the browser gets bundled chunks rather than one request per source module.
Layer 5 · In the browser

Page ready: 38 ms vs 546 ms

/auth, same static serverVite buildLean build
Requests1714
Transferred (gzip)199 KB187 KB
Localhost: form mounted546 ms38 ms
10 Mbps / 40 ms RTT: form mounted774 ms341 ms

Read this one carefully. The original's ~520 ms gap between "loaded" and "ready" is constant across runs and matches TanStack Router's default 500 ms pending time (pendingMinMs). That's our reading of the numbers; we haven't profiled it. It's a router setting, not something Vite causes, so the original could close most of that gap by changing it.

Layer 6 · Mobile

The same pages on iOS and Android

robodev mobile generates an Expo Router app from src/pages. Each screen is a two-line re-export, so the page stays the single source:

mobile/app/todos/[id].tsx (generated)
import { screen } from "@robodev-ai/app/native";
import * as page from "../../../src/pages/todos/[id]";
export default screen(page, "todos/[id].tsx");
what you run
robodev mobile              # iOS simulator
robodev mobile --android    # Android emulator
robodev mobile --tunnel     # QR code for a real phone
robodev mobile --headless --logs   # for agents
Why this is fast

No Xcode project and no Android Studio build: it runs in Expo Go with Metro, so the app is running about 4 s after the command when the simulator is already booted.

In short

Where the time goes

StepUsual setupLeanMain reason
Production build2.3 s0.19 snative bundler in-process, no server bundle or prerender
Dev start → page1.4 s0.85 sbundled chunks: 20 requests, not 181; backend included
Page ready546 ms38 msprobably the router's 500 ms pending default (not profiled)
Hot reload185 ms221 mslean rebuilds the whole bundle
API clientcodegen stepnonetypes read straight from the routes