Skip to content

Conversation

@bradleyshep
Copy link
Contributor

Based on #4097

Description of Changes

Adds a Node.js quickstart template and documentation for SpacetimeDB.

Template (templates/nodejs-ts/)

  • SpacetimeDB module with TypeScript (spacetimedb/src/index.ts)
  • Node.js client with interactive CLI (src/main.ts)
  • File-based token persistence (.spacetimedb-token) instead of localStorage
  • Table change callbacks (onInsert, onDelete)
  • Graceful shutdown handlers for SIGINT/SIGTERM
  • Pre-generated module bindings in src/module_bindings/

Documentation (docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md)

  • Step-by-step quickstart guide following existing pattern
  • Covers project creation with spacetime dev --template nodejs-ts
  • Explains project structure and client code
  • Documents interactive CLI commands (list, hello, <name>)
  • Covers Node.js-specific considerations (WebSocket support, token storage)
  • Documents environment variable configuration (SPACETIMEDB_HOST, SPACETIMEDB_DB_NAME)

Consistency

  • Environment variables follow the same HOST/DB_NAME naming convention as other quickstarts
  • Documentation structure mirrors React and Next.js quickstarts

API and ABI breaking changes

None.

Expected complexity level and risk

1 - Additive change only. New template and documentation, no modifications to existing functionality.

Testing

  • Run spacetime dev --template nodejs-ts and verify project initializes
  • Run npm run dev and verify connection to SpacetimeDB
  • Test adding a person by typing a name
  • Test list command shows all people
  • Test hello command calls reducer (check server logs)
  • Verify token persistence works across restarts
  • Test graceful shutdown with Ctrl+C
  • Check documentation renders correctly

@bradleyshep bradleyshep mentioned this pull request Jan 23, 2026
5 tasks
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.

2 participants