Skip to content

Instantly share code, notes, and snippets.

@bitsmuggler
Last active February 11, 2026 20:33
Show Gist options
  • Select an option

  • Save bitsmuggler/8ba562adc88a413923e95c139451b877 to your computer and use it in GitHub Desktop.

Select an option

Save bitsmuggler/8ba562adc88a413923e95c139451b877 to your computer and use it in GitHub Desktop.
Generated Supabase Architecture Model in Structurizr DSL (workingsoftware.dev)
workspace "Supabase" "The open-source Firebase alternative — a full Postgres development platform." {
model {
// People
developer = person "Developer" "A developer building applications using the Supabase platform."
endUser = person "End User" "A user of an application built on Supabase."
admin = person "Platform Admin" "A Supabase team member managing the platform."
// Primary system
supabase = softwareSystem "Supabase Platform" "Open-source backend-as-a-service built on PostgreSQL." {
// Frontend applications
group "Web Applications" {
studio = container "Studio Dashboard" "Management console for Supabase projects — database, auth, storage, and functions." "Next.js" "WebBrowser"
www = container "Marketing Website" "Public website at supabase.com with product info and pricing." "Next.js" "WebBrowser"
docs = container "Documentation" "Developer documentation, API references, and guides." "Next.js / MDX" "WebBrowser"
cms = container "CMS" "Content management system for website and docs content." "Payload CMS / Next.js"
}
// API Gateway
kong = container "API Gateway" "Routes, authenticates, and rate-limits all API requests." "Kong 2.8"
// Core services
group "Core Services" {
postgrest = container "PostgREST" "Auto-generates a RESTful API from the PostgreSQL schema." "PostgREST v14"
gotrue = container "GoTrue" "Handles user authentication and JWT token issuance." "GoTrue v2"
realtime = container "Realtime" "Broadcasts database changes to subscribed clients via WebSockets." "Elixir"
storageApi = container "Storage API" "Manages file uploads, downloads, and transformations." "Node.js"
edgeRuntime = container "Edge Runtime" "Executes serverless edge functions." "Deno"
pgMeta = container "Postgres Meta" "REST API for database introspection and management." "Node.js"
logflare = container "Logflare" "Centralized log aggregation and analytics." "Elixir"
}
// Data layer
group "Data Layer" {
postgres = container "PostgreSQL" "Primary database with Row Level Security, extensions, and replication." "PostgreSQL 15" "Database"
supavisor = container "Supavisor" "Connection pooler for PostgreSQL." "Elixir" "Database"
}
// Supporting services
group "Supporting Services" {
imgproxy = container "imgproxy" "On-the-fly image resizing and transformation." "imgproxy v3"
vector = container "Vector" "Log collection agent that routes logs to Logflare." "Timber Vector"
}
}
// External systems
stripe = softwareSystem "Stripe" "Processes subscription payments and billing." "External"
openai = softwareSystem "OpenAI / Bedrock" "Provides AI/LLM capabilities for Studio AI assistant." "External"
oauthProviders = softwareSystem "OAuth Providers" "Third-party identity providers (GitHub, Google, Apple, Discord, etc.)." "External"
sentry = softwareSystem "Sentry" "Error tracking and monitoring." "External"
posthog = softwareSystem "PostHog" "Product analytics and feature flags." "External"
vercel = softwareSystem "Vercel" "Frontend hosting and deployment platform." "External"
s3 = softwareSystem "S3 / Object Storage" "Stores uploaded files, images, and static assets." "External"
// Relationships: People -> System
developer -> supabase "Manages projects and builds applications using"
endUser -> supabase "Uses applications powered by"
admin -> supabase "Administers platform via"
// Relationships: People -> Containers
developer -> studio "Manages database, auth, storage, and functions" "HTTPS"
developer -> docs "Reads documentation and API references" "HTTPS"
endUser -> www "Learns about Supabase" "HTTPS"
admin -> cms "Manages content" "HTTPS"
// Relationships: Client -> Kong
developer -> kong "Calls APIs via client libraries" "HTTPS"
endUser -> kong "Accesses application APIs" "HTTPS"
// Relationships: Kong -> Services
kong -> postgrest "Routes REST API requests" "HTTP"
kong -> gotrue "Routes auth requests" "HTTP"
kong -> realtime "Routes WebSocket connections" "WebSocket"
kong -> storageApi "Routes storage requests" "HTTP"
kong -> edgeRuntime "Routes function invocations" "HTTP"
kong -> pgMeta "Routes meta API requests" "HTTP"
kong -> studio "Serves dashboard" "HTTP"
// Relationships: Studio -> Services
studio -> pgMeta "Introspects database schema" "REST/JSON"
studio -> logflare "Queries logs and analytics" "REST/JSON"
studio -> gotrue "Manages auth users" "REST/JSON"
studio -> storageApi "Manages storage buckets" "REST/JSON"
studio -> postgrest "Queries project data" "REST/JSON"
// Relationships: Services -> Database
postgrest -> postgres "Reads from and writes to" "SQL"
gotrue -> postgres "Stores auth users and sessions" "SQL"
realtime -> postgres "Listens to WAL changes via" "Replication"
storageApi -> postgres "Stores file metadata in" "SQL"
edgeRuntime -> postgres "Accesses data via" "SQL"
pgMeta -> postgres "Introspects schema of" "SQL"
logflare -> postgres "Stores logs in _analytics schema" "SQL"
supavisor -> postgres "Pools connections to" "SQL"
cms -> postgres "Stores CMS content in" "SQL"
// Relationships: Services -> Services
storageApi -> imgproxy "Transforms images via" "HTTP"
vector -> logflare "Ships logs to" "HTTP"
// Relationships: Services -> External
gotrue -> oauthProviders "Authenticates via" "OAuth 2.0"
studio -> openai "Powers AI assistant via" "REST/JSON"
studio -> stripe "Manages billing via" "REST/JSON"
studio -> sentry "Reports errors to" "HTTPS"
studio -> posthog "Sends analytics to" "HTTPS"
storageApi -> s3 "Stores files in" "S3 API"
imgproxy -> s3 "Reads images from" "S3 API"
// Deployment: Docker (Local Development)
deploymentEnvironment "Local Development" {
deploymentNode "Docker Compose" "Local development environment" "Docker" {
deploymentNode "API Layer" "Gateway and API services" "Docker containers" {
containerInstance kong
containerInstance postgrest
containerInstance gotrue
containerInstance pgMeta
}
deploymentNode "Realtime & Functions" "Event-driven services" "Docker containers" {
containerInstance realtime
containerInstance edgeRuntime
}
deploymentNode "Storage" "File storage services" "Docker containers" {
containerInstance storageApi
containerInstance imgproxy
}
deploymentNode "Database" "PostgreSQL and connection pooling" "Docker containers" {
containerInstance postgres
containerInstance supavisor
}
deploymentNode "Observability" "Logging infrastructure" "Docker containers" {
containerInstance logflare
containerInstance vector
}
}
}
// Deployment: Production (Vercel + Cloud)
deploymentEnvironment "Production" {
deploymentNode "Vercel" "Frontend hosting" "Vercel" {
containerInstance studio
containerInstance www
containerInstance docs
containerInstance cms
}
deploymentNode "Cloud Infrastructure" "Backend services" "AWS / Fly.io" {
deploymentNode "API Tier" "Stateless API services" "Containers" {
containerInstance kong
containerInstance postgrest
containerInstance gotrue
containerInstance pgMeta
containerInstance storageApi
containerInstance edgeRuntime
containerInstance imgproxy
}
deploymentNode "Stateful Tier" "Database and event services" "Managed Services" {
containerInstance postgres
containerInstance supavisor
containerInstance realtime
containerInstance logflare
containerInstance vector
}
}
}
}
views {
// Level 1: System Context
systemContext supabase "SystemContext" "System Context diagram showing Supabase and its external dependencies" {
include *
autoLayout
}
// Level 2: Container
container supabase "Containers" "Container diagram showing the internal architecture of the Supabase platform" {
include *
autoLayout
}
// Level 3: Deployment — Local
deployment supabase "Local Development" "LocalDeployment" "Local development deployment using Docker Compose" {
include *
autoLayout
}
// Level 3: Deployment — Production
deployment supabase "Production" "ProductionDeployment" "Production deployment on Vercel and cloud infrastructure" {
include *
autoLayout
}
// Dynamic: API Request Flow
dynamic supabase "APIRequestFlow" "Shows how a client API request flows through the system" {
developer -> kong "Sends API request with JWT"
kong -> gotrue "Validates JWT token"
kong -> postgrest "Forwards authenticated request"
postgrest -> postgres "Executes query with RLS"
autoLayout
}
// Dynamic: Auth Flow
dynamic supabase "AuthFlow" "Shows the authentication flow" {
endUser -> kong "Signs in via client library"
kong -> gotrue "Forwards auth request"
gotrue -> oauthProviders "Redirects to OAuth provider"
gotrue -> postgres "Creates/updates user session"
autoLayout
}
// Dynamic: Realtime Flow
dynamic supabase "RealtimeFlow" "Shows how realtime subscriptions work" {
developer -> kong "Opens WebSocket connection"
kong -> realtime "Establishes subscription"
realtime -> postgres "Listens to WAL changes"
autoLayout
}
styles {
element "Person" {
shape Person
background #3ECF8E
color #ffffff
}
element "Software System" {
background #1C1C1C
color #ffffff
}
element "Container" {
background #2B825B
color #ffffff
}
element "Database" {
shape Cylinder
}
element "WebBrowser" {
shape WebBrowser
}
element "External" {
background #666666
color #ffffff
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment