How siddharthsahani/cohesion works
Main Components
a. Frontend Layer:
• Client-side SvelteKit components (src/lib/components)
• UI Components library (src/lib/components/ui)
• Game interface components (Board, BoardCard, BoardCell)
• Authentication components (SignInCard)
b. Backend Layer:
• Server-side SvelteKit routes (src/routes)
• API endpoints (src/routes/api)
• Authentication system (src/auth.js)
• Rate limiting service (src/lib/server/rateLimiter.js)
c. External Services:
• Supabase (Database & Authentication)
• Redis (Upstash for caching/rate limiting)
• AuthJS (Authentication framework)
Client Tier
Application Tier
Data Tier
Component Relationships
a. Client Tier:
• UI components to their respective routes
• Interaction between Board components and game logic
• Theme switching and responsive components
b. Application Tier:
• API routes to their handlers
• Authentication flow
• Demonstrate rate limiting middleware
• Game logic processing
c. Data Tier:
• Supabase connections for data storage
• Redis caching layer
• Authentication data flow
Specific Implementation Details
• Rectangles: Core components (Board, Game Logic)
• Hexagons: External services (AuthJS)
• Rounded rectangles: UI components
• Blue: Frontend components
• Green: Backend services
• Yellow: External services
• Red: Security/Authentication components
Key Flows to Highlight
a. Game Flow:
User → Board Component → Game API → Redis Cache → Supabase
b. Authentication Flow:
User → SignInCard → AuthJS → Supabase Auth → Protected Routes
c. Game Creation Flow:
User → Create Route → API Endpoint → Supabase Storage
Additional Elements
Specific features:
• Rate limiting mechanism between API calls
• Redis caching layer for game state
• Supabase real-time updates
• Theme switching functionality
• Profile management system