A Vite/React demonstration app showcasing SQLite Sync (Dev) implementation for offline-first data synchronization across multiple devices. This example illustrates how to integrate SQLite AI's sync capabilities into modern web applications with proper authentication via Access Token and Row-Level Security (RLS).
This app uses the packed WASM version of SQLite with the SQLite Sync extension enabled.
The source code is located in examples/sport-tracker-app
- Node.js 20.x or >=22.12.0
- Create database
- Execute the schema with sport-tracker-schema-postgres.sql.
- Enable CloudSync for all tables on the remote database with:
CREATE EXTENSION IF NOT EXISTS cloudsync; SELECT cloudsync_init('users_sport'); SELECT cloudsync_init('workouts'); SELECT cloudsync_init('activities');
Rename the .env.example into .env and fill with your values.
VITE_SQLITECLOUD_CONNECTION_STRING: the url to the CloudSync server: https://cloudsync-staging.fly.dev/VITE_SQLITECLOUD_DATABASE: remote database name.VITE_SQLITECLOUD_API_KEY: a valid user's JWT token. Refresh it when it expires.VITE_SQLITECLOUD_API_URL: Supabase project API URL.
npm install
npm run devContinue reading on the official README.