Skip to main content

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

1

User Creates Process

User defines a process in the dashboard with a prompt or RPA script
2

Job Queued

Backend creates a job and adds it to the Redis queue
3

Driver Picks Up Job

An available driver machine claims the job via WebSocket
4

Execution Begins

Driver executes the automation, streaming video back
5

HITL Checkpoints

Sensitive actions pause for user approval via WebSocket
6

Results Stored

Screenshots, recordings, and logs saved to MongoDB/GCS
7

Analytics Updated

Execution metrics written to ClickHouse

Authentication Flow

Key Technologies

ComponentTechnologyPurpose
FrontendReact 19, TypeScript, ViteWeb interface
BackendFastAPI, UvicornAPI server
AuthStytch B2BMagic link + OAuth
Primary DBMongoDBDocument storage
Analytics DBClickHouseTime-series metrics
Cache/QueueRedisJob queue, sessions
DriverPython, PyAutoGUI, RobocorpDesktop automation
VideoWebRTC, aiortcLive streaming
CloudGCP (MIG, GCS)VM management, storage

API Structure

The backend exposes 110+ endpoints organized into these groups:
  • POST /api/login_or_create_user - Send magic link
  • GET /api/authenticate - Complete auth
  • POST /api/logout - End session
  • GET /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

  • Stytch B2B for enterprise-grade auth
  • Magic link + OAuth options
  • Session tokens in HTTP-only cookies
  • 7-day session expiration
  • Role-based access control (Admin/Member/Viewer)
  • Organization-scoped data isolation
  • API key authentication for public endpoints
  • X-Granite-API-Key header for public endpoints
  • Unkey for API key management
  • Rate limiting on sensitive endpoints

Next Steps