Development at the speed of light
$ npx -y skills add clockworklabs/spacetimedb --agent claude-code
Run the curl in your terminal, the rest in Claude Code.
Repo: clockworklabs/spacetimedb
What's inside
SpacetimeDB is a relational database that is also a server. You upload your application logic directly into the database, and clients connect to it without any server in between.
Write your schema and business logic as a module in Rust, C#, TypeScript, or C++. SpacetimeDB compiles it, runs it inside the database, and automatically synchronizes state to connected clients in real-time.
Instead of deploying a web or game server that sits in between your clients and your database, your clients connect directly to the database and execute your application logic in your module. You can write all of your permission and authorization logic right inside your module just as you would in a normal server.
This means that you can write your entire application in a single language and deploy it as a single binary. No more separate webserver, no more containers, no more Kubernetes, no more VMs, no more DevOps, no more caching later. Zero infrastructure to manage.
SpacetimeDB is optimized for maximum speed and minimum latency. SpacetimeDB provides all the ACID guarantees of a traditional RDBMS, with all the speed of an optimized web server. All application state is held in memory for fast access, while a commit log on disk provides durability and crash recovery. The entire backend of our MMORPG BitCraft Online runs as a single SpacetimeDB module: chat, items, terrain, player positions, everything, synchronized to thousands of players in real-time.
# macOS / Linux
curl -sSf https://install.spacetimedb.com | sh
# Windows (PowerShell)
iwr https://windows.spacetimedb.com -useb | iex
spacetime login
This opens a browser to authenticate with GitHub. Your identity is linked to your account so you can publish databases.
spacetime dev --template chat-react-ts
That is it. This creates a project from a template, publishes it to Maincloud, and watches for file changes, automatically rebuilding and republishing on save. See pricing for details.
SpacetimeDB modules define tables (your data) and reducers (your logic). Clients connect, call reducers, and subscribe to tables. When data changes, SpacetimeDB pushes updates to subscribed clients automatically.
// Define a table
#[spacetimedb::table(accessor = messages, public)]
pub struct Message {
#[primary_key]
#[auto_inc]
id: u64,
sender: Identity,
text: String,
}
// Define a reducer (your API endpoint)
#[spacetimedb::reducer]
pub fn send_message(ctx: &ReducerContext, text: String) {
ctx.db.messages().insert(Message {
id: 0,
sender: ctx.sender,
text,
});
}
On the client side, subscribe and get live updates:
const [messages] = useTable(tables.message);
// messages updates automatically when the server state changes.
// No polling. No refetching.
Write your database logic in any of these languages:
| Language | Quickstart |
|---|---|
| Rust | Get started |
| C# | Get started |
| TypeScript | Get started |
| C++ | Get started |
Connect from any of these platforms:
| SDK | Quickstart |
|---|---|
| TypeScript (React, Next.js, Vue, Svelte, Angular, Node.js, Bun, Deno) | Get started |
| Rust | Get started |
| C# (standalone and Unity) | Get started |
| C++ (Unreal Engine) | Get started |
docker run --rm --pull always -p 3000:3000 clockworklabs/spacetime start
If you need features from master that have not been released yet:
# Prerequisites: Rust toolchain with wasm32-unknown-unknown target
curl https://sh.rustup.rs -sSf | sh
git clone https://github.com/clockworklabs/SpacetimeDB
cd SpacetimeDB
cargo build --locked --release -p spacetimedb-standalone -p spacetimedb-update -p spacetimedb-cli
Then install the binaries:
mkdir -p ~/.local/bin
STDB_VERSION="$(./target/release/spacetimedb-cli --version | sed -n 's/.*spacetimedb tool version \([0-9.]*\);.*/\1/p')"
mkdir -p ~/.local/share/spacetime/bin/$STDB_VERSION
cp target/release/spacetimedb-update ~/.local/bin/spacetime
cp target/release/spacetimedb-cli ~/.local/share/spacetime/bin/$STDB_VERSION
cp target/release/spacetimedb-standalone ~/.local/share/spacetime/bin/$STDB_VERSION
# Add to your shell config if not already present:
export PATH="$HOME/.local/bin:$PATH"
# Set the active version:
spacetime version use $STDB_VERSION
$stdbDir = "$HOME\AppData\Local\SpacetimeDB"
$stdbVersion = & ".\target\release\spacetimedb-cli" --version |
Select-String -Pattern 'spacetimedb tool version ([0-9.]+);' |
ForEach-Object { $_.Matches.Groups[1].Value }
New-Item -ItemType Directory -Path "$stdbDir\bin\$stdbVersion" -Force | Out-Null
Copy-Item "target\release\spacetimedb-update.exe" "$stdbDir\spacetime.exe"
Copy-Item "target\release\spacetimedb-cli.exe" "$stdbDir\bin\$stdbVersion\"
Copy-Item "target\release\spacetimedb-standalone.exe" "$stdbDir\bin\$stdbVersion\"
# Add to your system PATH: %USERPROFILE%\AppData\Local\SpacetimeDB
# Then in a new shell:
spacetime version use $stdbVersion
Verify with spacetime --version.
Full documentation is available at spacetimedb.com/docs, including:
SpacetimeDB is licensed under the Business Source License 1.1 (BSL). It converts to the AGPL v3.0 with a linking exception after a few years. The linking exception means you are not required to open-source your own code if you use SpacetimeDB. You only need to contribute back changes to SpacetimeDB itself.
Why did we choose this license? We chose to license SpacetimeDB under the MariaDB Business Source License for 4 years because we can't compete with AWS while also building our products for them.
We chose GPLv3 with linking exception as the open source license because we want contributions merged back into mainline (just like Linux), but we don't want to make anyone else open source their own code (i.e. linking exception).
.cargo/
config.toml
.dockerignore
.envrc
.gitattributes
.github/
actions/
keynote-bench-setup/
action.yml
setup-pnpm/
action.yml
CODEOWNERS
Dockerfile
GREMLINS.md
pull_request_template.md
workflows/
attach-artifacts.yml
benchmarks.yml
check-merge-labels.yml
check-pr-base.yml
ci.yml
cla-gate.yml
discord-posts.yml
docs-publish.yaml
docs-update-llms.yaml
internal-tests.yml
llm-benchmark-periodic.yml
llm-benchmark-validate-goldens.yml
package.yml
pr_approval_check.yml
release.yml
retry-cla-assistant.yml
rust_matcher.json
tag-release.yml
.gitignore
.npmrc
.prettierignore
.prettierrc
.rustfmt.toml
Cargo.lock
Cargo.toml
clippy.toml
codex-plugin/
.agents/
plugins/
marketplace.json
DEVELOP.md
LICENSE
plugins/
spacetimedb/
.codex-plugin/
plugin.json
.mcp.json
assets/
icon.png
logo.png
LICENSE
skills/
cli/
SKILL.md
concepts/
SKILL.md
cpp-server/
SKILL.md
csharp-client/
SKILL.md
csharp-server/
SKILL.md
mcp/
SKILL.md
rust-server/
SKILL.md
typescript-client/
SKILL.md
typescript-server/
SKILL.md
unity/
SKILL.md
unreal/
SKILL.md
README.md
scripts/
.npmrc
check-skills-sync.ts
package.json
tsconfig.json
crates/
auth/
Cargo.toml
LICENSE
src/
identity.rs
lib.rs
bench/
.gitignore
benches/
callgrind.rs
delete_table.rs
generic.rs
index.rs
special.rs
subscription.rs
callgrind-docker.sh
Cargo.toml
clippy.toml
Dockerfile
flamegraph.sh
hyper_cmp.py
instruments.sh
LICENSE
README.md
src/
bin/
summarize.rs
database.rs
lib.rs
schemas.rs
spacetime_module.rs
spacetime_raw.rs
sqlite.rs
bindings/
bindings-cpp/
.gitignore
ARCHITECTURE.md
CMakeLists.txt
DEVELOP.md
include/
spacetimedb/
spacetimedb.h
abi/
abi.h
FFI.h
opaque_types.h
auth_ctx.h
bsatn/
algebraic_type.h
bsatn.h
DEVELOP.md
primitive_traits.h
reader.h
README.md
result.h
schedule_at_impl.h
schedule_at.h
serialization.h
size_calculator.h
sum_type.h
time_duration.h
timestamp.h
traits.h
type_extensions.h
types_impl.h
types.h
uuid.h
writer.h
client_visibility_filter.h
database.h
enum_macro.h
error_handling.h
handler_context.h
http_client_impl.h
http_convert.h
http_handler_macros.h
http_wire.h
http.h
index_iterator.h
internal/
autogen/
autogen_base.h
AlgebraicType.g.h
CaseConversionPolicy.g.h
ExplicitNameEntry.g.h
ExplicitNames.g.h
FunctionVisibility.g.h
HttpMethod.g.h
IndexType.g.h
Lifecycle.g.h
MethodOrAny.g.h
MiscModuleExport.g.h
NameMapping.g.h
ProductType.g.h
ProductTypeElement.g.h
RawColumnDefaultValueV10.g.h
RawColumnDefaultValueV9.g.h
RawColumnDefV8.g.h
RawConstraintDataV9.g.h
RawConstraintDefV10.g.h
RawConstraintDefV8.g.h
RawConstraintDefV9.g.h
RawHttpHandlerDefV10.g.h
RawHttpRouteDefV10.g.h
RawIndexAlgorithm.g.h
RawIndexDefV10.g.h
RawIndexDefV8.g.h
RawIndexDefV9.g.h
RawLifeCycleReducerDefV10.g.h
RawMiscModuleExportV9.g.h
RawModuleDef.g.h
RawModuleDefV10.g.h
RawModuleDefV10Section.g.h
RawModuleDefV8.g.h
RawModuleDefV9.g.h
RawProcedureDefV10.g.h
RawProcedureDefV9.g.h
RawReducerDefV10.g.h
RawReducerDefV9.g.h
RawRowLevelSecurityDefV9.g.h
RawScheduleDefV10.g.h
RawScheduleDefV9.g.h
RawScopedTypeNameV10.g.h
RawScopedTypeNameV9.g.h
RawSequenceDefV10.g.h
RawSequenceDefV8.g.h
RawSequenceDefV9.g.h
RawSubmoduleV10.g.h
RawTableDefV10.g.h
RawTableDefV8.g.h
RawTableDefV9.g.h
RawTypeDefV10.g.h
RawTypeDefV9.g.h
RawUniqueConstraintDataV9.g.h
RawViewDefV10.g.h
RawViewDefV9.g.h
RawViewPrimaryKeyDefV10.g.h
ReducerDef.g.h
SumType.g.h
SumTypeVariant.g.h
TableAccess.g.h
TableDesc.g.h
TableType.g.h
TypeAlias.g.h
Typespace.g.h
bsatn_adapters.h
buffer_pool.h
debug.h
field_registration.h
forward_declarations.h
Module_impl.h
module_type_registration.h
Module.h
README.md
runtime_registration.h
template_utils.h
tx_execution.h
v10_builder.h
v9_builder.h
jwt_claims.h
logger.h
macros.h
outcome.h
procedure_context.h
procedure_macros.h
query_builder/
query_builder.h
expr.h
join.h
table.h
random.h
range_queries.h
readonly_database_context.h
readonly_field_accessors.h
readonly_table_accessor.h
reducer_context.h
reducer_error.h
reducer_macros.h
router.h
schedule_reducer.h
table_with_constraints.h
table.h
tx_context.h
version.h.in
view_context.h
view_macros.h
LICENSE
QUICKSTART.md
README.md
REFERENCE.md
src/
abi/
module_exports.cpp
wasi_shims.cpp
internal/
AlgebraicType.cpp
module_type_registration.cpp
Module.cpp
v10_builder.cpp
v9_builder.cpp
tests/
client-comparison/
check_tables.py
README.md
run_client_comparison.sh
scripts/
compare_clients.sh
compare_modules.sh
regenerate_cpp_client.sh
regenerate_rust_client.sh
compile/
cases/
http-handlers/
error_http_handler_immutable_ctx.cpp
error_http_handler_no_args.cpp
error_http_handler_no_connection_id.cpp
error_http_handler_no_db.cpp
error_http_handler_no_request_arg.cpp
error_http_handler_no_return_type.cpp
error_http_handler_no_sender.cpp
error_http_handler_wrong_ctx.cpp
error_http_handler_wrong_request_arg_type.cpp
error_http_handler_wrong_return_type.cpp
error_http_router_not_a_function.cpp
error_http_router_with_args.cpp
error_http_router_wrong_return_type.cpp
ok_http_handlers_basic.cpp
CMakeLists.module.txt
README.md
run-compile-tests.ps1
run-compile-tests.sh
main.cpp
module_library_unit_tests.cpp
query-builder-compile/
fail_event_lookup.cpp
fail_implicit_numeric_where_types.cpp
fail_incompatible_join_types.cpp
fail_incompatible_where_types.cpp
fail_indexed_where_public_api.cpp
fail_invalid_join_predicate.cpp
fail_non_index_join.cpp
pass_query_integration.cpp
run_query_builder_compile_tests.sh
query-builder-sql/
CMakeLists.txt
main.cpp
query_builder_sql_tests.cpp
run_query_builder_sql_tests.sh
type-isolation-test/
.gitignore
CMakeLists_module.txt
CMakeLists.module.txt
CMakeLists.txt
README.md
run_type_isolation_test.sh
test_modules/
debug_constraint_simple.cpp
debug_large_struct.cpp
debug_minimal_fail.cpp
debug_optional_large_struct.cpp
debug_simple_enum.cpp
debug_special_constraints.cpp
debug_special_reducers.cpp
debug_special.cpp
debug_trace.cpp
debug_vector_only_simple.cpp
debug_vector_only.cpp
error_autoinc_non_integer.cpp
error_circular_ref.cpp
error_default_missing_field.cpp
error_invalid_index.cpp
error_multicolumn_missing_field.cpp
error_multiple_pk.cpp
error_non_spacetimedb_type.cpp
error_scheduled_id_pk.cpp
module01_basic_unsigned.cpp
module02_large_unsigned.cpp
module03_basic_signed.cpp
module04_large_signed.cpp
module05_float_bool.cpp
module06_string.cpp
module07_special_types.cpp
module08_enums.cpp
module09_structs.cpp
module10_vectors.cpp
module11_optional.cpp
module12_constraints.cpp
test_complex_reducer_only.cpp
test_complex_table_only.cpp
test_connectionid_only.cpp
test_debug_optional.cpp
test_enum_table_only.cpp
test_enum_vector_payloads.cpp
test_identity_only.cpp
test_massive_reducer.cpp
test_minimal_special.cpp
test_mixed_types.cpp
test_multicolumn_index_valid.cpp
test_nested_optionals.cpp
test_optional_debug.cpp
test_optional_reducer_only.cpp
test_optional_simple.cpp
test_optional_table_only.cpp
test_simple_table.cpp
test_single_special_vector.cpp
test_special_minimal.cpp
test_special_vectors.cpp
test_timeduration_only.cpp
test_timestamp_only.cpp
test_u128_only.cpp
test_unified_enum.cpp
test_unit_isolation.cpp
test_unit_progression.cpp
... 1600 moreShowing a partial view of a very large repo.
FAQ
spacetimedb is a Claude Code plugin with 22 hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. It includes cli, concepts, cpp-server. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.