Skip to main content

React Quickstart

Get a SpacetimeDB React app running in under 5 minutes.

Prerequisites


Create your project

Run the spacetime dev command to create a new project with a SpacetimeDB module and React client.

This will start the local SpacetimeDB server, publish your module, generate TypeScript bindings, and start the React development server.

spacetime dev --template basic-react my-spacetime-app
Open your app

Navigate to http://localhost:5173 to see your app running.

The template includes a basic React app connected to SpacetimeDB.

Explore the project structure

Your project contains both server and client code.

Edit spacetimedb/src/index.ts to add tables and reducers. Edit client/src/App.tsx to build your UI.

my-spacetime-app/
├── spacetimedb/ # Your SpacetimeDB module
│ └── src/
│ └── index.ts # Server-side logic
├── client/ # React frontend
│ └── src/
│ ├── App.tsx
│ └── module_bindings/ # Auto-generated types
└── package.json

Next steps