spacetime dev
This guide covers how to create a new SpacetimeDB database module project.
Prerequisites
First, install the SpacetimeDB CLI.
Interactive Development with spacetime dev
The fastest way to get started developing a database module is with spacetime dev. This interactive command guides you through creating a new SpacetimeDB project with hot-reloading - whenever you save changes to your module code, SpacetimeDB automatically rebuilds and republishes your module.
spacetime dev is currently an unstable command and may change in the future.
Getting Started
Run the command from your terminal:
spacetime dev
First Time Setup
If no SpacetimeDB project is found in the current directory, you'll be guided through creating a new one:
Step 1: Project Name
Enter a name for your project (e.g., my-project)
Step 2: Project Path
Choose where to create the project files (defaults to ./<project-name>)
Step 3: Select a Client Type Choose how you want to develop:
- React - React web app with TypeScript server (recommended for web apps)
- Use Template - Choose from built-in templates or clone from GitHub
- None - Server module only
Existing Projects
If you run spacetime dev in a directory with an existing SpacetimeDB project (containing a spacetimedb/ directory), it will skip setup and enter development mode directly, connecting to your database and watching for file changes.
Client Type Options
React
Creates a full-stack React web application with:
- TypeScript server module
- React frontend with SpacetimeDB client SDK
- Pre-configured hot-reloading for both client and server
Use Template
Choose from several built-in templates:
basic-ts- Basic TypeScript client and server stubsbasic-cs- Basic C# client and server stubsbasic-rs- Basic Rust client and server stubsbasic-cpp- Basic C++ server stubsreact-ts- React web app with TypeScript serverchat-console-rs- Complete Rust chat implementationchat-console-cs- Complete C# chat implementationchat-react-ts- Complete TypeScript chat implementation
You can also clone an existing project by entering a GitHub repository (owner/repo) or git URL.