ElectricSQL Real-time Operations Dashboard
This guide shows how to set up ElectricSQL for real-time reactive views of the operations framework.Overview
ElectricSQL provides:- Real-time sync: Changes in PostgreSQL instantly appear in connected clients
- Reactive queries: UI updates automatically when data changes
- Offline support: Works offline and syncs when reconnected
- Type-safe: Full TypeScript support with generated types
Architecture
Setup Steps
1. Start Services
2. Run Electric Migration
3. Verify Electric is Running
4. Open the Dashboard
Using Electric in Your Application
React Example
Vanilla JavaScript Example
TypeScript with Generated Types
Real-time Features
1. Live Operation Status
2. Action Progress Tracking
3. Live Notifications
Performance Optimization
1. Filtered Syncs
Only sync data you need:2. Indexed Queries
The migration creates indexes for efficient queries:3. Materialized Views
For complex aggregations, use materialized views:Troubleshooting
Electric Not Connecting
Tables Not Syncing
CORS Issues
If opening HTML directly in browser, use http-server:Advanced: Custom Sync Logic
Server-side Electric Integration
Webhook → Database → Electric → UI Flow
Resources
Next Steps
- ✅ Start Electric with docker-compose
- ✅ Run migration to enable tables
- ✅ Open dashboard to see real-time updates
- 🔄 Run webhook test and watch operations update live!
- 🚀 Build your own React/Vue dashboard with Electric hooks