These are instructions for implementing the example React client with SQLSync by orbitinghail.
- Clone SQLSync:
git clone https://github.com/orbitinghail/sqlsync
- Run the commands below one at a time:
cd sqlsync
just build
just run-with-prefix 'wasm-'
cd sqlsync/lib/sqlsync-worker
pnpm install @rollup/plugin-node-resolve
cd sqlsync
just package-sqlsync-worker dev
cd sqlsync/demo/cloudflare-backend
pnpm i
- Clone this repo alongside SQLSync:
git clone https://github.com/jmcmahon443/sqlsync-react-example
├── sqlsync/
└── sqlsync-react-example/
- Deploy backend using
pnpm dev
fromsqlsync/demo/cloudflare-backend/
- Build and upload reducer to local backend using
just upload-reducer
fromsqlsync-react-example/
- Build and deploy frontend using
pnpm i; pnpm dev
fromsqlsync-react-example/frontend/
These are instructions for deploying to Cloudflare.
- Manually update
name
andbucket_name
inwrangler.toml
insqlsync/demo/cloudflare-backend/
to match the intended Cloudflare Worker name and R2 Bucket name. - Manually update
SQLSYNC_PROD_URL
injustfile
insqlsync-react-example/
to intended Cloudflare Worker URL - Deploy backend using
npx wrangler deploy
fromsqlsync/demo/cloudflare-backend/
- Upload reducer to remote backend using
just upload-reducer remote
fromsqlsync-react-example/
- Manually update
COORDINATOR_URL
inmain.tsx
insqlsync-react-example/demo/frontend/
to intended Cloudflare Worker URL - Build the frontend distribution using
npx vite build
fromsqlsync-react-example/frontend/
- Double check
.wasm
files are under 25MB (for example, should be 2MB compared to 60MB) - Manually upload
sqlsync-react-example/frontend/dist/
to Cloudflare Pages