concepts
Installation
SKILL.md
SpacetimeDB Core Concepts
SpacetimeDB is 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.
Critical Rules
- Reducers are transactional. They do not return data to callers. Use subscriptions to read data.
- Reducers must be deterministic. Do not use filesystem, network, external clocks, or external random sources in reducers. Use the reducer context (
ctx) for SpacetimeDB-provided timestamp and deterministic random values. - Read data via tables/subscriptions, not reducer return values. Clients get data through subscribed queries.
- Auto-increment IDs are not sequential. Gaps are normal, do not use for ordering. Use timestamps or explicit sequence columns.
ctx.senderis the authenticated principal. Never trust identity passed as arguments.