How haishanh/cherry works
Main System Components
a) Frontend Layer:
• SvelteKit application (evident from the src/routes structure)
• Component library (src/lib/components)
• Client-side stores (src/lib/client/*.store.ts)
b) Backend Layer:
• API Routes (src/routes/api/*)
• Service Layer (src/lib/server/services)
• Database Layer (src/lib/server/db)
c) Authentication System:
• Multiple auth providers support (src/routes/api/auth/[provider])
• User management (src/lib/server/services/user.service.ts)
d) External Services:
• S3 integration (s3.service.ts)
• Favicon fetching service
• OIDC providers
[Client Browser] ←→ [Frontend Layer (SvelteKit)] ←→ [API Layer] ←→ [Service Layer] ←→ [Database]
• ↑
• ↓
• [External Services]
Component Details
Frontend Layer (Blue):
• Main routes (/bookmarks, /tags, /groups, /settings)
• Component hierarchy
• Stores for state management
API Layer (Green):
• Endpoints by function:
• Authentication endpoints
• Bookmark management
• Tag management
• Management
• Admin operations
• Import/Export functionality
Service Layer (Yellow):
• BookmarkService
• TagService
• GroupService
• UserService
• ImportService
• ExportService
• AdminService
• S3Service
Database Layer (Purple):
• Main tables/collections:
• Users
• Bookmarks
• Tags
• Groups
• BookmarkTags
• Jobs
External Services (Red):
• S3 Storage
• OAuth Providers
• Favicon Service
Data Flow Indicators
• User authentication flow
• Bookmark creation/update flow
• Tag management flow
• Import/Export operations
• Admin operations
Additional Elements
Include:
• Version information
• Database migration flow
• Security boundaries
• API versioning (v1 endpoints)
Infrastructure Layer
Docker-related components:
• Nginx reverse proxy
• S6-overlay service management
• Container health checks
Remember to highlight the modular nature of the application, especially the separation between client and server components, and how the service layer abstracts database operations from the API endpoints.