What problem does it solve?
Writing SpacetimeDB server modules in C# requires precise knowledge of SDK attributes, context APIs, and code-generation conventions; mistakes in attribute usage or context handling cause compile errors or runtime failures. This reference provides the exact patterns for defining tables, reducers, indexes, views, scheduled tasks, and HTTP endpoints in C# modules.
Core Features & Use Cases
- Table and Reducer Definitions: Declare tables with
[SpacetimeDB.Table], column attributes like [PrimaryKey], [AutoInc], [Unique], and BTree indexes, plus reducers as public static methods receiving ReducerContext.
- Views, Scheduling, and HTTP: Implement anonymous and per-user views, scheduled tables with
ScheduleAt timers, procedures with outbound HTTP via ctx.Http, and inbound HTTP routers with [SpacetimeDB.HttpHandler].
- Use Case: A developer building a multiplayer game backend needs a score table with an auto-increment primary key, an
AddRecord reducer that stamps the caller's identity, and a scheduled tick reducer firing every five seconds; this reference supplies the exact C# syntax for each piece.
Quick Start
Use the csharp-server skill to write a SpacetimeDB C# module with a public table and a reducer that inserts a row owned by the caller.