Supabase Architecture Diagram: Database, Auth, Storage & Realtime (2026)
How to create Supabase architecture diagrams covering PostgreSQL, Auth, Storage, Realtime, and Edge Functions. Includes prompt templates and common patterns for AI-generated diagrams.
Supabase architecture diagrams visualize the full backend platform that many modern applications are built on — from the PostgreSQL database layer and Row Level Security policies to Auth providers, object Storage, Realtime subscriptions, and Edge Functions. Supabase's architecture is deceptively complex: under the hood, a single Supabase project comprises PostgreSQL, PostgREST, GoTrue (auth), Realtime (Elixir Phoenix), Storage API, and a Kong API gateway — all running together and communicating through well-defined interfaces.
A clear Supabase architecture diagram helps teams understand data flows, security boundaries (especially RLS policies), and where each part of their stack lives — whether they're self-hosting on Kubernetes or using Supabase Cloud.
Core components of a Supabase architecture diagram
- PostgreSQL database: The heart of every Supabase project — show the database instance, its logical schemas (public, auth, storage, realtime), extensions like pgvector and pg_cron, and any logical replication slots used by the Realtime server
- PostgREST (auto-generated REST API): The layer that automatically exposes your PostgreSQL schema as a RESTful API. Client libraries use this under the hood for all
.from(),.select(), and.insert()calls; show it as the primary CRUD interface between the client and the database - GoTrue (Auth service): Handles user registration, login (email/password, magic link, OAuth providers), JWT issuance, and session management. Show the providers (Google, GitHub, Apple, etc.) connecting into GoTrue, which then issues JWTs used by PostgREST to enforce RLS
- Row Level Security (RLS) policies: PostgreSQL RLS policies that gate data access based on
auth.uid()andauth.role()from the JWT. Annotate your tables with the RLS policies that protect them — this is critical for security review diagrams - Supabase Storage: Object storage (backed by S3-compatible storage) with a PostgreSQL metadata layer for bucket and object permissions. Storage also uses RLS policies for fine-grained access control
- Realtime server: An Elixir Phoenix server that subscribes to PostgreSQL logical replication and broadcasts row-level change events (INSERT, UPDATE, DELETE) to subscribed WebSocket clients. Show which tables publish changes and which clients subscribe
- Edge Functions: Deno-based serverless functions deployed globally at Supabase's edge. Show which functions call external APIs, write to the database, or perform tasks that can't run in the browser (Stripe webhooks, email sending, background jobs)
- Kong API gateway: The API gateway that routes requests to PostgREST, GoTrue, Storage, or Realtime based on the path prefix. The Supabase client SDK transparently uses the correct path for each service type
Common Supabase architecture patterns
Full-stack SaaS with multi-tenancy
The most common Supabase pattern: a Next.js or React frontend uses the Supabase JS client to authenticate users, query data via PostgREST, and listen for real-time updates. Each user belongs to an organization (tenant), and all tables have RLS policies that filter by organization_id. Edge Functions handle Stripe webhook processing and transactional emails. The architecture diagram should show the client, the Kong gateway, the four main services (Auth, PostgREST, Realtime, Storage), the PostgreSQL database, and the RLS policy layer between PostgREST and the database.
AI application with pgvector
Supabase's pgvector extension makes it a natural fit for AI applications that need vector search alongside relational data. In this pattern, embeddings are stored in a documents table with a vector(1536) column. An Edge Function accepts user queries, calls an embedding API (OpenAI, Cohere, or a self-hosted model), then runs match_documents() — a PostgreSQL function that uses pgvector's cosine similarity operator — to retrieve the most relevant chunks. Results are passed to an LLM for generation. The diagram shows the user query → Edge Function → embedding API → pgvector similarity search → LLM → response flow.
Self-hosted Supabase on Kubernetes
Teams with data residency or compliance requirements self-host Supabase on Kubernetes. The architecture diagram shows the Helm chart components: a PostgreSQL StatefulSet (or CloudNativePG operator), PostgREST Deployment, GoTrue Deployment, Realtime Deployment, Storage API Deployment, Kong Deployment, and the Supabase Studio Deployment. An Ingress or API Gateway routes external traffic to Kong. A persistent volume claim backs the PostgreSQL data directory. This diagram is essential for infrastructure review and DR planning.
Prompt examples for Supabase diagrams
Multi-tenant SaaS backend
RAG pipeline with pgvector
Realtime collaborative app
Supabase vs other BaaS platforms
| Platform | Database | Auth | Self-hostable |
|---|---|---|---|
| Supabase | PostgreSQL (full SQL, pgvector, RLS) | GoTrue — email, OAuth, magic link, phone | Yes (Docker, Kubernetes) |
| Firebase | Firestore (NoSQL document store) | Firebase Auth — email, OAuth, phone | No (Google Cloud only) |
| Appwrite | MariaDB with document abstraction | Built-in — email, OAuth, magic link | Yes (Docker) |
| PocketBase | SQLite (single file) | Built-in — email + OAuth | Yes (single binary) |
| Neon | PostgreSQL (serverless, branching) | None (DB only) | No |
What to annotate on a Supabase diagram
- RLS policies per table: Label each table with whether RLS is enabled and the type of policy (owner-only, organization-scoped, public-read). This is the most important security annotation on a Supabase diagram
- JWT role in each request path: Show whether requests flow through the
anonkey (unauthenticated) or theservice_rolekey (bypasses RLS) — mixing these accidentally is the most common Supabase security mistake - Edge Function triggers: Label what invokes each Edge Function — HTTP request, database webhook, cron schedule, or Stripe event
- Realtime channel types: Distinguish Postgres Changes (DB-driven), Broadcast (ephemeral client-to-client), and Presence (online status) — they have different latency and persistence characteristics
- Storage bucket policies: Note whether each bucket is public or private, and whether access is controlled by RLS or bucket-level policies
Related guides: authentication architecture diagrams, vector database architecture, RAG architecture diagrams, and database architecture use cases.
Ready to try it yourself?
Start Creating - Free