# CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Development Commands ### Frontend Development - `trunk serve` - Start frontend development server at http://localhost:8080 - `trunk build --release` - Build frontend for production - `cargo check` - Check frontend code compilation ### Backend Development - `cargo run --manifest-path=backend/Cargo.toml` - Start backend server at http://localhost:3000 - `cargo check --manifest-path=backend/Cargo.toml` - Check backend code compilation ### Full Development Setup 1. Start backend: `cargo run --manifest-path=backend/Cargo.toml` 2. Start frontend: `trunk serve` (in project root) 3. Access application at http://localhost:8080 ## Architecture Overview This is a full-stack calendar application with a Rust WebAssembly frontend and Rust backend, featuring CalDAV integration for calendar synchronization. ### Frontend (Yew WebAssembly) - **Entry Point**: `src/app.rs` - Main application component with routing and state management - **Models**: `src/models/ical.rs` - RFC 5545-compliant iCalendar data structures (VEvent, VTodo, etc.) - **Services**: `src/services/calendar_service.rs` - HTTP client for backend API calls - **Components**: `src/components/` - UI components including calendar views, modals, and forms - **Views**: Month view (`month_view.rs`) and week view (`week_view.rs`) with drag-and-drop event modification ### Backend (Axum) - **Entry Point**: `backend/src/main.rs` - HTTP server with CORS and routing - **Handlers**: `backend/src/handlers.rs` - API endpoints for calendar operations - **CalDAV Integration**: `backend/src/calendar.rs` - CalDAV client for server synchronization - **Authentication**: `backend/src/auth.rs` - JWT token management ### Key Data Flow 1. Frontend makes HTTP requests to backend API (`/api/*` endpoints) 2. Backend authenticates requests and proxies to CalDAV servers 3. Data uses RFC 5545 VEvent structures throughout the system 4. Events support recurrence (RRULE), exceptions (EXDATE), and timezone conversion ### Event Management Features - **Series Updates**: Events can be updated as "entire series" (`update_series`) or "this and future events" (`this_and_future`) - **Drag and Drop**: Week/month views support dragging events to new times with automatic timezone conversion - **Recurring Events**: Full RRULE support with UNTIL dates and exception handling - **Timezone Handling**: Local time in UI, UTC for storage and API calls ### Important Implementation Details - All event data uses RFC 5545-compliant VEvent structures (not legacy CalendarEvent) - Frontend converts local times to UTC before sending to backend - API expects `HH:MM` time format (not `HH:MM:SS`) - Recurrence modifications create new series with UNTIL dates on original events - Event UIDs are preserved across updates for CalDAV compatibility ### Build Configuration - Frontend built with Trunk (see `Trunk.toml`) - Backend API URL: `http://localhost:3000/api` (configurable via `BACKEND_API_URL`) - Frontend serves on port 8080, backend on port 3000 ### Dependencies - **Frontend**: Yew, chrono, serde, web-sys, gloo-storage - **Backend**: Axum, tokio, reqwest, ical, jsonwebtoken - **Shared**: RFC 5545 iCalendar structures, UUID generation