System Overview
Granite is built as a distributed system with these core components:Components
Dashboard
React 19 + TypeScript + Vite
- Single-page application
- Real-time WebSocket updates
- WebRTC video streaming
- Tailwind CSS + Radix UI
Backend API
FastAPI + Python 3.12
- 110+ REST endpoints
- WebSocket connections
- Server-Sent Events (SSE)
- OpenAPI documentation
Database Layer
MongoDB + ClickHouse
- MongoDB for documents
- ClickHouse for analytics
- Redis for caching/queues
Driver System
Python + PyAutoGUI + Robocorp
- Windows desktop automation
- Screen capture & recording
- WebSocket job execution
Data Flow
Automation Execution Flow
Authentication Flow
Key Technologies
| Component | Technology | Purpose |
|---|---|---|
| Frontend | React 19, TypeScript, Vite | Web interface |
| Backend | FastAPI, Uvicorn | API server |
| Auth | Stytch B2B | Magic link + OAuth |
| Primary DB | MongoDB | Document storage |
| Analytics DB | ClickHouse | Time-series metrics |
| Cache/Queue | Redis | Job queue, sessions |
| Driver | Python, PyAutoGUI, Robocorp | Desktop automation |
| Video | WebRTC, aiortc | Live streaming |
| Cloud | GCP (MIG, GCS) | VM management, storage |
API Structure
The backend exposes 110+ endpoints organized into these groups:- Authentication
- Agent Execution
- Organizations
- Analytics
POST /api/login_or_create_user- Send magic linkGET /api/authenticate- Complete authPOST /api/logout- End sessionGET /api/me- Current user info
Deployment Options
Cloud (GCP)
- Managed Instance Groups for VMs
- Automatic scaling
- Google Cloud Storage for assets
- Production-ready setup
Local (Hyper-V)
- Windows 11 VMs on your machine
- Great for development/testing
- Full control over environment
- See Local Sandbox Setup
Security
Authentication
Authentication
- Stytch B2B for enterprise-grade auth
- Magic link + OAuth options
- Session tokens in HTTP-only cookies
- 7-day session expiration
Authorization
Authorization
API Security
API Security
X-Granite-API-Keyheader for public endpoints- Unkey for API key management
- Rate limiting on sensitive endpoints