spacetimedb-csharp

Guide C# server modules and client SDKs for SpacetimeDB 2.0.

25.0k|1.0k|Updated Jun 17, 2023
One-click install
npx skills add https://github.com/clockworklabs/SpacetimeDB --skill spacetimedb-csharp
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: spacetimedb-csharp
Source: https://github.com/clockworklabs/SpacetimeDB/tree/main/skills/spacetimedb-csharp
Command: npx skills add https://github.com/clockworklabs/SpacetimeDB --skill spacetimedb-csharp

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This guide removes ambiguity and prevents common mistakes when building C# server modules and client integrations for SpacetimeDB 2.0 by documenting correct attributes, project layout, deterministic reducer patterns, and client subscription behavior.

Core Features & Use Cases

  • Server module patterns: rules for partial types, table attributes, primary keys, auto-increment semantics, sum types, and deterministic reducers required for WASI modules.
  • Client SDK integration: connection setup, subscription management, event callbacks, FrameTick usage, reducer calls, and authentication/token handling for C# clients.
  • Project and build requirements: .NET 8 SDK, wasi-experimental workload, StdbModule.csproj naming, SpacetimeDB.Runtime package conventions, and tooling commands to generate client bindings.
  • Common pitfalls & hard requirements: lists of frequently hallucinated APIs to avoid, index attribute qualification, collection types, lifecycle reducer conventions, and recommended error handling.

Quick Start

Create a net8.0 StdbModule.csproj with partial tables and deterministic reducers, install the wasi-experimental workload, build the WASI module, and run spacetime generate --lang csharp to produce client bindings and examples.

Frequently Asked Questions about spacetimedb-csharp

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I build a C# server module for SpacetimeDB?

To build a C# SpacetimeDB module, create a net8.0 project named StdbModule.csproj, define partial tables and deterministic reducers, install the wasi-experimental workload, and compile to a WASI module.

Do I need .NET 8 to compile SpacetimeDB WASI modules?

Yes, you need the .NET 8 SDK and the wasi-experimental workload installed to compile C# SpacetimeDB modules, along with the SpacetimeDB.Runtime package and correct StdbModule.csproj naming conventions.

How do I generate client bindings for a C# SpacetimeDB module?

Generate C# client bindings by running the spacetime generate command with the csharp language flag after successfully building your WASI module, producing client code and examples for subscription management.

What are the requirements for table attributes and reducers in SpacetimeDB C# modules?

SpacetimeDB C# modules require partial type patterns for tables, correct table attributes, primary keys, auto-increment semantics, sum types, and deterministic reducers to function properly as WASI modules.

Why are my SpacetimeDB C# module APIs causing compilation errors?

Compilation errors often stem from using hallucinated APIs, incorrect index attribute qualification, unsupported collection types, or missing lifecycle reducer conventions, which are documented as common pitfalls to avoid.