# Build Instructions for moeru-ai/airi: Complete Monorepo Compilation Guide

> Follow these moeru-ai/airi build instructions to compile the monorepo. Use pnpm i and pnpm build for full compilation or target specific components with custom scripts.

- Repository: [Moeru AI/airi](https://github.com/moeru-ai/airi)
- Tags: how-to-guide
- Published: 2026-03-08

---

**Run `pnpm i` followed by `pnpm build` to compile the entire moeru-ai/airi monorepo, or use targeted scripts like `pnpm build:web` for specific components.**

Project AIRI is a comprehensive AI companion platform structured as a monorepo containing Vue-based web interfaces, Electron desktop applications, and Rust native modules. Understanding the build instructions for moeru-ai/airi is essential for developers contributing to the UI, desktop client, or underlying Rust crates. The project uses **pnpm workspaces** with **TurboRepo** caching to orchestrate builds across JavaScript, TypeScript, and Rust codebases.

## Prerequisites for Building moeru-ai/airi

Before compiling the project, ensure your environment meets the following requirements:

- **Node.js** ≥ 23 (specified in the repository's engine requirements)
- **pnpm** (installed via corepack)
- **Git** for cloning the repository
- **Native build tools** for the desktop client (platform-specific requirements are detailed in [[`.github/CONTRIBUTING.md`](https://github.com/moeru-ai/airi/blob/main/.github/CONTRIBUTING.md)](https://github.com/moeru-ai/airi/blob/main/.github/CONTRIBUTING.md))

Enable pnpm globally using corepack:

```bash
corepack enable
corepack prepare pnpm@latest --activate

```

## Repository Bootstrap and Installation

Clone the repository and install dependencies. The installation process automatically triggers a postinstall hook that compiles shared packages required by other workspaces.

```bash
git clone https://github.com/moeru-ai/airi.git
cd airi
pnpm i

```

The `postinstall` script defined in [[`package.json`](https://github.com/moeru-ai/airi/blob/main/package.json)](https://github.com/moeru-ai/airi/blob/main/package.json#L15) executes `pnpm run build:packages`, ensuring that internal dependencies are ready before you run targeted builds.

## Build Instructions for moeru-ai/airi Components

The repository provides granular build scripts for different targets. All build outputs are written to `dist/**` directories as configured in [[`turbo.json`](https://github.com/moeru-ai/airi/blob/main/turbo.json)](https://github.com/moeru-ai/airi/blob/main/turbo.json#L4-L10).

### Full Monorepo Build

To compile all JavaScript, TypeScript, and Rust components simultaneously:

```bash
pnpm build

```

This invokes **TurboRepo** (`turbo run build`), which parallelizes builds across workspaces while respecting dependency graphs. The command is defined in [[`package.json`](https://github.com/moeru-ai/airi/blob/main/package.json)](https://github.com/moeru-ai/airi/blob/main/package.json#L26).

### Web UI Build

For rapid iteration on the Vue-based web interface without compiling the desktop or mobile apps:

```bash
pnpm build:web

```

This targets `@proj-airi/stage-web` using the Vite configuration defined in [[`apps/stage-web/vite.config.ts`](https://github.com/moeru-ai/airi/blob/main/apps/stage-web/vite.config.ts)](https://github.com/moeru-ai/airi/blob/main/apps/stage-web/vite.config.ts).

### Desktop Client (Tamagotchi) Build

To build the Electron desktop application:

```bash
pnpm build:tamagotchi

```

This executes the `app:build` script defined in the [[`apps/stage-tamagotchi/package.json`](https://github.com/moeru-ai/airi/blob/main/apps/stage-tamagotchi/package.json)](https://github.com/moeru-ai/airi/blob/main/apps/stage-tamagotchi/package.json), using the Vite/Electron configuration in [[`apps/stage-tamagotchi/vite.config.ts`](https://github.com/moeru-ai/airi/blob/main/apps/stage-tamagotchi/vite.config.ts)](https://github.com/moeru-ai/airi/blob/main/apps/stage-tamagotchi/vite.config.ts).

### Rust Crates Build

To compile only the native Rust components (e.g., Tauri plugins):

```bash
pnpm build:crates

```

This runs `cargo build --workspace` across all packages in the [`crates/`](https://github.com/moeru-ai/airi/tree/main/crates) directory, such as `crates/tauri-plugin-window-router-link`.

### Documentation Site Build

To generate the static documentation site:

```bash
pnpm -F @proj-airi/docs run build

```

This uses VitePress configuration defined in [[`docs/package.json`](https://github.com/moeru-ai/airi/blob/main/docs/package.json)](https://github.com/moeru-ai/airi/blob/main/docs/package.json) and outputs to `docs/.vitepress/dist/`.

## Key Configuration Files

Understanding these files helps debug build issues or customize the pipeline:

- **[`package.json`](https://github.com/moeru-ai/airi/blob/main/package.json)** (root): Defines workspace globs, the `postinstall` hook that builds shared packages, and top-level scripts like `build` and `build:web`.
- **[`turbo.json`](https://github.com/moeru-ai/airi/blob/main/turbo.json)**: Configures TurboRepo pipeline tasks, specifying that `build` tasks output to `dist/**` and defining dependencies between the Electron app and Eventa packages.
- **[`apps/stage-web/vite.config.ts`](https://github.com/moeru-ai/airi/blob/main/apps/stage-web/vite.config.ts)**: Vite configuration for the web UI, handling Vue, UnoCSS, and PWA settings.
- **[`apps/stage-tamagotchi/vite.config.ts`](https://github.com/moeru-ai/airi/blob/main/apps/stage-tamagotchi/vite.config.ts)**: Vite and Electron Builder configuration for the desktop client, defining entry points and native module handling.

## Summary

- **Install Node.js 23+** and enable pnpm via `corepack enable && corepack prepare pnpm@latest --activate`.
- **Clone and bootstrap** with `git clone https://github.com/moeru-ai/airi.git` followed by `pnpm i`, which automatically compiles shared packages via the `postinstall` hook.
- **Build everything** using `pnpm build` (TurboRepo caches outputs in `dist/**`), or use targeted scripts like `pnpm build:web`, `pnpm build:tamagotchi`, or `pnpm build:crates` for specific components.
- **Clear TurboRepo cache** with `pnpm turbo clean` if you encounter stale build artifacts.

## Frequently Asked Questions

### What Node.js version is required to build moeru-ai/airi?

Node.js 23 or higher is required according to the engine specifications in the root [`package.json`](https://github.com/moeru-ai/airi/blob/main/package.json) and the [CONTRIBUTING guide](https://github.com/moeru-ai/airi/blob/main/.github/CONTRIBUTING.md). The project uses modern Node features and pnpm workspaces that depend on this version.

### How do I build only the web interface without compiling the desktop application?

Run `pnpm build:web` to target only the `@proj-airi/stage-web` workspace. This command uses Vite to compile the Vue-based UI and outputs artifacts to `apps/stage-web/dist/`, skipping the Electron and Rust components entirely.

### Why does the initial `pnpm i` take longer than typical npm installs?

The root [`package.json`](https://github.com/moeru-ai/airi/blob/main/package.json) defines a `postinstall` script that automatically executes `pnpm run build:packages` immediately after dependency installation. This compiles shared internal packages required by other workspaces, ensuring the monorepo is ready for development without manual bootstrap steps.

### Can I compile the Rust crates independently from the JavaScript packages?

Yes, use `pnpm build:crates` which executes `cargo build --workspace` across all packages in the `crates/` directory. This builds native libraries such as `tauri-plugin-window-router-link` without triggering the Vite or Electron builds, useful when working exclusively on Rust functionality.