Wiring Supabase Realtime and Postgres Into a Self-Updating Team Dashboard Without External Services
Match each data type to a Realtime mode and let triggers do the math.

Analytics for Supabase teams can run entirely inside Supabase when the goal is a self-updating operational dashboard. The architecture uses Realtime modes matched to each kind of data and Postgres triggers that pre-aggregate metrics into a stats table. Clients subscribe to those prepared results instead of working out totals from raw events, so the dashboard stays fast without a separate WebSocket server, Redis pub/sub, or notification pipeline.
How do you get a self-updating dashboard inside Supabase without external services?
A developer estimating a live operations view could historically budget two weeks, with one week for the Node.js/Socket.io/Redis stack and another for client integration and error handling. Supabase takes the place of that stack with one managed dependency. The integration work does not disappear entirely. Instead, the architectural task shifts from assembling a messaging system to deciding which data belongs on which transport.
Supabase Realtime documentation describes three modes sharing a WebSocket connection, namely Postgres Changes, Broadcast, and Presence. These are distinct tools. Postgres Changes follows persistent database changes, Broadcast distributes transient messages, and Presence tracks online participation. That distinction lets a team keep the dashboard within Supabase without forcing every interaction through Postgres.
The three Realtime modes and which one handles which kind of dashboard data

Postgres Changes is the mode for persistent data whose authoritative state lives in Postgres. It delivers changes through the write-ahead log, or WAL, with events arriving in under 200ms at low write volume. A delivery status feed is a canonical use case. So is a subscription to a stats row containing package counts, because those numbers represent durable business state.
Broadcast is the mode for ephemeral, fire-and-forget signals, with latency under 50ms. Its canonical uses include cursor positions, typing indicators, driver location pings, and Kanban card drag previews. These messages do not need to reach the database, so they add no storage cost or WAL pressure. History is irrelevant to this traffic class. Broadcast fits when the latest value replaces the previous one and consumers do not need durable delivery guarantees.
Presence is the mode for collaborative awareness, including who is online, who is viewing the dashboard, and room occupancy. Its data synchronization model is eventually consistent. It handles joins and departures as clients connect or drop off, without heartbeat endpoints or backend logic. An exact business-critical headcount needs a different foundation. Each mode has its uses, but teams often go wrong by using Postgres Changes for transient signals or Broadcast for records that need durability.
Why subscribing raw events to a dashboard panel breaks under load, and what to do instead
Choosing the correct mode does not settle how much data a panel should receive. A status feed may legitimately display individual changes, while a total-count panel needs only the current aggregate. Sending raw events to both makes them do more work than they need to. A dashboard that repeatedly runs COUNT or SUM across full source tables on every load has an aggregation problem that indexing alone will not resolve as it grows.
At low write volume, Postgres Changes can deliver events in under 200ms. Load tests simulating hundreds of writes per second push delays into perceptible territory as the WAL backlog grows. Moving the arithmetic into the client does not solve this. Recalculating aggregates on every event gives the application more work to coordinate, and two events that update the same counter at the same time can leave it in an inconsistent state without a lock.
The corrective discipline is to maintain counters on write or refresh a materialized view on a schedule. Either approach moves aggregation away from dashboard loads and individual client events. The freshness requirement determines which approach fits. For metrics that should change with the underlying transaction, a trigger-maintained stats table provides the direct path from a durable source change to a prepared dashboard value.
The stats-table pattern: pre-aggregating metrics so the WebSocket layer carries signal, not noise
A dedicated stats table gives each metric a defined aggregate state that clients can read without inspecting source records. In the delivery example, delivery_stats has the current package counts. A Postgres trigger on the source table updates that stats row whenever a qualifying status changes. The client subscribes to the stats table through Postgres Changes.
The trigger is the aggregation engine here. It maintains the numbers atomically in the database rather than asking separate clients to reconcile concurrent events. The subscription then distributes the computed result. This removes application-level aggregation and the counter races that come with it, while avoiding the raw-event delivery burden of subscribing an aggregate panel to a high-write source table.
The distinction is between computing a metric and transporting it. The database performs the calculation on the write path, and the WebSocket connection delivers the resulting state. Source writes still exist in Postgres. What changes is the dashboard’s subscription target, so the client receives a single row with pre-computed numbers rather than a stream of raw events to aggregate in client-side code.
Applying the three-mode split to a real dashboard: the logistics dispatcher case
The logistics dispatcher dashboard brings the split into one operational view. Its delivery status feed used Postgres Changes on deliveries to follow UPDATE events for status changes. At normal peak write rates of 2–3 writes per second, updates arrived within 200ms. This panel needed the individual operational changes.
The package-count panel had a different requirement despite drawing from the same underlying deliveries. Counts for packages in transit, delivered today, and failed today lived in delivery_stats, maintained by a trigger. No application-level aggregation was needed for that panel. For the other panels, Broadcast fits driver location pings, and Presence fits dispatcher awareness. Together, these roles form a template for four panels without making each one a database event feed.
Row Level Security introduced an important integration constraint. Postgres Changes delivers events and their row data only when RLS policies allow the subscribing user to see the changed row. Without the appropriate policy, the event is silently suppressed. The dispatcher team had to add an RLS policy for dispatchers before full row data came through. WebSocket authorization was therefore not a separate security system, but an extension of the database’s visibility rules.
Connection limits, plan tiers, and when the managed service stops being enough

Each browser tab opens a separate WebSocket connection, so the number of people on a team is not a sufficient estimate. The dispatcher example reached 240 connections from 40 dispatchers and 200 driver apps at peak. That exceeded the Free plan’s limit of 200 concurrent Realtime connections. Expected connections need to be counted before launch.
The Pro plan at $25/month allows 500 concurrent connections. Pro with Compute 2XL, which provides 8 vCPU / 32 GB, supports roughly 2,000–3,000 concurrent connections. Pro without a spend cap or the Team plan allows 10,000 concurrent connections. Database capacity is a separate dimension here. The 32 vCPU / 128 GB compute tier is called 8XL and governs database connections.
Leaked channels are the leading cause of reaching connection limits in production. Subscriptions without cleanup on component unmount accumulate silently, so subscription lifecycle management belongs in capacity planning. Tables with a high write rate can build up a WAL backlog even when connection usage is low, which is another reason to keep transient traffic off database subscriptions.
The managed service is enough for most team dashboards. Teams that need more than its tiers offer can negotiate a team plan, self-host Realtime, or send high-frequency ephemeral traffic to a service built for it. Self-hosting changes the operational responsibility substantially because it requires tuning Elixir nodes, optimizing replication slots, and configuring load balancers for WebSocket upgrades.
What to instrument from day one so dashboard data stays trustworthy as the project scales
The stats-table pattern cuts repeated work, but teams still need to watch its write path. A dashboard can stay connected and show stale metrics if the process that keeps them up to date fails and no error signal reaches the display. Connectivity alone is not evidence of freshness. Instrumenting the trigger-maintained path connects infrastructure monitoring to the correctness of the numbers people actually use.
At the database level, active connections show pressure on the available pool. Average query time and slow queries above one second expose expensive aggregation before it becomes a dashboard symptom. Database size and index hit rate help show what is going on, especially when index misses make COUNT slow. These measurements tell teams different things than Realtime connection counts do. Keeping those categories distinct avoids treating database saturation and WebSocket usage as the same constraint.
In the application, API response times and error rates show whether users can get data reliably. Realtime connection count is the main sign of leaked channels, and the application measurements also include storage bandwidth and Auth requests per minute. These should be instrumented from day one. Deferring observability leaves teams discovering faults under load, when the gap between a working prototype and an unreliable service can be shorter than a sprint cycle.
Why agents querying this dashboard data need a governed copy, not a direct production connection
The prepared metrics that serve a human dashboard can also become inputs to agents making operational decisions. That does not make direct agent access to production safe. The stats table solves aggregation and leaves consumer isolation unresolved. Agent query traffic can compete with transactional work for a finite Postgres connection pool, even when the queries read pre-computed numbers.
An agent using a shared service account may inherit broader access than the person requesting the analysis. The production database role is therefore an insufficient proxy for the user’s authority. Sentinel agent research shows where traditional role-based access control falls short for dynamic agents that may need permissions for a short time. Least privilege has to be enforced at the access layer rather than assumed from the credentials used to connect.
For this architecture, the practical boundary is explicit. Agents should never write directly to production, and their reads should pass through a governed copy with auditable permissions. Modeling the metrics ahead of time and giving agents that copy keeps their workloads off the production connection pool. OAuth or SAML identity passthrough should authenticate the agent as the end user instead of relying on a blanket service-account grant. The governed access layer can then enforce that user’s permitted scope rather than granting the agent an independent, broader identity.
How a single governed data layer serves both the dashboard and every agent that queries it
Once humans and agents consume the same metrics, the unit of analytics is a pre-modeled, pre-calculated dataset. The Data Substrate provides verified, permissioned, refreshable data with documented provenance. Supabase Postgres remains the ground truth, and the stats table is the first governed layer above it. This establishes where a number originates.
The Reasoning Layer adds semantic schemas, governed metric definitions, and the business logic behind those numbers. Its purpose is to make ARR mean the same thing to the sales dashboard, an agent’s weekly summary, and the finance report. A shared table alone does not define that meaning. The Delivery Layer then makes those governed metrics reachable, historically through a BI portal and increasingly through an MCP endpoint that agents can query.
The MCP specification’s 2026 move to a stateless protocol core reduces the operational burden of that delivery path. Requests can reach any server instance behind a plain round-robin load balancer without sticky sessions or a shared session store. This simplifies distribution, while access rules for the dataset still need to be enforced on their own because production RLS does not automatically follow records into an analytical copy.
The Decision Layer identifies the owner and outcome of an action, whether the actor is a person or an agent. That action should be auditable back to the governed definition that produced the number. Separate metric calculations would break that common reference. The stats-table pattern supplies a single calculation, while the MCP layer supplies a single agent access path, freeing sales, finance, and product from reconciling competing totals so they can use their time deciding what to do.


