Technology Stack
Relevant source files
The following files were used as context for generating this wiki page:
Mailiner is a browser-based IMAP client written in Rust. It compiles to WebAssembly (WASM) to provide a private, efficient email experience directly in the browser without intermediate application servers.
Sources: README.md:3-6, AGENTS.md:3-5
Core Framework and Language
Mailiner uses the Rust programming language and the Dioxus library for its user interface. Dioxus enables building cross-platform applications with a React-like mental model.
- Language: Rust (Edition 2024)
- UI Framework: Dioxus (v0.7.9)
- Target: WASM (web)
Sources: README.md:9-10, crates/mailiner-app/Cargo.toml:4-16
Architecture and Data Flow
The application executes entirely within the browser. Because browsers cannot create direct TCP connections required by the IMAP protocol, Mailiner uses a WebSocket-to-TCP proxy.
The diagram shows the communication path from the WASM application through the proxy to the target email server.
Communication Proxy
Mailiner connects to a ws-tcp-proxy instance. This proxy accepts WebSocket connections from the browser and forwards the payload to the destination IMAP server via TCP. All IMAP communication remains encrypted on the browser side via TLS, ensuring the proxy cannot read message content.
Sources: README.md:12-16, README.md:21-25
Data Persistence
Account settings, including IMAP passwords and proxy tokens, are stored locally in the browser's localStorage. Mailiner does not use a centralized server account.
Sources: README.md:32-34
Crate Ecosystem
The project is organized into several specialized crates to handle different aspects of email management.
| Crate | Purpose |
|---|---|
mailiner-app | Primary UI crate containing Dioxus components and application logic. |
mailiner-composer | Handles email draft models, rich text editing, and prefill logic. |
mailiner-mime | Manages RFC 5322/MIME serialization, headers, and multipart structures. |
mailiner-html | Provides shared HTML and CSS sanitization policies. |
mailiner-imap-connector | Implements the IMAP protocol communication layer. |
mailiner-core | Defines shared models and traits used across all crates. |
Sources: crates/mailiner-composer/src/lib.rs:7-13, crates/mailiner-app/Cargo.toml:21-36, crates/mailiner-html/Cargo.toml:6-8
Security Stack
Mailiner implements a multi-layered security strategy to protect user data and privacy.
Content Security Policy (CSP)
The application enforces a baseline CSP via a <meta> tag to mitigate XSS risks.
| Directive | Configuration | Reason |
|---|---|---|
default-src | 'self' | Denies unexpected origins by default. |
script-src | 'self' 'wasm-unsafe-eval' | Limits execution to app WASM; allows WASM instantiation. |
style-src | 'self' 'unsafe-inline' | Required for Dioxus virtual list and layout styles. |
img-src | 'self' data: blob: http: https: | Supports inline images, previews, and user-allowed remote images. |
object-src | 'none' | Disables plugins. |
Sources: README.md:41-55
Sanitization
Mailiner uses the ammonia crate to sanitize HTML content in both the viewer and the composer. It strips script tags, iframe elements, and dangerous URL schemes like javascript:. It specifically blocks remote resources by default to prevent tracking.
Sources: crates/mailiner-html/src/lib.rs:88-100, crates/mailiner-app/src/formatter/html.rs:74-88
Development and Tooling
The project utilizes modern web development and testing tools for the Rust ecosystem.
Build Tools
- Dioxus CLI (
dx): Used for serving the app locally and building release bundles. - Wasm-opt: Optimizes WASM binary size (level "s") for production.
- Cargo: Manages Rust dependencies and workspace builds.
Sources: crates/mailiner-app/Dioxus.toml:23-26, README.md:73-82
Testing Framework
- Playwright: Drives end-to-end tests in a real Chromium browser.
- Tokio: Provides the asynchronous runtime for native tests and connectors.
- Node.js: Required to run the Playwright test suite.
Sources: playwright.config.ts:16-25, e2e/README.md:3-8, crates/mailiner-app/Cargo.toml:61
Key Dependencies
The following libraries are critical to Mailiner's functionality:
async-imap: Handles the underlying IMAP protocol interactions.chrono: Manages time and date formatting for email headers.uuid: Generates unique identifiers for drafts and MIME boundaries.base64/encoding_rs: Handles transfer encoding and character set conversion.regex: Used for HTML parsing and attribute manipulation in the formatter.
Sources: crates/mailiner-app/Cargo.toml:22-35, crates/mailiner-mime/Cargo.toml:6-10