Repository Root
Desktop App (raffi-desktop/)
The desktop application built with Electron 40, Svelte 5, and TypeScript.
Directory Structure
Key Files
electron/main.cjs- Electron main process, handles window creation, IPC, and system integrationelectron/services/- Backend services like Discord Rich Presencesrc/main.ts- Svelte app entry pointsrc/components/- Reusable UI components (video player, modals, cards, etc.)src/lib/- Utilities, API clients, stores, and shared logicsrc/pages/- Top-level page componentsbuild_binary.cjs- Script to build Go server binaries for all platforms
Dependencies
Key Production Dependencies:electron- Desktop frameworksvelte- Frontend framework@supabase/supabase-js- Database and authenticationconvex- Real-time backendhls.js- Video playback@ryuziii/discord-rpc- Discord integrationelectron-updater- Auto-update functionalitytailwindcss- CSS frameworklucide-svelte- Icon library
vite- Build tool and dev serverelectron-builder- Package and distribute@sveltejs/vite-plugin-svelte- Svelte support for Vite
Mobile App (raffi-mobile/)
The mobile application built with React Native and Expo SDK 54.
Directory Structure
Key Files
app/_layout.tsx- Root layout with navigation setupapp/(tabs)/- Tab navigation screens (Home, Search, Library, Profile)app/meta/- Content detail screensapp/player.tsx- Video player with native controlscomponents/- Reusable UI componentslib/auth/- Supabase authenticationlib/stores/- Global state management with Zustandmodules/torrent-streamer/- Native module for torrent streaming
Dependencies
Key Production Dependencies:expo- React Native frameworkreact- UI library (v19)react-native- Native platform (v0.81)expo-router- File-based routingexpo-video- Native video player@supabase/supabase-js- Shared with desktopconvex- Real-time backendzustand- State management@expo/vector-icons- Icons
expo-av,expo-blur,expo-brightness,expo-file-system,expo-haptics, etc.
Streaming Server (raffi-server/)
The HLS transcoding server built with Go.
Directory Structure
Key Files
main.go- HTTP server, routing, and core logiccast.go- Chromecast device discovery and streamingclip.go- Video segment extraction and clippingcommunity_addons.go- Integration with Stremio addon protocolsrc/hls/- HLS transcoding and streamingsrc/torrent/- Torrent client and magnet link handling
Key Dependencies
github.com/anacrolix/torrent- Torrent client library- Various encoding and streaming libraries
- WebRTC libraries for Chromecast support
Marketing Website (raffi-site/)
The marketing website built with SvelteKit.
Directory Structure
Key Files
src/routes/- SvelteKit file-based routingsrc/lib/- Shared components and utilitiespublic/- Static files served directly
Backend Functions (convex/)
Real-time backend functions powered by Convex.
Directory Structure
Key Files
raffi.ts- Watch party logic, presence, mutations, and queriesauth.config.ts- Supabase authentication integrationschema.ts- Database tables and relationships:- Watch parties
- User presence
- Watch progress
- Custom lists
- Addon configurations
Convex Functions
Theraffi.ts file contains functions for:
- Creating and managing watch parties
- Syncing playback state across devices
- Tracking user presence
- Managing watch progress
- Handling custom lists and favorites
Build Outputs
Desktop App
Mobile App
- Development builds are installed directly on devices/simulators
- Production builds are managed through Expo Application Services (EAS)
- Output includes
.apk/.aab(Android) and.ipa(iOS)
Configuration Files
TypeScript Configuration
Each project has its owntsconfig.json with project-specific settings:
- Desktop: Svelte types, Electron types
- Mobile: React Native types, Expo types
- Convex: Convex types
Build Configuration
- Desktop:
electron-builderconfig inpackage.jsonunderbuildkey - Mobile:
app.jsonandeas.jsonfor Expo configuration - Server: Go modules in
go.mod
Environment Variables
Each project may require environment variables:-
Desktop/Mobile:
SUPABASE_URL- Supabase project URLSUPABASE_ANON_KEY- Supabase anonymous keyCONVEX_URL- Convex deployment URL
-
Convex:
- Configured through Convex dashboard
Environment variables are typically stored in
.env files (git-ignored) or configured through the respective platform dashboards.Code Organization Best Practices
Desktop App
- Components: Keep components small and focused
- Stores: Use Svelte stores for shared state
- Services: Isolate platform-specific logic in
electron/services/ - Utilities: Share common logic in
src/lib/
Mobile App
- Screens: Use Expo Router file-based routing in
app/ - Components: Organize by feature or type
- Hooks: Extract reusable logic into custom hooks
- Stores: Use Zustand for global state
Server
- Handlers: Keep HTTP handlers focused and testable
- Separation: Separate business logic from HTTP logic
- Modules: Organize by feature (HLS, torrent, cast, etc.)
Next Steps
Development Overview
Learn about Raffi’s architecture and tech stack
Setup Guide
Set up your development environment