How sourcebot-dev/sourcebot works
Main Components
a) Frontend Layer (packages/web):
• Next.js web application
• Search interface components
• Repository management UI
• API client interfaces
b) Backend Layer (packages/backend):
• Search service implementation
• Repository indexing system
• VCS integrations (GitHub, GitLab, Gitea, Gerrit)
• Zoekt integration
c) Storage Layer:
• Local repository cache (.sourcebot)
• Zoekt index storage
• Configuration storage
d) External Services:
• Version Control Systems (GitHub, GitLab, Gitea, Gerrit)
• Zoekt search engine
• PostHog analytics (optional)
Component Relationships
[External VCS] <---> [Backend Services] <---> [Zoekt Engine]
• ^
• v
[Web Frontend] <---> [API Layer] <---> [Local Storage]
Specific Implementation Details
a) Frontend Components:
• Components like SearchBar, CodePreviewPanel, and FilterPanel
• API client integration
• UI component library
b) Backend Services:
• Repository management system
• Multi-VCS integration handlers
• Indexing service
• Search service implementation
• Configuration management
c) Data Flow:
• Repository cloning and caching
• Index generation and updates
• Search query processing
• Results aggregation and delivery
Important Architectural Patterns to Highlight
• Microservices architecture (backend services)
• API-first design
• Event-driven indexing system
• Caching strategy
• Authentication flow for private repositories
Additional Elements
Annotations for:
• Configuration points
• Authentication boundaries
• Scaling components
• Monitoring points (PostHog integration)
• Cache invalidation flows
Implementation Notes
• Docker containerization
• Volume mounting for local storage
• Port mappings (3000)
• Environment variable configuration
• Periodic index updates (hourly)