How srcbookdev/srcbook works
Main Components
a) Frontend Layer (packages/web):
• React-based web interface
• Components for app builder and notebook interfaces
• WebSocket client for real-time communication
• File system access integration
b) API Layer (packages/api):
• HTTP and WebSocket servers
• AI integration services
• TypeScript server management
• File system operations
• Database interactions
c) Shared Components (packages/shared):
• Type definitions
• Schemas
• Common utilities
d) Component Library (packages/components):
• Reusable UI components
• Cell components for notebooks
• Theme management
e) External Services:
• AI Providers (Anthropic Claude)
• Database (indicated by Drizzle migrations)
• Analytics service (PostHog)
[User Browser]
• ↕️
[Frontend Layer]
• App Builder UI
• Notebook UI
• WebSocket Client
• File System Access
• ↕️
[API Layer]
• HTTP Server
• WebSocket Server
• AI Services
• App Parser
• Plan Parser
• Code Generator
• TypeScript Server
• File System Manager
• Database Layer
• ↕️
[External Services]
• AI Provider (Claude)
• Analytics (PostHog)
• Database
Key Relationships to Highlight
• Bidirectional communication between frontend and API through both HTTP and WebSocket protocols
• File system interactions for local development
• AI service integration flow for code generation and app building
• Database interactions for storing user settings and app state
• TypeScript server integration for code analysis and completion
Important Architectural Patterns to Emphasize
• Monorepo structure using pnpm workspaces
• Microservices-like separation between different API functionalities
• Real-time communication through WebSocket channels
• Event-driven architecture for app updates and previews
• Plugin-based system for AI provider integration
Implementation Details
• Node.js runtime environment
• TypeScript as the primary language
• React for frontend components
• WebSocket for real-time updates
• Drizzle for database operations
• Docker support for containerization