C4 Model - Level 1: System Context
Overview
The System Context diagram shows Sasha Studio as a single system and its relationships with external actors and systems. This is the highest level view of the architecture.
System Context Diagram
C4Context
title System Context Diagram for Sasha Studio
Person(user, "User", "Business professional or developer using AI assistance")
Person(admin, "Administrator", "System administrator managing deployment")
System(sasha, "Sasha Studio", "AI-powered knowledge management platform providing conversational interface to Claude")
System_Ext(claude_api, "Anthropic Claude API", "AI model API for natural language processing")
System_Ext(file_system, "Local/Cloud File System", "Storage for documents and workspace files")
System_Ext(auth_provider, "Authentication Provider", "Optional external auth (OAuth/SAML)")
System_Ext(monitoring, "Monitoring System", "Logging and metrics collection")
Rel(user, sasha, "Uses", "HTTPS/WSS")
Rel(admin, sasha, "Configures & Deploys", "Docker/CLI")
Rel(sasha, claude_api, "Sends prompts", "HTTPS via Claude CLI")
Rel(sasha, file_system, "Reads/Writes", "File I/O")
Rel_Back(auth_provider, sasha, "Authenticates", "OAuth/SAML")
Rel(sasha, monitoring, "Sends metrics", "Logs/Metrics")
UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
Actors
Primary Users
- Business Professionals: Use Sasha for knowledge management, document analysis, and AI-assisted decision making
- Developers: Use Sasha for code assistance, technical documentation, and development workflows
- Administrators: Deploy and manage Sasha instances
System Interactions
User β Sasha Studio
- Protocol: HTTPS for web interface, WSS for real-time updates
- Authentication: Username/password with JWT tokens
- Capabilities:
- Chat with AI assistant
- Upload and manage documents
- Browse file system
- Configure settings
- View session history
Sasha Studio β Anthropic Claude API
- Integration: Via Claude CLI (command-line interface)
- Protocol: HTTPS API calls
- Authentication: API key configuration
- Capabilities:
- Send user prompts
- Receive AI responses
- Stream completions
- Handle tool usage
Sasha Studio β File System
- Local Mode: Direct file system access
- Docker Mode: Volume-mounted directories
- Cloud Mode: Persistent cloud storage
- Operations:
- Read workspace files
- Write generated content
- Store uploaded documents
- Manage temporary files
External Systems
Anthropic Claude API
- Purpose: Core AI intelligence provider
- Integration Method: Claude CLI subprocess
- Data Flow: User prompts β Claude API β AI responses
- Configuration: API key in environment or .env file
File System
- Local Development: User's local file system
- Docker Deployment: Mounted volumes
- Cloud Deployment: Persistent storage (GCS, S3, etc.)
- Usage:
- Document storage
- Workspace management
- Configuration files
- Database storage
Authentication Provider (Optional)
- Current: Built-in authentication (single-user)
- Future: OAuth2, SAML, LDAP integration
- Purpose: Enterprise authentication
Monitoring System
- Logging: Application logs, error tracking
- Metrics: Performance, usage statistics
- Health Checks: Service availability
- Platforms: Cloud Logging, Datadog, etc.
Security Boundaries
graph TB
subgraph "Trust Boundary"
subgraph "Sasha Studio System"
UI[Web UI]
API[API Server]
DB[(Database)]
end
end
subgraph "External Services"
Claude[Claude API]
Storage[File Storage]
end
User[User] -->|HTTPS/Auth| UI
API -->|API Key| Claude
API -->|File I/O| Storage
Data Flow Overview
User Interaction Flow
- User accesses Sasha Studio web interface
- Authenticates with credentials
- Interacts through chat interface
- Uploads documents for processing
- Receives AI-generated responses
AI Processing Flow
- User sends message/query
- Sasha processes and adds context
- Claude CLI spawned with prompt
- Claude API processes request
- Response streamed back to user
- Session saved to database
Document Processing Flow
- User uploads document
- Document converted to markdown
- Content indexed and stored
- Available for AI context
- Searchable in knowledge base
Deployment Contexts
Local Development
- Direct file system access
- Local SQLite database
- Development Claude API key
- No external auth required
Docker Deployment
- Containerized application
- Volume-mounted storage
- Environment-based config
- Optional compose networking
Cloud Deployment (GCP/Sliplane)
- Managed container service
- Cloud storage backends
- Production API keys
- Enhanced monitoring
System Qualities
Performance
- Sub-second response initiation
- Real-time message streaming
- Efficient file processing
- Optimized database queries
Security
- Encrypted connections (HTTPS/WSS)
- Secure credential storage
- API key protection
- Session management
Reliability
- Graceful error handling
- Automatic reconnection
- Data persistence
- Health monitoring
Scalability
- Single-user optimization
- Stateless API design
- Horizontal scaling ready
- Cloud-native architecture
Constraints
Technical Constraints
- Requires Node.js 20+
- Claude CLI dependency
- SQLite for single-user
- Browser compatibility
Business Constraints
- Single-user licensing
- API rate limits
- Storage quotas
- Deployment restrictions
Regulatory Constraints
- Data privacy compliance
- API usage policies
- Export controls
- Security requirements