Explains SpacetimeDB architecture, core concepts, and current capabilities. Useful when learning SpacetimeDB, making architectural decisions, or evaluating it against other backends.
Ships in SpacetimeDB. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
SpacetimeDB, which is being renamed Spacetime, is the whole backend: a relational database that is also a server. It lets you upload application logic directly into the database as modules, eliminating the traditional web/game server layer entirely. Rust, C#, and C++ modules compile to WebAssembly, while TypeScript modules run on V8.
This describes Spacetime 2.x. The API changed substantially from 1.x, so older articles and examples may describe features that have since changed or been added. Each line links to the docs.
504 with an unknown outcome, not proof of rollback; do not retry non-idempotent calls without deduplication. (HTTP calls)ctx.timestamp and a seeded random number generator from their context. (Reducer context)psql, and GUI clients can connect. (PostgreSQL wire protocol)spacetime dev rebuilds and republishes the module and regenerates client bindings on every save. (spacetime dev)spacetime start or Docker, and the Business Source License 1.1 lets an application use one instance in production, as long as you don't offer Spacetime itself as a database service. (Self-hosting)For questions about older articles, benchmarks, or past reviews, see Common misconceptions.
ctx) for SpacetimeDB-provided timestamp and deterministic random values.ctx.sender is the authenticated principal. Never trust identity passed as arguments.spacetime start)spacetime publish)spacetime generate)spacetime logs <db-name>)Organize data by access pattern, not by entity:
Player PlayerState PlayerStats
id <-- player_id player_id
name position_x total_kills
position_y total_deaths
velocity_x play_time
Reducers are transactional functions that modify database state. They run atomically, cannot interact with the outside world, and do not return data to callers. See the language-specific server skills for syntax.
Event tables broadcast reducer-specific data to clients. Rows are never stored in the client cache (count() returns 0, iter() yields nothing); only onInsert callbacks fire.
Subscriptions replicate database rows to clients in real-time.
onInsert, onDelete, onUpdate)Best practices:
Modules contain application logic that runs inside the database.
ctx.withTx)Server-side modules can be written in: Rust, C#, TypeScript, C++
Lifecycle: Write → Compile → Publish (spacetime publish) → Hot-swap (republish without disconnecting clients)
A module can expose its own HTTP API. Each handler takes a request and returns a response, and one router per module binds handlers to a method and path. Requests reach them under /v1/database/<name_or_identity>/route<path>, so a /say-hello route is served at /v1/database/my-db/route/say-hello.
-_~/. Pass variable data in the query string, headers or body.db. Open a transaction with with_tx / withTx.Authorization header on module routes, and each request's sender is a random anonymous identity. Validate credentials in the handler, or use a procedure when you need the caller's JWT claims.Use HTTP handlers for webhooks and for clients that can't use a SpacetimeDB SDK. See the language-specific server skills for syntax.
TypeScript and C# support same-language submodule composition. A namespace has a language accessor and a canonical database name; SQL, CLI calls, and HTTP calls use the canonical name. Changing the canonical namespace drops its tables and their data, so pin it when renaming an accessor. TypeScript supports nested submodules; C# composition requires 2.13+ with .NET 10/C# 14, and nested or repeated C# mounts require 2.14+. See the respective server skills for registration and helper-context rules.
Database environment values are read-only strings, including secrets, supplied at publish time, not process environment variables. Keys are exact and case-sensitive: declare every key module code reads; undeclared reads fail even if a value is stored. Required declarations need values before initialization/migration; optional declarations permit absence. Publishing preserves unspecified values; environment-only publishing changes configuration without replacing the module. Transactional reads share a snapshot. In TypeScript/C#, named submodules cannot declare their own environment or read the root environment through host-dispatched entry points; ordinary helper calls retain the caller's access. C# dependencies registered in public instead contribute to the root schema. Do not return or log secrets; private storage does not prevent module code from exposing them.
Views can accept arguments in 2.13+ (Rust, TypeScript, C#), queried as SELECT * FROM view_name(42). Use explicit queries instead of subscribe-all on that connection; subscribe-all skips these views. See server skills for definition restrictions and client skills for query/cache rules.
Rust and TypeScript provide in-memory module unit-test harnesses in 2.12+: run native cargo test or Vitest with the module-test plugin. These use the real datastore but do not simulate clients, subscriptions, RLS enforcement, lifecycle events, or timer execution. Test those host behaviors against a running database.
Reducers can't make network requests, but a reducer can call a reducer in another database on the same server through an outbox table (async IDC). The reducer inserts a row, and after its transaction commits, the row is delivered as a reducer call to the target database exactly once, in order with other calls through the same outbox to the same database. The sending reducer doesn't wait, and the two databases don't commit together: the receiving reducer runs later in its own transaction and can fail. An optional on_result reducer in the sending database receives the result, so it can undo or record the work.
Use it to split an application into databases that scale and deploy independently, such as a lobby that sends players to separate game world databases. Only Rust and TypeScript modules can declare outbox tables. See the language-specific server skills for syntax.
ctx.sender / ctx.Sender / ctx.sender() for authorization.SpacetimeDB works with many OIDC providers, including SpacetimeAuth (built-in), Auth0, Clerk, Keycloak, Google, and GitHub.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
TypeScript, Rust, C#, C++
/spacetimedb:conceptsfrom SpacetimeDB
npx claudepluginhub clockworklabs/spacetimedb --plugin spacetimedb11 skills in this plugin
/cliSpacetimeDB CLI reference for initializing projects, building modules, publishing databases, querying data, and managing servers/cpp-serverSpacetimeDB C++ server module SDK reference. Use when writing tables, reducers, or module logic in C++./csharp-clientSpacetimeDB C#/.NET client SDK reference. Use when building C# clients that connect to SpacetimeDB (console, desktop, or any .NET app)./csharp-serverSpacetimeDB C# server module SDK reference. Use when writing tables, reducers, or module logic in C#./mcpOperate a running SpacetimeDB database through MCP tools rather than the CLI - list databases, read schemas, run SQL, and call reducers. Use when the client exposes spacetimedb MCP tools and the task is to inspect or change data in a live database./rust-serverSpacetimeDB Rust server module SDK reference. Use when writing tables, reducers, or module logic in Rust.2 plugins ship this exact skill · first indexed Nov 19, 2026
Other plugins' skills for the same job