> For the complete documentation index, see [llms.txt](https://docs.kouch.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.kouch.dev/docs/adr/0001-rust-tauri-stack.md).

# ADR 0001: Rust core + Tauri 2 web UI

## Status

Accepted (2026-09-17, locked in with the owner — see `docs/ARCHITECTURE.md` "Decisions locked in with the user").

## Context

Kouch needs to own low-level, latency-sensitive work — Steam Input polling, virtual gamepad output, four concurrent DSU/Cemuhook UDP servers, raw HID (later phases), and process launching/window discovery on both Windows and Linux/Deck — while also presenting a 10-foot, controller-first UI that has to look and animate well on both a handheld touchscreen and a 4K TV. A single native GUI toolkit would make the UI slower to iterate on and harder to theme; a pure web app would make the low-level system access awkward or impossible without a native host process.

## Decision

Rust owns everything performance- and system-access-sensitive: Steam Input, virtual pads, DSU, HID, and process launch, organized as a Cargo workspace of focused crates (`kouch-core`, `kouch-steam`, `kouch-input`, `kouch-dsu`, `kouch-vpad`, `kouch-profiles`, `kouch-launch`, `kouch-library`). The UI is HTML/CSS/JS (Svelte 5, TypeScript, Vite) running inside a Tauri 2 webview, talking to the Rust side over Tauri's typed command/event IPC. All `ISteamInput` calls are confined to one input thread in `crates/kouch-input`; no `unsafe` code exists outside `crates/kouch-steam`, which is the sole safe wrapper around the raw Steamworks bindings.

## Consequences

* The UI can be styled and iterated on with ordinary web tooling (`design-lint`, `brand-lint`, Vitest, WebdriverIO) independent of the Rust release cycle, while still getting native performance where it matters (input polling at 500 Hz, DSU packet sends).
* Every UI feature that needs system access requires a Tauri command/event round-trip; the IPC contract (`app/ui/src/ipc/`) becomes a first-class, versioned interface that both sides must keep in sync.
* Two build toolchains (Cargo + npm) must both be healthy for a full build; CI runs both on every push, on Windows and Linux, per `.github/workflows/ci.yml`.
* Windows and Linux/Deck are both first-class targets from day one, which is why `kouch-launch` needs an `HostExec` abstraction for Steam Linux Runtime / Flatpak escape rather than assuming direct process spawning works everywhere.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.kouch.dev/docs/adr/0001-rust-tauri-stack.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
