G · 02 guides

Guides / Installation

Installation

Prerequisites

aihu requires one of the following runtimes:

  • Bun ≥1.3.0 (recommended — faster installs, native TypeScript, built-in test runner)
  • Node.js ≥20.18.0 with a package manager of your choice (npm, pnpm, or yarn)

Scaffold a new application

Use the @aihu/cli to generate a new project:

governedbashbash82 B
# Bun (recommended)
bunx @aihu/cli app my-app

# npm
npm create aihu@latest my-app

Note. The ≤5 minute quick start is conditional until pre-built aihu-compile binaries ship. Today the scaffolder builds the Rust SFC compiler from source on first run, which adds a one-time toolchain step. Once the GitHub Actions release workflow publishes platform binaries, the install becomes a single download and this note will be removed.

The scaffolder generates the following files:

governedaihuaihu200 B
my-app/
  package.json
  vite.config.ts
  tsconfig.json
  index.html
  src/
    main.ts
    pages/
      index.aihu
  .vscode/
    extensions.json
    settings.json
  AGENTS.md
  CLAUDE.md
  .mcp.json
  • package.json — workspace manifest with @aihu/app, @aihu/runtime, @aihu/signals, @aihu/arbor, and @aihu/router as dependencies, plus @aihu-plugin/agent-readiness, @aihu/cli, @aihu/compiler, @aihu/tsc, TypeScript, and Vite as devDependencies.
  • vite.config.ts — the whole aihu configuration surface: a single viteAihuPlugin({...}) from @aihu/app that composes the Rust compiler and the router, and takes the agent-readiness surface inline via its agentReadiness option. Config lives here rather than in a separate aihu.config.ts so the aihu CLI and the language server read one file and cannot drift. (A standalone aihu.config.ts still works as a legacy fallback, but the scaffold no longer emits one.)
  • tsconfig.json — TypeScript configuration; bun run typecheck runs aihu-tsc against it.
  • index.html — the HTML entry document; loads src/main.ts as a module.
  • src/main.ts — the client bootstrap: createApp() from @aihu/app/client.
  • src/pages/index.aihu — the Hello World SFC with @route, @state, @template, and @style blocks.
  • .vscode/ — recommended extensions and editor settings for working with .aihu files.
  • AGENTS.md, CLAUDE.md, .mcp.json — coding-agent tooling files; pass --no-agent-tooling to the scaffolder to omit them.

Install and run

governedbashbash33 B
cd my-app
bun install
bun run dev

The dev server starts at http://localhost:5173 with HMR enabled. Edit src/pages/index.aihu and the browser updates automatically — no full reload needed.

Build for production

governedbashbash29 B
bun run build
bun run preview

bun run build compiles all .aihu files through the Rust SFC compiler, bundles with Vite/Rolldown, and validates against the size budgets defined in .size-limit.json.

bun run preview serves the production build locally so you can verify the output before deploying.