Home

Awesome

vite-tinybase-ts-react-sync

This is a Vite template for a simple TinyBase app, using TypeScript and React, demonstrating the TinyBase ui-react-dom module UI components, and also synchronizing between disparate browser windows.

<img width="847" alt="image" src="https://github.com/user-attachments/assets/c63f2789-94dd-4fd3-a5eb-e929c7b4897c">

Instructions

  1. Make a copy of this template into a new directory:
npx tiged tinyplex/vite-tinybase-ts-react-sync my-tinybase-app
  1. Go into the client directory:
cd my-tinybase-app/client
  1. Install the dependencies:
npm install
  1. Run the application:
npm run dev
  1. Go the URL shown and enjoy!

Run your own server

This template uses a lightweight socket server on vite.tinybase.org to synchronize data between clients. This is fine for a demo but not intended as a production server for your apps!

If you wish to run your own instance, see the server directory and start from there.

The vite.tinybase.org server is hosted on fly.io and so if you choose to use that, you can reuse the docker and fly configurations in the server directory. Just remember to update them to match your machines and required configuration.

You will also have to have your client communicate with the new server by configuring the SERVER constant at the top of the client's App.tsx file.

Other templates

There are eleven templates for TinyBase, of which this is one:

TemplateLanguageReactPlus
vite-tinybaseJavaScriptNo
vite-tinybase-tsTypeScriptNo
vite-tinybase-reactJavaScriptYes
vite-tinybase-ts-reactTypeScriptYes
👉vite-tinybase-ts-react-syncTypeScriptYesSynchronization
vite-tinybase-ts-react-sync-durable-objectTypeScriptYesSync & Durable Objects
vite-tinybase-ts-react-pgliteTypeScriptYesPGlite
vite-tinybase-ts-react-crsqliteTypeScriptYesCR-SQLite
tinybase-ts-react-partykitTypeScriptYesPartyKit
tinybase-ts-react-electricsqlTypeScriptYesElectricSQL
expo/examples/with-tinybaseJavaScriptYesReact Native & Expo

License

This template has no license, and so you can use it however you want! TinyBase and Vite themselves are both MIT licensed.