Coder Social home page Coder Social logo

jmcmahon443 / sqlsync-react-example Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 57 KB

Example of React client with SQLSync

Home Page: https://github.com/orbitinghail/sqlsync

License: Apache License 2.0

JavaScript 5.18% HTML 1.69% TypeScript 79.85% Just 3.51% Rust 9.77%

sqlsync-react-example's Introduction

SQLSync React example

These are instructions for implementing the example React client with SQLSync by orbitinghail.

YouTube tutorial video

Build SQLSync

  • 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

Build SQLSync React example

  • Clone this repo alongside SQLSync: git clone https://github.com/jmcmahon443/sqlsync-react-example
├── sqlsync/
└── sqlsync-react-example/

Local

  • Deploy backend using pnpm dev from sqlsync/demo/cloudflare-backend/
  • Build and upload reducer to local backend using just upload-reducer from sqlsync-react-example/
  • Build and deploy frontend using pnpm i; pnpm dev from sqlsync-react-example/frontend/

Remote

These are instructions for deploying to Cloudflare.

Backend

  • Manually update name and bucket_name in wrangler.toml in sqlsync/demo/cloudflare-backend/ to match the intended Cloudflare Worker name and R2 Bucket name.
  • Manually update SQLSYNC_PROD_URL in justfile in sqlsync-react-example/ to intended Cloudflare Worker URL
  • Deploy backend using npx wrangler deploy from sqlsync/demo/cloudflare-backend/
  • Upload reducer to remote backend using just upload-reducer remote from sqlsync-react-example/

Frontend

  • Manually update COORDINATOR_URL in main.tsx in sqlsync-react-example/demo/frontend/ to intended Cloudflare Worker URL
  • Build the frontend distribution using npx vite build from sqlsync-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

sqlsync-react-example's People

Contributors

jmcmahon443 avatar

Stargazers

Daniel Giljam avatar Carl Sverre avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.