Skip to content

Conversation

@clockwork-tien
Copy link
Contributor

@clockwork-tien clockwork-tien commented Jan 29, 2026

Description of Changes

The PR implements the following updates:

  • Create a quickstart guide and client support for using SpacetimeDB directly in browser with script tags
  • A template to easily work with/test the implementation and get started with script tags

The bundle is served via https://unpkg.com/spacetimedb@latest/dist/browser.bundle.js, which only works after the package is published to npm, therefore to test locally we can use the browser-ts template and local bundle:

  1. Build local bundle
cd crates/bindings-typescript
pnpm install
pnpm build
  1. Use local bundle built in templateindex.html (swap the URL from unpkg)
- <script src="https://unpkg.com/spacetimedb@latest/dist/browser.bundle.js"></script>
+ <script src="../../crates/bindings-typescript/dist/browser.bundle.js"></script>
  1. Open browser-ts/index.html directly in browser along with spacetime start + publish the module spacetime publish --project-path spacetimedb browser-ts

Screenshots

image image

API and ABI breaking changes

Expected complexity level and risk

Testing

@clockwork-tien clockwork-tien marked this pull request as ready for review January 29, 2026 14:36
@clockwork-tien clockwork-tien force-pushed the tien/feat/js-script-tags branch from 63a4d9c to c07dfef Compare January 29, 2026 15:52
cloutiertyler and others added 3 commits January 30, 2026 09:39
Remove the custom Client class that used JSON protocol and HTTP for
reducer calls. Instead, use the standard DbConnection with code
generation, which uses BSATN binary protocol over WebSocket.

The browser-ts template now:
- Uses spacetime generate for TypeScript bindings
- Bundles bindings with vite into an IIFE
- Loads the bundle in index.html with inline JavaScript
@clockwork-tien
Copy link
Contributor Author

@cloutiertyler Thank you, I have applied the changes from #4167, merged/resolved conflicts and did a minor template description update. The PR is ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants