How gristlabs/grist-core works
Main Components
a. Client Layer:
• UI Components (app/client/ui)
• Models (app/client/models)
• Components (app/client/components)
• Widgets (app/client/widgets)
• Client-side APIs and hooks
b. Server Layer:
• Split into three main services:
• Home Server (handles authentication, user management, and document listing)
• Doc Worker (handles document operations and Python formula execution)
• Static Server (serves static assets)
c. Storage Layer:
• Multiple storage systems:
• Document Storage (SQLite-based .grist files)
• Metadata Database (TypeORM with PostgreSQL/SQLite)
• Redis (for sessions and caching)
• File Storage (for attachments)
Key Interactions
a. Authentication Flow:
• Support for multiple auth methods:
• Forward Authentication
• SAML
• OAuth
• Default Authentication
b. Document Processing:
• Flow from client to server:
• Action Bundles
• Formula Execution
• Data Updates
• Real-time Sync
c. Plugin Architecture:
• Plugin system components:
• Custom Widgets
• Import Sources
• File Parsers
• Sandboxed Execution
Security Boundaries
a. Sandbox Implementations:
• Different sandbox options:
• gVisor
• macSandboxExec
• Pyodide (WASM)
• Docker
b. Access Control:
• ACL implementation:
• User Permissions
• Row-level Access
• Column-level Access
Integration Points
a. External Services:
• Connections to:
• Webhooks
• Google Drive
• Custom Widgets
• AI Assistant (OpenAI/Llama)
b. API Endpoints:
• Main API groups:
• REST API
• WebSocket Connections
• SCIM API
Specific Implementation Details
• Blue: Core application components
• Green: Security boundaries
• Yellow: Integration points
• Red: Critical paths
• Gray: Optional features
• Databases
• API endpoints
• User interfaces
• Security boundaries
• External services
Annotations for:
• Environment variable configuration points
• Scaling considerations
• Security checkpoints
• Data flow directions
Data storage and caching strategy
This will provide a clear understanding of Grist's architecture while maintaining the right level of detail for a principal software engineer to understand the system's design and implementation.