How radicle-dev/radicle-desktop works
Project type and purpose
• Radicle Desktop is a “local-first” peer-to-peer code collaboration desktop application.
• It uses Tauri to wrap a Rust backend with a Svelte/TypeScript frontend.
• Key features: interact with the Radicle network, view/create issues, patches, diffs, threads, notifications.
Main components
a. Frontend (Renderer)
• Built with Svelte (src/, src/components/, src/views/, public/ assets)
• Bundled by Vite (vite.config.ts, package.json)
• Runs in a WebView window provided by Tauri
b. Tauri Host & IPC Layer
• Tauri’s Rust side (crates/radicle-tauri) exposing commands via invoke
c. Core Libraries
• crates/radicle-types: shared Rust and TypeScript type definitions and domain logic (cobs, diff, repo, thread, config, error, outbound/sqlite)
d. Backend & Persistence
• Native Rust code in crates/radicle-tauri
• commands.rs + individual command modules (auth, cob, diff, inbox, profile, repo, startup, thread)
• Outbound layer uses SQLite (crates/radicle-types/src/outbound/sqlite.rs)
• Build.rs and Cargo.toml define Rust dependencies
e. External Services
• Radicle P2P network (libp2p, gossip protocols)—invoked by Rust backend
• Local filesystem (for peer identity, project repos, bundling)
• Optionally test-server crate (crates/test-http-api) for unit/integration tests
f. Testing & CI
• Unit tests (tests/unit), E2E tests (tests/e2e with Playwright), scripts/*, .github/workflows, .woodpecker pipelines
Relationships and data flow
1. User interacts with UI (Svelte app).
2. UI calls Tauri’s invoke API (src/lib/invoke.ts).
3. Tauri host dispatches to Rust commands in crates/radicle-tauri.
4. Commands execute domain logic (via crates/radicle-types).
5. Domain logic may:
• Query/modify local SQLite storage
• To Radicle P2P network (publish/subscribe)
6. Results are serialized back to UI (via Tauri IPC).
7. UI updates state, re-renders views.
Architectural patterns and principles
• Layered architecture:
• Presentation (Svelte)
• IPC/Facade (Tauri commands)
• Domain (crate radicle-types)
• Persistence (SQLite)
• Network (Radicle P2P)
• Shared domain types (Rust ↔ TypeScript) to ensure type safety across layers.
• Single executable bundling both UI and backend.
• MVC/Component pattern in the Svelte frontend (views, components, router).
Technologies/Frameworks to annotate
• Frontend: Svelte, TypeScript, Vite
• Native: Rust, Tauri
• Persistence: SQLite (via rusqlite in radicle-types)
• Networking: libp2p (transitively via radicle code in radicle-types / radicle-tauri)
• Testing: Playwright (E2E), Jest or similar for unit tests, custom test HTTP API server