pg_reactive Examples

12 live applications showing real-time SQL subscriptions — from simple filters to an interactive tutorial console.

1
Live Product Catalog
Basic
Real-time product grid filtered by category. Cards animate in and out as you INSERT, UPDATE, or DELETE products in psql.
SELECT ... FROM products WHERE category = 'electronics'
2
Order Feed
Intermediate
Live order feed with customer and product names resolved via 3-table JOIN. Changing a customer name updates all their orders instantly.
SELECT ... FROM orders JOIN customers JOIN products
3
Revenue Dashboard
Advanced
Animated bar chart of revenue per customer using LEFT JOIN + GROUP BY + SUM. Bars grow in real-time as orders are placed.
SELECT ... COALESCE(SUM(total), 0) ... GROUP BY customer
4
Category Leaderboard
Expert
Two simultaneous subscriptions: HAVING-filtered categories and RANK() window function product rankings. Categories appear/disappear as averages cross the threshold.
HAVING AVG(price) > 50  +  RANK() OVER (PARTITION BY ...)
5
Real-Time CRM Dashboard
Full-Stack
Three live queries: CTE-based top customers, LIMIT-constrained recent orders, and regional revenue rollup. A single INSERT updates all three panels simultaneously.
WITH cte AS (...)  +  LIMIT 10  +  GROUP BY region
6
Inventory Monitor
Intermediate
Stock-level dashboard with color-coded alerts. Uses CASE expressions to classify inventory status and JOIN to combine product and stock data.
CASE WHEN stock_qty <= 0 THEN 'out_of_stock' ... END
7
Multi-Filter Dashboard
Advanced
Three simultaneous subscriptions on the same table with different WHERE filters. Products visually "jump" between price tiers as prices change.
WHERE price < 50  +  WHERE price >= 50 AND < 200  +  WHERE price >= 200
8
Order Analytics
Advanced
Time-series chart of orders bucketed by hour. Uses date_trunc for temporal grouping with live-updating bar heights as new orders arrive.
GROUP BY date_trunc('hour', created_at)
9
Price Comparison
Expert
Rich comparison matrix with four window functions: overall rank, quartile placement, ratio to average, and percentage of max price. Rankings shift live.
RANK() + NTILE(4) + price/AVG() OVER () + price/MAX() OVER ()
10
Executive Scorecard
Full-Stack
Single-row aggregate KPI dashboard with 6 computed metrics. Every order updates all cards simultaneously: revenue, customers, avg value, and more.
COUNT(DISTINCT ...) + SUM/AVG + NULLIF ratio
11
Notify Mode vs Delta Mode
New
Side-by-side comparison of notify mode (lightweight invalidation) vs delta mode (full row diffs). Watch the byte difference — notify sends ~50B per event vs hundreds for deltas.
pgr.subscribe('q', 'SELECT ...', 'notify')
12
Interactive Tutorial Console
Tutorial
15-step walkthrough of every pg_reactive feature: subscribe, INSERT/UPDATE/DELETE deltas, JOINs, aggregates, window functions, notify mode, and introspection. Copy-paste SQL into psql and follow along.
Step 1/15 → Step 2/15 → ... → Feature Summary

Live demos — just click a card above

These examples run against this deployment's backend. To run the full stack on your own machine instead (the 127.0.0.1:3000 below is a LOCAL dev URL, not this site):

cd examples
docker compose up --build

# Open http://127.0.0.1:3000 in your browser (local dev only)
# Then run demo SQL commands in psql:
docker compose exec db psql -U postgres -d pg_reactive_test