tofu-web

tofu-web #

Classification: Restricted (describes source code structure, infrastructure and auth flows).

tofu-web (apps/tofu-web, served at console.gotofu.com) is the second customer-facing frontend next to apps/webapp. It ships the new UI and is where every new surface lands from now on; the old webapp keeps serving what it serves today and hands routes over one at a time.

  • Code: apps/tofu-web/
  • Stack: TanStack Start (React 19) + Vite + Nitro (bun preset), shared @bonsai/ui and @bonsai/ai, Tailwind v4.
  • Hosts: dev dev-console.internal.gotofu.com, prod console.gotofu.com.
  • Doppler: shares the bonsai project (like webapp and sales-portal); synced to the bonsai-secret k8s secret at runtime.

Documentation sections #

  • Architecture — the layers and the dependency rule, where state lives, commands as AI tools, the chat runtime, the strictness stack, and the scaffold this app was built from.
  • Shared Context — the unfinished half of “everything is an AI tool”: commands are shared between the app, the palette and the assistant, and context is not. What exists, the six gaps, where a fact should live (URL, store or form), and the two guards found dead while measuring it.
  • Workbench: chat and canvas — the chat column and the canvas beside it: the closed registry of canvas views, why each view is a route, where selection and focus live, what the assistant is allowed to put on screen, and what the hackathon branch’s review and pricing panels do and do not give us.
  • Platform Decisions — the security model, where preferences live, how boundaries are enforced, how the tool surface is bounded, how the app reaches Claude on AWS, and the dependency policy. Section 8 is the alternatives considered, with the evidence for each; section 9 lists what it supersedes in the architecture plan, and section 13 records what was actually built against each decision, including the one that was reversed.

Rules that live next to the code #

Two files sit in the app directory rather than here, because they must stay in step with the lint config they describe:

  • apps/tofu-web/AGENTS.md — the operational rules for humans and agents: the import matrix, how to add a feature, a command, a query or a mutation, and what never to do.
  • apps/tofu-web/REVIEW.md — the review ruleset, loaded by PR-Agent through repo_context_files in .pr_agent.toml.

Local development #

mise run dev                 # the whole stack, this app included
mise run webapp-dev          # frontends only: webapp, storybook, this app, sales-portal
mise run tofu-web-dev        # just this app: Doppler bonsai/dev_local + vite dev on :3050

See apps/tofu-web/README.md for the full task list, the .env.local precedence rules and the deployment path.

  • Webapp — the app tofu-web takes routes over from.
  • Sales Portal — the other TanStack Start app in the monorepo.
  • Feature flags — the codegen tofu-web consumes.