# What Programming Language Is moeru-ai/airi Written In? A Polyglot Architecture Explained

> Discover the programming languages behind moeru-ai/airi. Explore its polyglot architecture combining TypeScript for frontend and Rust for native components. Understand the tech stack driving this project.

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

---

**moeru-ai/airi is written primarily in TypeScript for its frontend applications and service logic, with Rust powering the native desktop components and performance-critical audio processing modules.**

moeru-ai/airi is an open-source AI companion framework structured as a polyglot monorepo that leverages both high-level web technologies and systems programming. Understanding what programming language moeru-ai/airi is written in reveals a deliberate dual-language architecture designed to balance rapid application development with native performance for resource-intensive tasks.

## TypeScript: The Core Application Layer

The majority of the business logic and user-facing code in moeru-ai/airi is implemented in **TypeScript**, utilizing modern frontend tooling and Node.js runtime environments.

### Web Applications and UI Components

The repository contains multiple web-facing applications—including `stage-web`, `stage-tamagotchi`, and `stage-pocket`—built with **Vue 3**, **Vite**, **Pinia**, and **UnoCSS**. These applications use TypeScript throughout their component logic and utility modules.

For example, in [`apps/stage-web/src/utils/platform.ts`](https://github.com/moeru-ai/airi/blob/main/apps/stage-web/src/utils/platform.ts), platform detection logic is implemented in TypeScript to handle runtime environment differences. The Vue single-file components explicitly declare TypeScript usage via `<script lang="ts">` blocks, as seen in the [`HelloWorld.vue`](https://github.com/moeru-ai/airi/blob/main/HelloWorld.vue) component:

```typescript
// apps/stage-web/src/components/HelloWorld.vue
<script lang="ts">
import { defineComponent } from 'vue'

export default defineComponent({
  name: 'HelloWorld',
  props: {
    msg: { type: String, required: true }
  },
  setup(props) {
    return { msg: props.msg }
  }
})
</script>

<template>
  <div class="p-4 bg-white rounded shadow">
    <h1 class="text-xl font-bold">{{ msg }}</h1>
  </div>
</template>

```

### Services and Bot Implementations

Node.js-style services handle external integrations and business logic. The `twitter-services`, `satori-bot`, and `discord-bot` modules are written entirely in TypeScript, leveraging HTTP clients and IPC contracts to communicate with other system components. The entry point in [`services/twitter-services/src/main.ts`](https://github.com/moeru-ai/airi/blob/main/services/twitter-services/src/main.ts) demonstrates this service architecture.

### Build Tooling and Shared Packages

The monorepo includes custom build tools such as `vite-plugin-warpdrive` found in [`packages/vite-plugin-warpdrive/src/index.ts`](https://github.com/moeru-ai/airi/blob/main/packages/vite-plugin-warpdrive/src/index.ts), and UnoCSS presets in [`packages/unocss-preset-fonts/src/index.ts`](https://github.com/moeru-ai/airi/blob/main/packages/unocss-preset-fonts/src/index.ts), all authored in TypeScript to ensure type safety across the development workflow.

## Rust: Native Performance and Desktop Integration

For performance-critical operations and native desktop functionality, moeru-ai/airi utilizes **Rust** within a **Tauri**-based architecture.

### Tauri Plugins and Desktop APIs

The desktop integration layer consists of several Rust crates providing native window handling, IPC bridges, and system-level APIs. The `tauri-plugin-window-router-link` crate in [`crates/tauri-plugin-window-router-link/src/lib.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-window-router-link/src/lib.rs) exposes router functionality to the webview:

```rust
// crates/tauri-plugin-window-router-link/src/lib.rs
use tauri::{plugin::{Builder, TauriPlugin}, Runtime};

#[tauri::command]
fn open_route(route: String) -> Result<(), String> {
    // Forward the route to the webview via JavaScript
    tauri::api::js::eval(&format!("window.router.push({:?})", route))
        .map_err(|e| e.to_string())
}

pub fn init<R: Runtime>() -> TauriPlugin<R> {
    Builder::new("window_router_link")
        .invoke_handler(tauri::generate_handler![open_route])
        .build()
}

```

### Audio Processing Kernels

Rust handles computationally intensive audio tasks including **Voice Activity Detection (VAD)** and **Whisper-based speech transcription**. These modules in [`crates/tauri-plugin-ipc-audio-vad-ort/src/lib.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-ipc-audio-vad-ort/src/lib.rs) and [`crates/tauri-plugin-ipc-audio-transcription-ort/src/models/whisper/whisper.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-ipc-audio-transcription-ort/src/models/whisper/whisper.rs) leverage **ONNX Runtime** for efficient machine learning inference, operating at the system level to process audio streams with minimal latency.

## Language Interoperability Architecture

The two languages communicate through **Tauri's IPC layer**, where Rust commands are invoked from TypeScript code using Tauri's invoke API. Shared TypeScript contract definitions ensure type safety across the language boundary, allowing the TypeScript frontend to call Rust functions like `open_route` seamlessly.

## Key Source Files and Their Languages

Understanding what programming language moeru-ai/airi is written in requires examining specific files across the repository:

- **TypeScript**: [`apps/stage-web/vite.config.ts`](https://github.com/moeru-ai/airi/blob/main/apps/stage-web/vite.config.ts) (Vite configuration), [`services/satori-bot/src/index.ts`](https://github.com/moeru-ai/airi/blob/main/services/satori-bot/src/index.ts) (chatbot service entry), [`packages/audio/src/encoding/wav.ts`](https://github.com/moeru-ai/airi/blob/main/packages/audio/src/encoding/wav.ts) (audio encoding utilities)
- **Rust**: [`crates/tauri-plugin-ipc-audio-vad-ort/src/lib.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-ipc-audio-vad-ort/src/lib.rs) (voice activity detection), [`crates/tauri-plugin-mcp/src/lib.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-mcp/src/lib.rs) (multi-channel plugin)

## Summary

- **moeru-ai/airi** is a polyglot codebase using **TypeScript** for application logic and **Rust** for native performance.
- TypeScript powers the Vue 3 frontend applications, Node.js services, and build tooling within the monorepo.
- Rust implements Tauri plugins for desktop integration and handles performance-critical audio processing via ONNX Runtime.
- The architecture uses Tauri's IPC bridge to enable seamless communication between TypeScript frontend code and Rust native modules.

## Frequently Asked Questions

### Is moeru-ai/airi written entirely in TypeScript?

No. While the majority of application code—including UI components, services, and build tools—is written in TypeScript, the project relies on Rust for native desktop functionality and audio processing. The repository is explicitly structured as a polyglot monorepo to leverage the strengths of both languages.

### Why does moeru-ai/airi use Rust instead of TypeScript for audio processing?

Rust provides memory safety and performance characteristics necessary for real-time audio processing tasks like Voice Activity Detection and Whisper transcription. According to the moeru-ai/airi source code, these modules in [`crates/tauri-plugin-ipc-audio-transcription-ort/src/models/whisper/whisper.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-ipc-audio-transcription-ort/src/models/whisper/whisper.rs) require low-latency DSP and ONNX model inference that would be difficult to achieve with JavaScript/TypeScript alone.

### How do TypeScript and Rust communicate in the airi codebase?

The languages interoperate through **Tauri's IPC layer**. Rust functions exposed as Tauri commands—such as `open_route` in [`crates/tauri-plugin-window-router-link/src/lib.rs`](https://github.com/moeru-ai/airi/blob/main/crates/tauri-plugin-window-router-link/src/lib.rs)—can be invoked from TypeScript using Tauri's invoke API. Shared TypeScript type definitions ensure contract consistency across the language boundary.

### Can I contribute to moeru-ai/airi if I only know TypeScript?

Yes. The majority of the codebase, including all frontend applications, bot services, and most packages, is written in TypeScript. While Rust knowledge is required for modifying native audio plugins or Tauri extensions, contributors can effectively work on UI features, service logic, and tooling using TypeScript alone.