From 63f185720bf62b4e1003011251f197d454805ee7 Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 19 Jun 2026 08:10:44 -0400 Subject: [PATCH 01/19] docs: fix TypeScript connection builder examples --- .../00600-clients/00300-connection.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00300-connection.md b/docs/docs/00200-core-concepts/00600-clients/00300-connection.md index 8882aa3c80d..f1ad4c73d42 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00300-connection.md +++ b/docs/docs/00200-core-concepts/00600-clients/00300-connection.md @@ -26,9 +26,10 @@ Create a connection using the `DbConnection` builder pattern: ```typescript import { DbConnection } from './module_bindings'; -const conn = new DbConnection.builder() +const conn = DbConnection.builder() .withUri("https://maincloud.spacetimedb.com") - .withDatabaseName("my_database"); + .withDatabaseName("my_database") + .build(); ``` @@ -80,9 +81,10 @@ To connect to a database hosted on MainCloud: ```typescript -const conn = new DbConnection.builder() +const conn = DbConnection.builder() .withUri("https://maincloud.spacetimedb.com") - .withDatabaseName("my_database"); + .withDatabaseName("my_database") + .build(); ``` @@ -126,10 +128,11 @@ To authenticate with a token (for example, from [SpacetimeAuth](../00500-authent ```typescript -const conn = new DbConnection.builder() +const conn = DbConnection.builder() .withUri("https://maincloud.spacetimedb.com") .withDatabaseName("my_database") - .withToken("your_auth_token_here"); + .withToken("your_auth_token_here") + .build(); ``` From e179d7445560b9ae39cb24242746d0ec9c101845 Mon Sep 17 00:00:00 2001 From: rain Date: Sun, 14 Jun 2026 08:11:24 -0400 Subject: [PATCH 02/19] docs: document reducer context random APIs --- .../00300-reducers/00400-reducer-context.md | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md b/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md index a4d743813d1..06e30fb7b2a 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md +++ b/docs/docs/00200-core-concepts/00200-functions/00300-reducers/00400-reducer-context.md @@ -272,6 +272,46 @@ The context provides access to a random number generator that is deterministic a Never use external random number generators (like `Random` in C# without using the context). These are non-deterministic and will cause different nodes to produce different results, breaking consensus. ::: +Use the context-provided random API for any reducer logic that needs random values: + + + + +```typescript +const fraction = ctx.random(); // [0.0, 1.0) +const roll = ctx.random.integerInRange(1, 6); // inclusive +const bytes = ctx.random.fill(new Uint8Array(16)); +``` + + + + +```csharp +double fraction = ctx.Rng.NextDouble(); // [0.0, 1.0) +int roll = ctx.Rng.Next(1, 7); // [1, 7) +``` + + + + +```rust +use spacetimedb::rand::Rng; + +let value: u32 = ctx.random(); +let roll: u32 = ctx.rng().gen_range(1..=6); +``` + + + + +```cpp +auto& rng = ctx.rng(); +int32_t roll = rng.gen_range(1, 6); // inclusive +``` + + + + ## Module Identity The context provides access to the module's own identity, which is useful when a reducer needs to refer to the database itself. From 219e88e724963360029ae735041ac12417feea35 Mon Sep 17 00:00:00 2001 From: rain Date: Thu, 18 Jun 2026 08:36:05 -0400 Subject: [PATCH 03/19] docs: align reducer skill determinism guidance --- skills/concepts/SKILL.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skills/concepts/SKILL.md b/skills/concepts/SKILL.md index 402a1a8ff18..9c4195fc1bd 100644 --- a/skills/concepts/SKILL.md +++ b/skills/concepts/SKILL.md @@ -20,7 +20,7 @@ SpacetimeDB is a relational database that is also a server. It lets you upload a ## Critical Rules 1. **Reducers are transactional.** They do not return data to callers. Use subscriptions to read data. -2. **Reducers must be deterministic.** No filesystem, network, timers, or random. All state must come from tables. +2. **Reducers must be deterministic.** Do not use filesystem, network, external clocks, or external random sources in reducers. Use `ReducerContext` for SpacetimeDB-provided timestamp and deterministic random values. 3. **Read data via tables/subscriptions**, not reducer return values. Clients get data through subscribed queries. 4. **Auto-increment IDs are not sequential.** Gaps are normal, do not use for ordering. Use timestamps or explicit sequence columns. 5. **`ctx.sender` is the authenticated principal.** Never trust identity passed as arguments. From 505d364fe2247bc7e744afd1befed66a3ac81735 Mon Sep 17 00:00:00 2001 From: rain Date: Sat, 20 Jun 2026 08:15:28 -0400 Subject: [PATCH 04/19] docs: fix TypeScript reducer argument examples --- docs/docs/00200-core-concepts/00600-clients/00200-codegen.md | 4 ++-- .../00600-clients/00700-typescript-reference.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md b/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md index f648e17a578..3575377a20a 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md +++ b/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md @@ -189,10 +189,10 @@ For example, a `create_user` reducer becomes: ```typescript // Call the reducer -conn.reducers.createUser(name, email); +conn.reducers.createUser({ name, email }); // Register a callback to observe reducer invocations -conn.reducers.onCreateUser((ctx, name, email) => { +conn.reducers.onCreateUser((ctx, { name, email }) => { console.log(`User created: ${name}`); }); ``` diff --git a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md index 759a0f85f10..66abdda2021 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md @@ -1088,7 +1088,7 @@ function MyComponent() { return (

Connected as: {identity?.toHexString()}

-
@@ -1136,7 +1136,7 @@ import { useReducer } from 'spacetimedb/react'; import { reducers } from './module_bindings'; const createPlayer = useReducer(reducers.createPlayer); -createPlayer('Alice'); +createPlayer({ name: 'Alice' }); ``` `useReducer` returns a function that calls the generated reducer. Calls made before the connection is ready are queued and flushed once the connection is established. From 473d1364c1c866a62e1c10f167ce39a18c4be630 Mon Sep 17 00:00:00 2001 From: rain Date: Sun, 21 Jun 2026 08:10:10 -0400 Subject: [PATCH 05/19] docs: fix init reducer tutorial wording --- .../00300-tutorials/00300-unity-tutorial/00400-part-3.md | 4 ++-- .../00300-tutorials/00400-unreal-tutorial/00400-part-3.md | 2 +- .../00300-tutorials/00500-godot-tutorial/00400-part-3.md | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md index ee1161f4774..fc5b6ae572c 100644 --- a/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00300-unity-tutorial/00400-part-3.md @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportGodot to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportGodot to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. diff --git a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md index c0c1d3202e3..1b388814d96 100644 --- a/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00400-unreal-tutorial/00400-part-3.md @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. diff --git a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md index 1ba2cc87936..0a4586a5216 100644 --- a/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md +++ b/docs/docs/00100-intro/00300-tutorials/00500-godot-tutorial/00400-part-3.md @@ -85,7 +85,7 @@ We also added two helper functions so we can get a random range as either a `int -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportGodot to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `init` reducer. SpacetimeDB calls the `init` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. @@ -161,7 +161,7 @@ In this reducer, we are using the `world_size` we configured along with the `Red -Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportGodot to initialize the state of your database before any clients connect. +Let's start by spawning food into the map. The first thing we need to do is create a new, special reducer called the `SPACETIMEDB_INIT` reducer. SpacetimeDB calls the `SPACETIMEDB_INIT` reducer automatically when you first publish your module, and also after any time you run with `publish --delete-data`. It gives you an opportunity to initialize the state of your database before any clients connect. Add this new reducer above our `connect` reducer. From 8adb5fbd9951a944c721d4079ebdaef7aa17bc4b Mon Sep 17 00:00:00 2001 From: rain Date: Mon, 22 Jun 2026 08:13:11 -0400 Subject: [PATCH 06/19] docs: fix React useSpacetimeDB reference --- .../00600-clients/00700-typescript-reference.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md index 66abdda2021..f3f84524d97 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md @@ -1197,10 +1197,11 @@ function Root() { #### `useSpacetimeDB()` -Returns the current `DbConnection` from the provider context: +Returns the current connection state and a `getConnection()` function for accessing the provider-managed `DbConnection`: ```tsx -const conn = useSpacetimeDB(); +const { isActive, identity, token, getConnection } = useSpacetimeDB(); +const conn = getConnection(); ``` #### `useTable(query, callbacks?)` From b6b329acd2b5b504c64195bf272736846199d563 Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 23 Jun 2026 08:11:15 -0400 Subject: [PATCH 07/19] docs: fix CLI reset and TypeScript codegen examples --- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00200-core-concepts/00100-databases/00500-cheat-sheet.md | 4 ++-- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00200-core-concepts/00100-databases/00500-cheat-sheet.md | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md index 82d079fa75e..21d271fb8eb 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -95,7 +95,7 @@ If this publish is a major upgrade from 1.x to 2.0, read [1.x to 2.0 Upgrade Not To completely reset your database and delete all data: ```bash -spacetime publish --delete-data +spacetime publish --delete-data always ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 6c959fbc929..e762baab919 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -913,7 +913,7 @@ spacetime login # Authenticate # Module management spacetime build # Build module spacetime publish # Publish module -spacetime publish --delete-data # Reset database +spacetime publish --delete-data always # Reset database spacetime delete # Delete database # Database operations @@ -926,7 +926,7 @@ spacetime call reducer arg1 arg2 # Call reducer # Code generation spacetime generate --lang rust # Generate Rust client spacetime generate --lang csharp # Generate C# client -spacetime generate --lang ts # Generate TypeScript client +spacetime generate --lang typescript # Generate TypeScript client ``` ## Common Types diff --git a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md index fe4bc03f162..ca7d6450cca 100644 --- a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -93,7 +93,7 @@ spacetime publish --break-clients To completely reset your database and delete all data: ```bash -spacetime publish --delete-data +spacetime publish --delete-data always ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 529e79d6ec4..2da3af5235d 100644 --- a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -578,7 +578,7 @@ spacetime login # Authenticate # Module management spacetime build # Build module spacetime publish # Publish module -spacetime publish --delete-data # Reset database +spacetime publish --delete-data always # Reset database spacetime delete # Delete database # Database operations @@ -591,7 +591,7 @@ spacetime call reducer arg1 arg2 # Call reducer # Code generation spacetime generate --lang rust # Generate Rust client spacetime generate --lang csharp # Generate C# client -spacetime generate --lang ts # Generate TypeScript client +spacetime generate --lang typescript # Generate TypeScript client ``` ## Common Types From ed140dee3407a1647b30afca1db3aad3889a4062 Mon Sep 17 00:00:00 2001 From: rain Date: Wed, 24 Jun 2026 08:10:31 -0400 Subject: [PATCH 08/19] docs: fix TypeScript codegen table accessor example --- docs/docs/00200-core-concepts/00600-clients/00200-codegen.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md b/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md index 3575377a20a..4da763eba32 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md +++ b/docs/docs/00200-core-concepts/00600-clients/00200-codegen.md @@ -104,14 +104,14 @@ For example, a `user` table becomes: ```typescript // Generated type -export default __t.object("User", { +export default __t.row({ id: __t.u64(), name: __t.string(), email: __t.string(), }); // Access via DbConnection -conn.db.User +conn.db.user ``` From 408d421046ea586355ff6abc3c39ff6042485c0a Mon Sep 17 00:00:00 2001 From: rain Date: Thu, 25 Jun 2026 08:10:05 -0400 Subject: [PATCH 09/19] docs: fix Unreal FAQ links --- docs/docs/00100-intro/00100-getting-started/00500-faq.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00100-intro/00100-getting-started/00500-faq.md b/docs/docs/00100-intro/00100-getting-started/00500-faq.md index 9bc23e30bab..abbbc177437 100644 --- a/docs/docs/00100-intro/00100-getting-started/00500-faq.md +++ b/docs/docs/00100-intro/00100-getting-started/00500-faq.md @@ -170,7 +170,7 @@ Yes. SpacetimeDB has a C# client SDK that works with Unity. The SDK maintains a ### Can I use SpacetimeDB with Unreal Engine? -Yes. SpacetimeDB has a C++ client SDK for Unreal Engine with Blueprint support. See the [Unreal quickstart](../00200-quickstarts/00700-cpp.md) for details. +Yes. SpacetimeDB has a C++ client SDK for Unreal Engine with Blueprint support. See the [Unreal tutorial](../00300-tutorials/00400-unreal-tutorial/index.md) and [Unreal SDK reference](../../00200-core-concepts/00600-clients/00800-unreal-reference.md) for details. ### Can I use SpacetimeDB with React / Vue / Angular / Svelte? From 2724c9aea5619aad5f0840b393dba1e4239761a1 Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 26 Jun 2026 08:10:31 -0400 Subject: [PATCH 10/19] docs: fix TypeScript shared table example --- docs/docs/00200-core-concepts/00300-tables.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/00200-core-concepts/00300-tables.md b/docs/docs/00200-core-concepts/00300-tables.md index dd8ec6c6b0e..a0b0bb43d95 100644 --- a/docs/docs/00200-core-concepts/00300-tables.md +++ b/docs/docs/00200-core-concepts/00300-tables.md @@ -409,8 +409,8 @@ const playerColumns = { }; // Create two tables with the same schema -const Player = table({ name: 'Player', public: true }, playerColumns); -const LoggedOutPlayer = table({ name: 'LoggedOutPlayer' }, playerColumns); +const player = table({ name: 'player', public: true }, playerColumns); +const loggedOutPlayer = table({ name: 'logged_out_player' }, playerColumns); ``` From b2e12abcf96dd69fba7de880792ac6909194c120 Mon Sep 17 00:00:00 2001 From: rain Date: Sat, 27 Jun 2026 08:09:40 -0400 Subject: [PATCH 11/19] docs: fix Solid reducer call example --- .../00600-clients/00700-typescript-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md index f3f84524d97..d1252bed5e5 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00700-typescript-reference.md @@ -1274,7 +1274,7 @@ const [users, isReady] = useTable( const sendMessage = useReducer(reducers.sendMessage); Loading users...}> - + {user =>
{user.name}
}
From 3d52ec11da33d021f70229c2b28ecb6d82f5208c Mon Sep 17 00:00:00 2001 From: rain Date: Tue, 30 Jun 2026 08:10:53 -0400 Subject: [PATCH 12/19] docs: clarify module runtimes in concepts skill --- skills/concepts/SKILL.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/skills/concepts/SKILL.md b/skills/concepts/SKILL.md index 9c4195fc1bd..ac9e91b371a 100644 --- a/skills/concepts/SKILL.md +++ b/skills/concepts/SKILL.md @@ -13,7 +13,7 @@ metadata: # SpacetimeDB Core Concepts -SpacetimeDB is a relational database that is also a server. It lets you upload application logic directly into the database via WebAssembly modules, eliminating the traditional web/game server layer entirely. +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. --- @@ -87,7 +87,7 @@ Best practices: ## Modules -Modules are WebAssembly bundles containing application logic that runs inside the database. +Modules contain application logic that runs inside the database. - **Tables**: Define the data schema - **Reducers**: Define callable functions that modify state From c55f4300af1367f7b6844e543828082854f82c23 Mon Sep 17 00:00:00 2001 From: rain Date: Wed, 1 Jul 2026 08:10:51 -0400 Subject: [PATCH 13/19] docs: fix TypeScript logging import example --- docs/docs/00300-resources/00100-how-to/00300-logging.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/docs/00300-resources/00100-how-to/00300-logging.md b/docs/docs/00300-resources/00100-how-to/00300-logging.md index 0e43daee80a..280c57c06a8 100644 --- a/docs/docs/00300-resources/00100-how-to/00300-logging.md +++ b/docs/docs/00300-resources/00100-how-to/00300-logging.md @@ -18,7 +18,10 @@ SpacetimeDB provides logging capabilities for debugging and monitoring your modu Use the standard `console` API to write logs from your reducers: ```typescript -import { spacetimedb } from 'spacetimedb/server'; +import { schema, t } from 'spacetimedb/server'; + +const spacetimedb = schema({ /* tables */ }); +export default spacetimedb; export const process_data = spacetimedb.reducer({ value: t.u32() }, (ctx, { value }) => { console.log(`Processing data with value: ${value}`); From 77505a67d2ce0c4abc07d4b9d9210a81275e51b5 Mon Sep 17 00:00:00 2001 From: rain Date: Thu, 2 Jul 2026 08:10:24 -0400 Subject: [PATCH 14/19] docs: fix TypeScript index accessor example --- .../00200-core-concepts/00100-databases/00500-cheat-sheet.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md index e762baab919..9e201b373c3 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -80,7 +80,7 @@ const score = table( { name: 'score', indexes: [{ - name: 'idx', + accessor: 'idx', algorithm: 'btree', columns: ['player_id', 'level'], }], From f3a209546407a9ef8388240b52e29f50a01356da Mon Sep 17 00:00:00 2001 From: rain Date: Fri, 3 Jul 2026 08:10:30 -0400 Subject: [PATCH 15/19] docs: fix delete-data examples --- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00100-databases/00500-cheat-sheet.md | 2 +- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00100-databases/00500-cheat-sheet.md | 2 +- skills/cli/SKILL.md | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md index 21d271fb8eb..5e2f40b025c 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -95,7 +95,7 @@ If this publish is a major upgrade from 1.x to 2.0, read [1.x to 2.0 Upgrade Not To completely reset your database and delete all data: ```bash -spacetime publish --delete-data always +spacetime publish --delete-data=always ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 9e201b373c3..1633320b2ce 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -913,7 +913,7 @@ spacetime login # Authenticate # Module management spacetime build # Build module spacetime publish # Publish module -spacetime publish --delete-data always # Reset database +spacetime publish --delete-data=always # Reset database spacetime delete # Delete database # Database operations diff --git a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md index ca7d6450cca..31691bcb5af 100644 --- a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -93,7 +93,7 @@ spacetime publish --break-clients To completely reset your database and delete all data: ```bash -spacetime publish --delete-data always +spacetime publish --delete-data=always ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 2da3af5235d..8b9ee8fbda6 100644 --- a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -578,7 +578,7 @@ spacetime login # Authenticate # Module management spacetime build # Build module spacetime publish # Publish module -spacetime publish --delete-data always # Reset database +spacetime publish --delete-data=always # Reset database spacetime delete # Delete database # Database operations diff --git a/skills/cli/SKILL.md b/skills/cli/SKILL.md index b984f44459a..534ad7ee4ec 100644 --- a/skills/cli/SKILL.md +++ b/skills/cli/SKILL.md @@ -46,7 +46,8 @@ spacetime dev spacetime dev --client-lang typescript --module-bindings-path ./client/src/module_bindings # Generate client bindings -spacetime generate --lang typescript|csharp|rust|unrealcpp --out-dir ./bindings --module-path ./server +spacetime generate --lang typescript|csharp|rust --out-dir ./bindings --module-path ./server +spacetime generate --lang unrealcpp --uproject-dir ./MyGame --module-path ./server --unreal-module-name MyGame ``` ### Publishing & Deployment @@ -59,7 +60,7 @@ spacetime publish my-database --yes spacetime publish my-database --server local --yes # Clear database and republish -spacetime publish my-database --delete-data always --yes +spacetime publish my-database --delete-data=always --yes ``` ### Database Interaction @@ -170,7 +171,7 @@ spacetime server ping ### "Schema conflict" ```bash # Clear data and republish -spacetime publish my-db --delete-data always --yes +spacetime publish my-db --delete-data=always --yes ``` ### "Build failed" @@ -186,4 +187,3 @@ rustup target add wasm32-unknown-unknown **Server-side (modules):** Rust, C#, TypeScript, C++ **Client SDKs:** TypeScript, C#, Rust, Unreal Engine **CLI `generate` targets:** TypeScript, C#, Rust, Unreal C++ - From 4b37066300b2723713863f721b9868a2302cad81 Mon Sep 17 00:00:00 2001 From: rain Date: Sun, 5 Jul 2026 08:10:17 -0400 Subject: [PATCH 16/19] docs: fix stale skill-aligned examples --- .../00100-databases/00500-cheat-sheet.md | 8 ++++---- .../00200-core-concepts/00200-functions/00500-views.md | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 1633320b2ce..1ea039db9f4 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -920,13 +920,13 @@ spacetime delete # Delete database spacetime logs # View logs spacetime logs --follow # Stream logs spacetime sql "SELECT * FROM t" # Run SQL query -spacetime describe # Show schema +spacetime describe --json # Show schema spacetime call reducer arg1 arg2 # Call reducer # Code generation -spacetime generate --lang rust # Generate Rust client -spacetime generate --lang csharp # Generate C# client -spacetime generate --lang typescript # Generate TypeScript client +spacetime generate --lang rust --out-dir src/module_bindings --module-path spacetimedb +spacetime generate --lang csharp --out-dir module_bindings --module-path spacetimedb +spacetime generate --lang typescript --out-dir src/module_bindings --module-path spacetimedb ``` ## Common Types diff --git a/docs/docs/00200-core-concepts/00200-functions/00500-views.md b/docs/docs/00200-core-concepts/00200-functions/00500-views.md index 114eb66e1ae..89c2e1c2931 100644 --- a/docs/docs/00200-core-concepts/00200-functions/00500-views.md +++ b/docs/docs/00200-core-concepts/00200-functions/00500-views.md @@ -1137,7 +1137,7 @@ public partial class Module ```rust use spacetimedb::{table, view, AnonymousViewContext, Query}; -#[spacetimedb::table(name = player, public)] +#[spacetimedb::table(accessor = player, public)] pub struct Player { #[primary_key] #[auto_inc] @@ -1147,7 +1147,7 @@ pub struct Player { score: u64, } -#[spacetimedb::table(name = player_level, public)] +#[spacetimedb::table(accessor = player_level, public)] pub struct PlayerLevel { #[unique] player_id: u64, From 0cb192b384531a932ffbca2e90cf3de8ea29e9ab Mon Sep 17 00:00:00 2001 From: rain Date: Mon, 6 Jul 2026 08:10:56 -0400 Subject: [PATCH 17/19] docs: align TypeScript quickstart table names --- docs/docs/00100-intro/00200-quickstarts/00100-react.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00150-vue.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00152-astro.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00160-svelte.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00162-solid.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00165-angular.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00175-remix.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00250-bun.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00275-deno.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00400-typescript.md | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/docs/00100-intro/00200-quickstarts/00100-react.md b/docs/docs/00100-intro/00200-quickstarts/00100-react.md index fb16ce69ff8..742e97debfb 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00100-react.md +++ b/docs/docs/00100-intro/00200-quickstarts/00100-react.md @@ -76,7 +76,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md b/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md index 7c2ca33df1c..1ee1bc079d6 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md +++ b/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md @@ -80,7 +80,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00150-vue.md b/docs/docs/00100-intro/00200-quickstarts/00150-vue.md index cfa1f12e3a4..7936271b11e 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00150-vue.md +++ b/docs/docs/00100-intro/00200-quickstarts/00150-vue.md @@ -74,7 +74,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00152-astro.md b/docs/docs/00100-intro/00200-quickstarts/00152-astro.md index 0cf2f0daf4b..d371fcc9f8f 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00152-astro.md +++ b/docs/docs/00100-intro/00200-quickstarts/00152-astro.md @@ -85,7 +85,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md b/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md index f64bffae21a..da40b35218d 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md +++ b/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md @@ -79,7 +79,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md b/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md index 461c1c846e8..ae68e7a0219 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md +++ b/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md @@ -74,7 +74,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00162-solid.md b/docs/docs/00100-intro/00200-quickstarts/00162-solid.md index 14dc09d45e8..64e75989416 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00162-solid.md +++ b/docs/docs/00100-intro/00200-quickstarts/00162-solid.md @@ -74,7 +74,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00165-angular.md b/docs/docs/00100-intro/00200-quickstarts/00165-angular.md index 624d244b7e9..e469f11ab70 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00165-angular.md +++ b/docs/docs/00100-intro/00200-quickstarts/00165-angular.md @@ -77,7 +77,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md b/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md index 95605ab1a46..f9acfa1efa1 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md +++ b/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md @@ -83,7 +83,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00175-remix.md b/docs/docs/00100-intro/00200-quickstarts/00175-remix.md index d91b3ea1cc7..d4f4993f707 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00175-remix.md +++ b/docs/docs/00100-intro/00200-quickstarts/00175-remix.md @@ -79,7 +79,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00250-bun.md b/docs/docs/00100-intro/00200-quickstarts/00250-bun.md index 4be40c771e4..b07ae083ac9 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00250-bun.md +++ b/docs/docs/00100-intro/00200-quickstarts/00250-bun.md @@ -72,7 +72,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00275-deno.md b/docs/docs/00100-intro/00200-quickstarts/00275-deno.md index 2694ef2922b..0b2d3ee66fc 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00275-deno.md +++ b/docs/docs/00100-intro/00200-quickstarts/00275-deno.md @@ -72,7 +72,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md b/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md index 0c75b7d8905..84d31061791 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md +++ b/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md @@ -72,7 +72,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md b/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md index 3c83bde433b..eaf808cf7af 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md +++ b/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md @@ -66,7 +66,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { public: true }, + { name: 'person', public: true }, { name: t.string(), } From e37286fb1d84bb0926c61c95b8f220e905c8648e Mon Sep 17 00:00:00 2001 From: rain Date: Wed, 8 Jul 2026 05:43:44 -0400 Subject: [PATCH 18/19] docs: address audit review comments --- docs/docs/00100-intro/00200-quickstarts/00100-react.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00150-vue.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00152-astro.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00160-svelte.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00162-solid.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00165-angular.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00175-remix.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00250-bun.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00275-deno.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md | 2 +- docs/docs/00100-intro/00200-quickstarts/00400-typescript.md | 2 +- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00200-core-concepts/00100-databases/00500-cheat-sheet.md | 2 +- .../00100-databases/00300-spacetime-publish.md | 2 +- .../00200-core-concepts/00100-databases/00500-cheat-sheet.md | 2 +- 18 files changed, 18 insertions(+), 18 deletions(-) diff --git a/docs/docs/00100-intro/00200-quickstarts/00100-react.md b/docs/docs/00100-intro/00200-quickstarts/00100-react.md index 742e97debfb..fb16ce69ff8 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00100-react.md +++ b/docs/docs/00100-intro/00200-quickstarts/00100-react.md @@ -76,7 +76,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md b/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md index 1ee1bc079d6..7c2ca33df1c 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md +++ b/docs/docs/00100-intro/00200-quickstarts/00150-nextjs.md @@ -80,7 +80,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00150-vue.md b/docs/docs/00100-intro/00200-quickstarts/00150-vue.md index 7936271b11e..cfa1f12e3a4 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00150-vue.md +++ b/docs/docs/00100-intro/00200-quickstarts/00150-vue.md @@ -74,7 +74,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00152-astro.md b/docs/docs/00100-intro/00200-quickstarts/00152-astro.md index d371fcc9f8f..0cf2f0daf4b 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00152-astro.md +++ b/docs/docs/00100-intro/00200-quickstarts/00152-astro.md @@ -85,7 +85,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md b/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md index da40b35218d..f64bffae21a 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md +++ b/docs/docs/00100-intro/00200-quickstarts/00155-nuxt.md @@ -79,7 +79,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md b/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md index ae68e7a0219..461c1c846e8 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md +++ b/docs/docs/00100-intro/00200-quickstarts/00160-svelte.md @@ -74,7 +74,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00162-solid.md b/docs/docs/00100-intro/00200-quickstarts/00162-solid.md index 64e75989416..14dc09d45e8 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00162-solid.md +++ b/docs/docs/00100-intro/00200-quickstarts/00162-solid.md @@ -74,7 +74,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00165-angular.md b/docs/docs/00100-intro/00200-quickstarts/00165-angular.md index e469f11ab70..624d244b7e9 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00165-angular.md +++ b/docs/docs/00100-intro/00200-quickstarts/00165-angular.md @@ -77,7 +77,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md b/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md index f9acfa1efa1..95605ab1a46 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md +++ b/docs/docs/00100-intro/00200-quickstarts/00170-tanstack.md @@ -83,7 +83,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00175-remix.md b/docs/docs/00100-intro/00200-quickstarts/00175-remix.md index d4f4993f707..d91b3ea1cc7 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00175-remix.md +++ b/docs/docs/00100-intro/00200-quickstarts/00175-remix.md @@ -79,7 +79,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00250-bun.md b/docs/docs/00100-intro/00200-quickstarts/00250-bun.md index b07ae083ac9..4be40c771e4 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00250-bun.md +++ b/docs/docs/00100-intro/00200-quickstarts/00250-bun.md @@ -72,7 +72,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00275-deno.md b/docs/docs/00100-intro/00200-quickstarts/00275-deno.md index 0b2d3ee66fc..2694ef2922b 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00275-deno.md +++ b/docs/docs/00100-intro/00200-quickstarts/00275-deno.md @@ -72,7 +72,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md b/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md index 84d31061791..0c75b7d8905 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md +++ b/docs/docs/00100-intro/00200-quickstarts/00300-nodejs.md @@ -72,7 +72,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md b/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md index eaf808cf7af..3c83bde433b 100644 --- a/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md +++ b/docs/docs/00100-intro/00200-quickstarts/00400-typescript.md @@ -66,7 +66,7 @@ import { schema, table, t } from 'spacetimedb/server'; const spacetimedb = schema({ person: table( - { name: 'person', public: true }, + { public: true }, { name: t.string(), } diff --git a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md index 5e2f40b025c..f8aaf847553 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/docs/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -95,7 +95,7 @@ If this publish is a major upgrade from 1.x to 2.0, read [1.x to 2.0 Upgrade Not To completely reset your database and delete all data: ```bash -spacetime publish --delete-data=always +spacetime publish --delete-data ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 1ea039db9f4..884c5117f5a 100644 --- a/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/docs/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -913,7 +913,7 @@ spacetime login # Authenticate # Module management spacetime build # Build module spacetime publish # Publish module -spacetime publish --delete-data=always # Reset database +spacetime publish --delete-data # Reset database spacetime delete # Delete database # Database operations diff --git a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md index 31691bcb5af..56ea2931ebd 100644 --- a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md +++ b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00300-spacetime-publish.md @@ -93,7 +93,7 @@ spacetime publish --break-clients To completely reset your database and delete all data: ```bash -spacetime publish --delete-data=always +spacetime publish --delete-data ``` ⚠️ **Warning:** This permanently deletes all data in your database! diff --git a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md index 8b9ee8fbda6..f890fe84f14 100644 --- a/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md +++ b/docs/versioned_docs/version-1.12.0/00200-core-concepts/00100-databases/00500-cheat-sheet.md @@ -578,7 +578,7 @@ spacetime login # Authenticate # Module management spacetime build # Build module spacetime publish # Publish module -spacetime publish --delete-data=always # Reset database +spacetime publish --delete-data # Reset database spacetime delete # Delete database # Database operations From eb1f6e8927479fe71e01efe70e7c602eceed513b Mon Sep 17 00:00:00 2001 From: rain Date: Wed, 8 Jul 2026 08:10:02 -0400 Subject: [PATCH 19/19] docs: document Rust table accessors --- .../00600-clients/00500-rust-reference.md | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/docs/docs/00200-core-concepts/00600-clients/00500-rust-reference.md b/docs/docs/00200-core-concepts/00600-clients/00500-rust-reference.md index 7bc50e79484..83b03542645 100644 --- a/docs/docs/00200-core-concepts/00600-clients/00500-rust-reference.md +++ b/docs/docs/00200-core-concepts/00600-clients/00500-rust-reference.md @@ -970,11 +970,34 @@ Each table defined by a module has an accessor method, whose name is the table n | Name | Description | | ----------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| [`TableAccessor` trait](#trait-tableaccessor) | Accesses a generated table handle from a database view in generic code. | | [`Table` trait](#trait-table) | Provides access to subscribed rows of a specific table within the client cache. | | [`TableWithPrimaryKey` trait](#trait-tablewithprimarykey) | Extension trait for tables which have a column designated as a primary key. | | [Unique constraint index access](#unique-constraint-index-access) | Seek a subscribed row by the value in its unique or primary key column. | | [BTree index access](#btree-index-access) | Not supported. | +### Trait `TableAccessor` + +```rust +spacetimedb_sdk::TableAccessor +``` + +For each table, `spacetime generate` emits a marker type named in the form `{TableNamePascalCase}TableAccessor` that implements `TableAccessor`. +This is mainly useful when writing generic helpers or integrations that need to name a table at the type level. Most application code should access tables directly through the generated methods on `ctx.db`. + +```rust +trait spacetimedb_sdk::TableAccessor { + type Row: 'static; + type Handle<'db> + where + DbView: 'db; + + fn get<'db>(db: &'db DbView) -> Self::Handle<'db>; +} +``` + +The marker type itself does not contain or cache table data. `TableAccessor::get` still requires a database view borrowed from a [`DbConnection`](#type-dbconnection) or context, so the normal client-cache lifetime rules still apply. + ### Trait `Table` ```rust