> For the complete documentation index, see [llms.txt](https://www.openclawbook.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.openclawbook.xyz/en/ch01-understanding-openclaw/1.3-technology-stack-overview.md). Agents can also search and read this documentation through its [MCP server](https://www.openclawbook.xyz/~gitbook/mcp).

# 1.3 Technology Stack Overview

> **Generated by**: Claude Opus 4.6 (initial draft) / Claude Opus 5 (`v2026.3.9` revision) **Token usage**: Input \~130,000 tokens, Output \~12,000 tokens (total for this chapter) **Source baseline**: `v2026.3.9` (`v2026.3.8-170-g665f67726`)

***

OpenClaw is a multi-technology stack project that spans from backend services to native mobile applications. This section will systematically introduce its technology choices and engineering infrastructure.

## 1.3.1 TypeScript + Node.js 22+: Language and Runtime Selection

OpenClaw's core code is written in **TypeScript** and runs on **Node.js 22+** environment.

**Why TypeScript?**

TypeScript is a superset of JavaScript that adds a static type system. For a large project like OpenClaw (69 submodules in the `src/` directory, hundreds of files), the type system provides crucial safety guarantees. OpenClaw uses strict mode (`strict: true`), which means all variables must have explicit types and implicit `any` is not allowed.

From `tsconfig.json`, we can see the key compiler configuration:

```json
{
  "compilerOptions": {
    "strict": true,                    // Strict type checking
    "target": "es2023",                // Compilation target: ES2023
    "module": "NodeNext",              // Module system: Node.js ESM
    "moduleResolution": "NodeNext",    // Module resolution strategy
    "experimentalDecorators": true,    // Enable decorators (needed for UI components)
    "lib": ["DOM", "DOM.Iterable", "ES2023", "ScriptHost"],
    "noEmit": true                     // No output from tsc, built by tsdown
  }
}
```

Several noteworthy choices:

* **`module: "NodeNext"`**: Uses Node.js native ESM module system. The `"type": "module"` in `package.json` confirms this. This means all imports use `.js` extensions (even though source files are `.ts`), which is a requirement of Node.js ESM.
* **`experimentalDecorators: true`**: This is to support Lit Web Components' decorator syntax (such as `@state()`, `@property()`).
* **`noEmit: true`**: The TypeScript compiler is only used for type checking; actual code transformation and bundling is done by `tsdown`.

**Why Node.js 22+?**

OpenClaw's `package.json` explicitly declares the minimum runtime requirement:

```json
{
  "engines": {
    "node": ">=22.12.0"
  }
}
```

Node.js 22 brings several features critical to OpenClaw:

1. **Mature native ESM support**: No longer requires experimental flags
2. **`node:test` improvements**: Better native test support
3. **Performance optimizations**: Overall performance improvements from V8 engine updates
4. **Enhanced WebSocket support**: More stable WebSocket implementation in `undici`

During development, OpenClaw uses `tsx` (TypeScript Execute) to directly run TypeScript files, avoiding the need to recompile every time you make changes:

```bash
# Development mode: run TypeScript directly
pnpm openclaw gateway  # Internally uses tsx

# Production mode: compile then run
pnpm build             # tsdown compiles to dist/
node dist/index.js gateway
```

## 1.3.2 pnpm Monorepo Project Structure

OpenClaw adopts a **pnpm Monorepo** (single repository, multiple packages) structure to organize code. `pnpm-workspace.yaml` defines the package boundaries of the workspace:

```yaml
packages:
  - .              # Root package (openclaw main)
  - ui             # Web console UI
  - packages/*     # Internal shared packages
  - extensions/*   # Channel extensions
```

> **Sidebar**: Monorepo (single repository) is a code organization strategy that manages multiple related projects in a single Git repository. In contrast is Polyrepo (each project in its own repository). Monorepo advantages include: convenient code sharing, unified dependency versions, atomic commits (one commit can modify multiple packages simultaneously). Disadvantages include potentially large repository size and the need for specialized tools to manage it.

This Monorepo contains the following packages:

| Package               | Path                 | Description                                                                |
| --------------------- | -------------------- | -------------------------------------------------------------------------- |
| `openclaw`            | `.`                  | Main package, containing Gateway, Agent, CLI, and other core functionality |
| `openclaw-control-ui` | `ui/`                | Web console UI                                                             |
| `clawdbot`            | `packages/clawdbot/` | Internal shared package                                                    |
| `moltbot`             | `packages/moltbot/`  | Internal shared package (compatibility alias)                              |
| 31 extensions         | `extensions/*/`      | Various channel extension packages                                         |

**Why pnpm?**

pnpm has several key advantages over npm and yarn:

1. **Hard-link storage**: All package dependencies are stored in a global `.pnpm-store` and reused through hard links. For a large project like OpenClaw, this saves significant disk space.
2. **Strict dependency isolation**: pnpm doesn't allow "phantom dependencies" by default—dependencies not declared in `package.json` but indirectly available through other packages. This ensures explicit dependency relationships.
3. **Native Monorepo support**: pnpm has built-in Workspace protocol support without needing additional Monorepo tools (like Lerna or Nx).

OpenClaw uses pnpm's `overrides` feature to unify dependency versions, ensuring security and consistency:

```json
{
  "pnpm": {
    "overrides": {
      "fast-xml-parser": "5.3.4",
      "hono": "4.11.8",
      "@sinclair/typebox": "0.34.48",
      "tar": "7.5.7"
    }
  }
}
```

## 1.3.3 Build Toolchain: tsdown / oxlint / oxfmt / vitest

OpenClaw's toolchain choices reflect the "Rustification" trend in the modern JavaScript ecosystem—using high-performance tools written in Rust to replace traditional JavaScript tools.

### Build: tsdown

**tsdown** is OpenClaw's bundler, based on **Rolldown** (Rust implementation of Rollup). `tsdown.config.ts` defines four build entry points:

```typescript
export default defineConfig([
  { entry: "src/index.ts", platform: "node" },     // Main entry
  { entry: "src/entry.ts", platform: "node" },      // CLI entry
  { entry: "src/plugin-sdk/index.ts",               // Plugin SDK
    outDir: "dist/plugin-sdk", platform: "node" },
  { entry: "src/extensionAPI.ts", platform: "node" }, // Extension API
]);
```

Why two main entry points?

* `src/index.ts`: Library entry, exports public API, can be `import`ed by external code
* `src/entry.ts`: CLI entry, handles process initialization, suppresses experimental warnings, then delegates to Commander.js program

### Lint: oxlint

**oxlint** is a JavaScript/TypeScript Linter written in Rust, orders of magnitude faster than ESLint. OpenClaw uses oxlint with **type-aware** rules enabled:

```bash
pnpm lint      # oxlint --type-aware
pnpm lint:fix  # oxlint --type-aware --fix
```

The configuration file `.oxlintrc.json` defines the specific rule set.

### Format: oxfmt

**oxfmt** (Oxidized Formatter) is a code formatter written in Rust:

```bash
pnpm format      # oxfmt --check
pnpm format:fix  # oxfmt --write
```

### Test: vitest

**vitest** is a test framework based on Vite. OpenClaw has multiple test configuration files corresponding to different test types:

| Configuration File            | Purpose                             |
| ----------------------------- | ----------------------------------- |
| `vitest.config.ts`            | Unit tests (`src/**/*.test.ts`)     |
| `vitest.e2e.config.ts`        | End-to-end tests (`*.e2e.test.ts`)  |
| `vitest.live.config.ts`       | Live tests (requires real API keys) |
| `vitest.gateway.config.ts`    | Gateway integration tests           |
| `vitest.extensions.config.ts` | Extension tests                     |
| `vitest.unit.config.ts`       | Pure unit tests                     |

The unit test configuration is worth noting:

```typescript
// vitest.config.ts key configuration
{
  test: {
    testTimeout: 120_000,        // Timeout 2 minutes (Agent tests may be slow)
    pool: "forks",               // Use process fork isolation
    maxWorkers: isCI ? 3 : localWorkers,  // Limit concurrency in CI
    coverage: {
      thresholds: {
        lines: 70,
        functions: 70,
        branches: 55,
        statements: 70
      }
    }
  }
}
```

Test coverage requires 70% line and function coverage—a reasonable baseline for a project of this scale.

### Complete Quality Assurance Pipeline

```bash
pnpm check     # = pnpm tsgo && pnpm lint && pnpm format
pnpm test      # Run all unit tests
pnpm test:e2e  # Run end-to-end tests
pnpm test:live # Run tests requiring real APIs
pnpm test:all  # Complete suite: lint + build + test + e2e + live + docker
```

## 1.3.4 Native Applications: Swift (macOS/iOS), Kotlin (Android)

OpenClaw is not just a Node.js backend—it also provides native client applications:

### macOS Application (Swift + SwiftUI)

```
apps/macos/Sources/
├── OpenClawApp/           # Main application entry
├── OpenClawProtocol/      # Gateway protocol Swift implementation (generated from TypeBox)
├── Views/                 # SwiftUI views
├── VoiceWake/             # Voice wake
└── ...
```

The macOS application runs in the system menu bar, providing:

* Gateway health monitoring
* Voice Wake + Push-to-Talk
* Talk Mode overlay
* Embedded WebChat
* Remote Gateway control

### iOS Application (Swift)

```
apps/ios/Sources/
├── Views/
├── Canvas/
├── VoiceWake/
└── ...
```

The iOS application runs as a **Node** (device node), discovering and pairing with Gateway via Bonjour/mDNS. It provides Canvas surface, voice triggering, camera, and other capabilities.

### Android Application (Kotlin)

```
apps/android/app/src/main/
├── java/ai/openclaw/android/
├── res/
└── AndroidManifest.xml
```

The Android application also runs as a node, providing Canvas, camera, screen recording, and other device capabilities.

### Cross-platform Shared Code

```
apps/shared/OpenClawKit/Sources/
```

The macOS and iOS applications share a Swift Package (`OpenClawKit`) containing Gateway protocol implementation, WebSocket client, and other common logic.

### Cross-language Protocol Consistency

OpenClaw uses an elegant mechanism to ensure protocol consistency between TypeScript, JSON Schema, and Swift:

```
TypeBox Schema (TypeScript)
    ↓ scripts/protocol-gen.ts
JSON Schema (dist/protocol.schema.json)
    ↓ scripts/protocol-gen-swift.ts
Swift Models (apps/macos/Sources/OpenClawProtocol/GatewayModels.swift)
```

The CI pipeline ensures through `pnpm protocol:check` that any protocol changes are synchronized across all language implementations.

### Web UI (Lit + Vite)

The web console UI uses the **Lit** Web Components framework and **Vite** build tool:

```json
// ui/package.json key dependencies
{
  "dependencies": {
    "lit": "^3.3.2",        // Web Components framework
    "marked": "^17.0.1",    // Markdown rendering
    "dompurify": "^3.3.1",  // HTML sanitization
    "vite": "7.3.1"         // Build tool
  }
}
```

> **Sidebar**: Lit is a lightweight Web Components library developed by Google. Web Components are a set of browser-native APIs including Custom Elements (custom elements), Shadow DOM (style isolation), and HTML Templates. Lit adds declarative template syntax and reactive property systems on top of this, making it simple to create high-performance Web components. Compared to React or Vue, Lit's advantages are zero runtime overhead (directly using browser native capabilities) and extremely small bundle size.

***

In summary, OpenClaw's technology stack can be summarized as:

| Layer              | Technology                                             |
| ------------------ | ------------------------------------------------------ |
| Language           | TypeScript (core), Swift (macOS/iOS), Kotlin (Android) |
| Runtime            | Node.js 22+, native macOS/iOS/Android                  |
| Package Management | pnpm Monorepo                                          |
| Build              | tsdown (Rolldown), Vite (UI)                           |
| Testing            | vitest (unit/E2E/Live/Docker)                          |
| Lint/Format        | oxlint + oxfmt (Rust-powered)                          |
| Web Framework      | Lit (UI), Hono/Express (HTTP)                          |
| WebSocket          | ws library                                             |
| Database           | SQLite (memory storage)                                |
| Containerization   | Docker (sandbox/deployment)                            |
| CI/CD              | GitHub Actions                                         |
