Raven Desktop
Architecture
System design and integrations for Raven Desktop
System context
macOS desktop UI (side-panel)
|-> OS-native OCR + screen capture
|-> ConnectRPC over HTTP/2
v
Raven backend (services/raven)Code structure
lib/
app/ App shell, router, themes, window chrome
common/ Shared logging + widgets
env/ Build-time environment (Envied)
features/ Feature modules (auth, home, ocr, overlay, updates, ...)
gen/ Generated ConnectRPC + protobuf stubs
providers/ Cross-cutting Riverpod providers (theme, etc.)
services/ Shared services (auth interceptor, statsig, auto-update)Feature layout conventions
Most features follow a consistent layout:
features/<feature>/
models/ Typed state + request models
providers/ Riverpod controllers and derived state
services/ Business logic / integrations
ui/ Pages and widgetsThe OCR feature also includes notifications/ for secondary windows.
Feature modules
features/auth/: login, SSO, auth providers, and client integration.features/ocr/: OCR capture + state machine + notifications.features/overlay/: side-panel window behavior and tray integration.features/home/: search UI and result rendering.features/settings/,features/updates/,features/onboarding/.
App startup sequence
lib/main.dartinitializes windowing, Statsig, auto-updater, and Firebase.- Release builds enable Sentry and wrap the app with
SentryWidget. lib/app/app.dartwires theShadAppshell, theme, andgo_router._EagerInitializationinitializes tray, OCR background, and notifications.
Routing and windowing
go_routerhandles auth, onboarding, and main routes.- Secondary windows (OCR notifications, update prompts) use
desktop_multi_windowwith typed launch arguments. - Overlay window behavior is coordinated in
features/overlay/.
State management
- Riverpod (
flutter_riverpod) with feature-scoped providers infeatures/*/providers/and shared providers inlib/providers/. - UI reads providers via
ConsumerWidgetandNotifierProvider(e.g., OCR). - Debug builds attach a
RavenProviderObserverfor provider change logging.
Networking and storage
- ConnectRPC over HTTP/2 with protobuf stubs in
lib/gen/. auth_interceptorattaches Firebase tokens to ConnectRPC requests.- Session state persists in
flutter_secure_storage. - Settings and last-login metadata use
SharedPreferences.
Error handling
- Central logging via
lib/common/logger.dart. - Sentry enabled in release builds for crash + performance reporting.
- OCR errors are normalized through
OcrErrorMapperand surfaced inOcrStatus. - ConnectRPC auth uses an interceptor to attach Firebase tokens and logs failures.
UI libraries
shadcn_uifor core components and theming (ShadApp / ShadTheme).lucide_icons_flutter+font_awesome_flutterfor iconography.mesh_gradientfor background effects.
Key integrations
- Raven backend (
services/raven/). - macOS system APIs for OCR and screen capture.
- Firebase Auth for user sessions.
- Statsig and Sentry for telemetry and experiments.
Last updated on