Lain AI Desktop: Streaming DeepSeek Chat with Tauri and Rust
A desktop AI client for talking with the Lain Iwakura persona from Serial Experiments Lain. The DeepSeek request is made on the Rust side and the reply streams into the UI chunk by chunk through Tauri events; the API key never enters the webview. Chats are stored locally and code blocks are syntax-highlighted.
Performance & metrics
- No waiting for the full reply; text appears as soon as the first chunk arrives
- Networking runs asynchronously on Tokio, so the UI never freezes while streaming
Why I built it
I had written a mobile version of the same idea in Flutter; on desktop I wanted to do two things differently: keep the API key completely away from the UI, and let long replies flow onto the screen as if they were being typed. Tauri was the right tool: networking and files in Rust, the interface in Svelte.
Architecture & decisions
The Rust call_deepseek command reads the key from an environment variable, adds the persona system prompt and opens a streaming request with reqwest. The incoming byte stream is read with futures_util::StreamExt, split into SSE lines, and each chunk is sent to the frontend as a chat-stream-chunk event, followed by chat-stream-done. The Svelte side listens to these events, updates the message live and renders Markdown with marked and highlight.js. The save_chats and load_chats commands keep conversations as JSON in the app's data folder.
Key features
- Streaming DeepSeek requests in Rust, delivered chunk by chunk to the UI through Tauri events
- The API key stays on the Rust side; no secrets in the webview
- Multiple chats in a sidebar with local JSON persistence
- Markdown replies with syntax highlighting
Technical review
A small but instructive project: the most common mistake in desktop AI clients is keeping the key in the frontend. Here the UI only knows the message list; everything that talks to the outside world sits behind Rust commands. For the mobile version, see the Lain AI (Flutter) project.
Related projects
Desktop Applications
Watch Together Desktop: A Synced Player with Tauri 2 and Svelte 5
The Watch Together client for people watching on a computer. It joins the home's room, opens videos from YouTube, anime and the local library, and manages global rooms and Steam friend invites. If no server is running at home, it starts the bundled Rust server itself. The interface borrows from Stardew's menus: parchment panels, wooden frames, pixel headings.
- Rust
- TypeScript
- Svelte
- +7

Major project
AudioLoom Editor: A Desktop Audio Editor That Trims, Orders and Joins Recordings
A Windows desktop audio editor for interview and meeting recordings, including ones that run for hours: trim the parts, put them in order, balance their levels and save them as a single file. Built with Tauri 2 and Svelte 5; cutting, splitting, pasting, loudness matching and export run on the Rust side through an FFmpeg build that ships with the app. Designed for a non-technical user with low vision: larger text sizes, a high-contrast theme, a fully Turkish interface and a keyboard shortcut for every action.
- Rust
- TypeScript
- Svelte
- +9
WaifuChat (Local AI)
A personal AI assistant that uses local LLM models (DeepSeek), requires no internet connection, and runs entirely on-device.
- Rust
- Tauri
- DeepSeek-R1
- +1
Need something similar?
I can build a system like this for you, too.
Describe your project in a few sentences, and we'll work out the right approach and an estimated scope together.