Oculus is a desktop controller for LIFX lights, built with Tauri, Svelte, and Rust. It allows users to view lights, toggle power, change states, and activate scenes.
- Runtime: Bun v1.3+
- Frontend:
- Svelte v5 (SvelteKit)
- TypeScript
- Tailwind CSS v4
- Vite
- Backend:
- Rust
- Tauri v2
- State Management:
- Frontend: Svelte Runes (
$state,$derived) + Global Store (lightState.svelte.ts) - Backend:
LifxState(Rust),tauri-plugin-store(Persistence)
- Frontend: Svelte Runes (
- Rust (stable)
- Bun
- Node.js (optional, Bun is preferred)
- Install Dependencies:
bun install - Run Development Server:
bun tauri dev - Build for Production:
bun tauri build - Check Types:
bun check
The application follows a standard Tauri architecture with a clear separation between Frontend (UI) and Backend (Core Logic).
- Framework: SvelteKit adapter-static (SPA mode).
- Styling: Tailwind CSS v4 configured in
src/app.css. - Components: Located in
src/components/. - Routes: Located in
src/routes/./: Main Dashboard./settings: Settings page.
- LIFX Client:
src/lib/lifx.tshandles client-side logic and invokes Tauri commands.
- Entry Point:
src-tauri/src/lib.rsexposes Tauri commands. - LIFX Logic:
src-tauri/src/lifx.rshandles direct communication with LIFX HTTP API. - Commands:
set_api_token: Stores the LIFX API token.get_lights: Fetches list of lights.set_light_state: Updates light color/power.toggle_light: Toggles light power.get_scenes: Fetches available scenes.activate_scene: Activates a specific scene.
package.json: Frontend dependencies and scripts.src-tauri/tauri.conf.json: Tauri configuration (permissions, bundle settings).src-tauri/Cargo.toml: Rust dependencies.src/lib/lifx.ts: Frontend interface for Tauri commands.src-tauri/src/lib.rs: Command registration and state management.
- Package Manager: Use
bunfor all script executions. - Styling: Use Tailwind utility classes. Avoid custom CSS unless necessary.
- Reactivity: Use Svelte 5 Runes (
$state) instead of legacy stores where possible. - IPC: All backend communication must go through Tauri commands defined in
lib.rs.