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 devfromsqlsync/demo/cloudflare-backend/ - Build and upload reducer to local backend using
just upload-reducerfromsqlsync-react-example/ - Build and deploy frontend using
pnpm i; pnpm devfromsqlsync-react-example/frontend/
These are instructions for deploying to Cloudflare.
- Manually update
nameandbucket_nameinwrangler.tomlinsqlsync/demo/cloudflare-backend/to match the intended Cloudflare Worker name and R2 Bucket name. - Manually update
SQLSYNC_PROD_URLinjustfileinsqlsync-react-example/to intended Cloudflare Worker URL - Deploy backend using
npx wrangler deployfromsqlsync/demo/cloudflare-backend/ - Upload reducer to remote backend using
just upload-reducer remotefromsqlsync-react-example/
- Manually update
COORDINATOR_URLinmain.tsxinsqlsync-react-example/demo/frontend/to intended Cloudflare Worker URL - Build the frontend distribution using
npx vite buildfromsqlsync-react-example/frontend/ - Double check
.wasmfiles are under 25MB (for example, should be 2MB compared to 60MB) - Manually upload
sqlsync-react-example/frontend/dist/to Cloudflare Pages