
Electric SQL Has a Free API You're Not Using
Electric SQL syncs PostgreSQL data to local SQLite in real-time. Your app works offline, syncs when connected, and resolves conflicts automatically. The Free APIs You're Missing 1. Shape Streams — Real-Time Partial Replication import { ShapeStream , Shape } from " @electric-sql/client " ; const stream = new ShapeStream ({ url : " http://localhost:3000/v1/shape " , params : { table : " posts " , where : " published = true " , columns : [ " id " , " title " , " content " , " author_id " ], }, }); const shape = new Shape ( stream ); shape . subscribe (({ rows }) => { console . log ( " Current data: " , rows ); // Automatically updates when PostgreSQL data changes! }); 2. React Integration — useShape Hook import { useShape } from " @electric-sql/react " ; function PostList () { const { data : posts , isLoading } = useShape ({ url : " http://localhost:3000/v1/shape " , params : { table : " posts " , where : " published = true " }, }); if ( isLoading ) return < Spinner />; return posts . map
Continue reading on Dev.to React
Opens in a new tab


