From 1e78cc4867a4ce07ee14b14521dfa42d0a78087f Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:16:11 +0100
Subject: [PATCH 01/11] clients connect to databases, not modules
---
STYLE.md | 4 ++--
docs/cli-reference.md | 6 +++---
docs/index.md | 4 ++--
docs/modules/c-sharp/index.md | 4 ++--
docs/modules/c-sharp/quickstart.md | 2 +-
docs/modules/rust/quickstart.md | 8 ++++----
docs/sdks/c-sharp/index.md | 8 ++++----
docs/sdks/c-sharp/quickstart.md | 4 ++--
docs/sdks/index.md | 4 ++--
docs/sdks/rust/index.md | 10 +++++-----
docs/sdks/rust/quickstart.md | 6 +++---
docs/sdks/typescript/index.md | 10 +++++-----
docs/sdks/typescript/quickstart.md | 6 +++---
docs/unity/part-1.md | 4 ++--
docs/unity/part-2.md | 26 +++++++++++++-------------
docs/unity/part-3.md | 2 +-
docs/unity/part-4.md | 2 +-
17 files changed, 55 insertions(+), 55 deletions(-)
diff --git a/STYLE.md b/STYLE.md
index 4fe1f676..b9d80706 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -307,9 +307,9 @@ For example:
>
> You can supply your users with authorization tokens in several different ways; which one is best for you will depend on the needs of your app. [...] (I don't actually want to write a real answer to this question - pgoldman 2024-11-19.)
>
-> #### Can my client connect to multiple modules at the same time?
+> #### Can my client connect to multiple databases at the same time?
>
-> Yes! Your client can construct as many `DbConnection`s simultaneously as it wants to, each of which will operate independently. If you want to connect to two modules with different schemas, use `spacetime generate` to include bindings for both of them in your client project. Note that SpacetimeDB may reject multiple concurrent connections to the same module by a single client.
+> Yes! Your client can construct as many `DbConnection`s simultaneously as it wants to, each of which will operate independently. If you want to connect to two databases with different schemas, use `spacetime generate` to include bindings for both of them in your client project. Note that SpacetimeDB may reject multiple concurrent connections to the same database by a single client.
## Tutorial pages
diff --git a/docs/cli-reference.md b/docs/cli-reference.md
index 69ebbbd5..4da30b2c 100644
--- a/docs/cli-reference.md
+++ b/docs/cli-reference.md
@@ -54,7 +54,7 @@ This document contains the help content for the `spacetime` command-line program
* `logout` —
* `init` — Initializes a new spacetime project. WARNING: This command is UNSTABLE and subject to breaking changes.
* `build` — Builds a spacetime module.
-* `server` — Manage the connection to the SpacetimeDB server. WARNING: This command is UNSTABLE and subject to breaking changes.
+* `server` — Manage the connection to the SpacetimeDB database server. WARNING: This command is UNSTABLE and subject to breaking changes.
* `subscribe` — Subscribe to SQL queries on the database. WARNING: This command is UNSTABLE and subject to breaking changes.
* `start` — Start a local SpacetimeDB instance
* `version` — Manage installed spacetime versions
@@ -83,7 +83,7 @@ Run `spacetime help publish` for more detailed information.
###### Options:
-* `-c`, `--delete-data` — When publishing to an existing database identity, first DESTROY all data associated with the module
+* `-c`, `--delete-data` — When publishing to an existing database identity, first DESTROY all data associated with the database
* `--build-options ` — Options to pass to the build command, for example --build-options='--lint-dir='
Default value: ``
@@ -391,7 +391,7 @@ Builds a spacetime module.
## spacetime server
-Manage the connection to the SpacetimeDB server. WARNING: This command is UNSTABLE and subject to breaking changes.
+Manage the connection to the SpacetimeDB database server. WARNING: This command is UNSTABLE and subject to breaking changes.
**Usage:** `spacetime server
server `
diff --git a/docs/index.md b/docs/index.md
index 6e4a0b65..ad712251 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -261,9 +261,9 @@ def identity_from_claims(issuer: str, subject: str) -> [u8; 32]:
### ConnectionId
-A `ConnectionId` identifies client connections to a SpacetimeDB module.
+A `ConnectionId` identifies client connections to a SpacetimeDB database.
-A user has a single [`Identity`](#identity), but may open multiple connections to your module. Each of these will receive a unique `ConnectionId`.
+A user has a single [`Identity`](#identity), but may open multiple connections to your database. Each of these will receive a unique `ConnectionId`.
### Energy
**Energy** is the currency used to pay for data storage and compute operations in a SpacetimeDB host.
diff --git a/docs/modules/c-sharp/index.md b/docs/modules/c-sharp/index.md
index fc2acc95..3237e020 100644
--- a/docs/modules/c-sharp/index.md
+++ b/docs/modules/c-sharp/index.md
@@ -830,13 +830,13 @@ This reducer can be used to configure any static data tables used by your module
### The `ClientConnected` reducer
-This reducer is marked with `[SpacetimeDB.Reducer(ReducerKind.ClientConnected)]`. It is run when a client connects to the SpacetimeDB module. Their identity can be found in the sender value of the `ReducerContext`.
+This reducer is marked with `[SpacetimeDB.Reducer(ReducerKind.ClientConnected)]`. It is run when a client connects to the SpacetimeDB database. Their identity can be found in the sender value of the `ReducerContext`.
If an error occurs in the reducer, the client will be disconnected.
### The `ClientDisconnected` reducer
-This reducer is marked with `[SpacetimeDB.Reducer(ReducerKind.ClientDisconnected)]`. It is run when a client disconnects from the SpacetimeDB module. Their identity can be found in the sender value of the `ReducerContext`.
+This reducer is marked with `[SpacetimeDB.Reducer(ReducerKind.ClientDisconnected)]`. It is run when a client disconnects from the SpacetimeDB database. Their identity can be found in the sender value of the `ReducerContext`.
If an error occurs in the disconnect reducer, the client is still recorded as disconnected.
diff --git a/docs/modules/c-sharp/quickstart.md b/docs/modules/c-sharp/quickstart.md
index 86bcf16f..42e15ab8 100644
--- a/docs/modules/c-sharp/quickstart.md
+++ b/docs/modules/c-sharp/quickstart.md
@@ -233,7 +233,7 @@ public static void ClientConnected(ReducerContext ctx)
}
```
-Similarly, whenever a client disconnects, the module will execute the `OnDisconnect` event if it's registered with `ReducerKind.ClientDisconnected`. We'll use it to un-set the `Online` status of the `User` for the disconnected client.
+Similarly, whenever a client disconnects, the database will execute the `OnDisconnect` event if it's registered with `ReducerKind.ClientDisconnected`. We'll use it to un-set the `Online` status of the `User` for the disconnected client.
Add the following code after the `OnConnect` handler:
diff --git a/docs/modules/rust/quickstart.md b/docs/modules/rust/quickstart.md
index 0670bb89..cbb80154 100644
--- a/docs/modules/rust/quickstart.md
+++ b/docs/modules/rust/quickstart.md
@@ -182,7 +182,7 @@ You could extend the validation in `validate_message` in similar ways to `valida
## Set users' online status
-Whenever a client connects, the module will run a special reducer, annotated with `#[reducer(client_connected)]`, if it's defined. By convention, it's named `client_connected`. We'll use it to create a `User` record for the client if it doesn't yet exist, and to set its online status.
+Whenever a client connects, the database will run a special reducer, annotated with `#[reducer(client_connected)]`, if it's defined. By convention, it's named `client_connected`. We'll use it to create a `User` record for the client if it doesn't yet exist, and to set its online status.
We'll use `ctx.db.user().identity().find(ctx.sender)` to look up a `User` row for `ctx.sender`, if one exists. If we find one, we'll use `ctx.db.user().identity().update(..)` to overwrite it with a row that has `online: true`. If not, we'll use `ctx.db.user().insert(..)` to insert a new row for our new user. All three of these methods are generated by the `#[table(..)]` macro, with rows and behavior based on the row attributes. `ctx.db.user().find(..)` returns an `Option`, because of the unique constraint from the `#[primary_key]` attribute. This means there will be either zero or one matching rows. If we used `try_insert` here it would return a `Result<(), UniqueConstraintViolation>` because of the same unique constraint. However, because we're already checking if there is a user with the given sender identity we know that inserting into this table will not fail. Therefore, we use `insert`, which automatically unwraps the result, simplifying the code. If we want to overwrite a `User` row, we need to do so explicitly using `ctx.db.user().identity().update(..)`.
@@ -190,7 +190,7 @@ To `server/src/lib.rs`, add the definition of the connect reducer:
```rust
#[reducer(client_connected)]
-// Called when a client connects to the SpacetimeDB
+// Called when a client connects to a SpacetimeDB database server
pub fn client_connected(ctx: &ReducerContext) {
if let Some(user) = ctx.db.user().identity().find(ctx.sender) {
// If this is a returning user, i.e. we already have a `User` with this `Identity`,
@@ -208,11 +208,11 @@ pub fn client_connected(ctx: &ReducerContext) {
}
```
-Similarly, whenever a client disconnects, the module will run the `#[reducer(client_disconnected)]` reducer if it's defined. By convention, it's named `client_disconnected`. We'll use it to un-set the `online` status of the `User` for the disconnected client.
+Similarly, whenever a client disconnects, the database will run the `#[reducer(client_disconnected)]` reducer if it's defined. By convention, it's named `client_disconnected`. We'll use it to un-set the `online` status of the `User` for the disconnected client.
```rust
#[reducer(client_disconnected)]
-// Called when a client disconnects from SpacetimeDB
+// Called when a client disconnects from SpacetimeDB database server
pub fn identity_disconnected(ctx: &ReducerContext) {
if let Some(user) = ctx.db.user().identity().find(ctx.sender) {
ctx.db.user().identity().update(User { online: false, ..user });
diff --git a/docs/sdks/c-sharp/index.md b/docs/sdks/c-sharp/index.md
index 16fd2068..7e97c3f1 100644
--- a/docs/sdks/c-sharp/index.md
+++ b/docs/sdks/c-sharp/index.md
@@ -53,11 +53,11 @@ A connection to a remote database is represented by the `DbConnection` class. Th
| Name | Description |
|------------------------------------------------------------------------|-------------------------------------------------------------------------------|
-| [Connect to a module](#connect-to-a-module) | Construct a `DbConnection` instance. |
+| [Connect to a database](#connect-to-a-database) | Construct a `DbConnection` instance. |
| [Advance the connection](#advance-the-connection-and-process-messages) | Poll the `DbConnection` or run it in the background. |
| [Access tables and reducers](#access-tables-and-reducers) | Access the client cache, request reducer invocations, and register callbacks. |
-## Connect to a module
+## Connect to a database
```csharp
class DbConnection
@@ -109,7 +109,7 @@ class DbConnectionBuilder
}
```
-Chain a call to `.OnConnect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote module. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`WithToken`](#method-withtoken) to authenticate the same user in future connections.
+Chain a call to `.OnConnect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote database. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`WithToken`](#method-withtoken) to authenticate the same user in future connections.
### Callback `OnConnectError`
@@ -133,7 +133,7 @@ class DbConnectionBuilder
}
```
-Chain a call to `.OnDisconnect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote module, either as a result of a call to [`Disconnect`](#method-disconnect) or due to an error.
+Chain a call to `.OnDisconnect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote database, either as a result of a call to [`Disconnect`](#method-disconnect) or due to an error.
### Method `WithToken`
diff --git a/docs/sdks/c-sharp/quickstart.md b/docs/sdks/c-sharp/quickstart.md
index aba4b77c..b8a1dce1 100644
--- a/docs/sdks/c-sharp/quickstart.md
+++ b/docs/sdks/c-sharp/quickstart.md
@@ -90,7 +90,7 @@ We'll work outside-in, first defining our `Main` function at a high level, then
1. Initialize the `AuthToken` module, which loads and stores our authentication token to/from local storage.
2. Connect to the database.
3. Register a number of callbacks to run in response to various database events.
-4. Start our processing thread which connects to the SpacetimeDB module, updates the SpacetimeDB client and processes commands that come in from the input loop running in the main thread.
+4. Start our processing thread which connects to the SpacetimeDB database, updates the SpacetimeDB client and processes commands that come in from the input loop running in the main thread.
5. Start the input loop, which reads commands from standard input and sends them to the processing thread.
6. When the input loop exits, stop the processing thread and wait for it to exit.
@@ -455,7 +455,7 @@ Since the input loop will be blocking, we'll run our processing code in a separa
This thread will loop until the thread is signaled to exit, calling the update function `FrameTick` on the `DbConnection` to process any updates received from the module, and `ProcessCommand` to process any commands received from the input loop.
-Afterward, close the connection to the module.
+Afterward, close the connection to the database.
To `Program.cs`, add:
diff --git a/docs/sdks/index.md b/docs/sdks/index.md
index 46078cb9..ad9c082b 100644
--- a/docs/sdks/index.md
+++ b/docs/sdks/index.md
@@ -12,7 +12,7 @@ The SpacetimeDB Client SDKs offer the following key functionalities:
### Connection Management
-The SDKs handle the process of connecting and disconnecting from the SpacetimeDB server, simplifying this process for the client applications.
+The SDKs handle the process of connecting and disconnecting from SpacetimeDB database servers, simplifying this process for the client applications.
### Authentication
@@ -32,7 +32,7 @@ The SpacetimeDB Client SDKs offer powerful callback functionality that allow cli
#### Connection and Subscription Callbacks
-Clients can also register callbacks that trigger when the connection to the server is established or lost, or when a subscription is updated. This allows clients to react to changes in the connection status.
+Clients can also register callbacks that trigger when the connection to the database server is established or lost, or when a subscription is updated. This allows clients to react to changes in the connection status.
#### Row Update Callbacks
diff --git a/docs/sdks/rust/index.md b/docs/sdks/rust/index.md
index a6dd23bb..887ac50a 100644
--- a/docs/sdks/rust/index.md
+++ b/docs/sdks/rust/index.md
@@ -53,11 +53,11 @@ A connection to a remote database is represented by the `module_bindings::DbConn
| Name | Description |
|------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
-| [Connect to a module](#connect-to-a-module) | Construct a `DbConnection`. |
+| [Connect to a database](#connect-to-a-database) | Construct a `DbConnection`. |
| [Advance the connection](#advance-the-connection-and-process-messages) | Poll the `DbConnection`, or set up a background worker to run it. |
| [Access tables and reducers](#access-tables-and-reducers) | Access subscribed rows in the client cache, request reducer invocations, and register callbacks. |
-### Connect to a module
+### Connect to a database
```rust
impl DbConnection {
@@ -85,7 +85,7 @@ impl DbConnectionBuilder {
}
```
-Configure the URI of the SpacetimeDB instance or cluster which hosts the remote module.
+Configure the URI of the SpacetimeDB instance or cluster which hosts the remote database containing the module.
#### Method `with_module_name`
@@ -105,7 +105,7 @@ impl DbConnectionBuilder {
}
```
-Chain a call to `.on_connect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote module. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`with_token`](#method-with_token) to authenticate the same user in future connections.
+Chain a call to `.on_connect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote database. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`with_token`](#method-with_token) to authenticate the same user in future connections.
This interface may change in an upcoming release as we rework SpacetimeDB's authentication model.
@@ -135,7 +135,7 @@ impl DbConnectionBuilder {
}
```
-Chain a call to `.on_disconnect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote module, either as a result of a call to [`disconnect`](#method-disconnect) or due to an error.
+Chain a call to `.on_disconnect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote database, either as a result of a call to [`disconnect`](#method-disconnect) or due to an error.
#### Method `with_token`
diff --git a/docs/sdks/rust/quickstart.md b/docs/sdks/rust/quickstart.md
index 888782e6..c0faac40 100644
--- a/docs/sdks/rust/quickstart.md
+++ b/docs/sdks/rust/quickstart.md
@@ -22,7 +22,7 @@ cargo new client
`client/Cargo.toml` should be initialized without any dependencies. We'll need two:
-- [`spacetimedb-sdk`](https://crates.io/crates/spacetimedb-sdk), which defines client-side interfaces for interacting with a remote SpacetimeDB module.
+- [`spacetimedb-sdk`](https://crates.io/crates/spacetimedb-sdk), which defines client-side interfaces for interacting with a remote SpacetimeDB database.
- [`hex`](https://crates.io/crates/hex), which we'll use to print unnamed users' identities as hexadecimal strings.
Below the `[dependencies]` line in `client/Cargo.toml`, add:
@@ -131,12 +131,12 @@ In our case, we'll supply the following options:
3. An `on_disconnect` callback, to run when our connection ends.
4. A `with_token` call, to supply a token to authenticate with.
5. A `with_module_name` call, to specify the name or `Identity` of our database. Make sure to pass the same name here as you supplied to `spacetime publish`.
-6. A `with_uri` call, to specify the URI of the SpacetimeDB host where our module is running.
+6. A `with_uri` call, to specify the URI of the SpacetimeDB host where our database is running.
To `client/src/main.rs`, add:
```rust
-/// The URI of the SpacetimeDB instance hosting our chat module.
+/// The URI of the SpacetimeDB instance hosting our database containing chat module.
const HOST: &str = "http://localhost:3000";
/// The database name we chose when we published our module.
diff --git a/docs/sdks/typescript/index.md b/docs/sdks/typescript/index.md
index 322443c9..b670c5f8 100644
--- a/docs/sdks/typescript/index.md
+++ b/docs/sdks/typescript/index.md
@@ -94,11 +94,11 @@ A connection to a remote database is represented by the `DbConnection` type. Thi
| Name | Description |
|-----------------------------------------------------------|--------------------------------------------------------------------------------------------------|
-| [Connect to a module](#connect-to-a-module) | Construct a `DbConnection`. |
+| [Connect to a database](#connect-to-a-database) | Construct a `DbConnection`. |
| [Access tables and reducers](#access-tables-and-reducers) | Access subscribed rows in the client cache, request reducer invocations, and register callbacks. |
-### Connect to a module
+### Connect to a database
```typescript
class DbConnection {
@@ -126,7 +126,7 @@ class DbConnectionBuilder {
}
```
-Configure the URI of the SpacetimeDB instance or cluster which hosts the remote module.
+Configure the URI of the SpacetimeDB instance or cluster which hosts the remote database.
#### Method `withModuleName`
@@ -149,7 +149,7 @@ class DbConnectionBuilder {
}
```
-Chain a call to `.onConnect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote module. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`withToken`](#method-withtoken) to authenticate the same user in future connections.
+Chain a call to `.onConnect(callback)` to your builder to register a callback to run when your new `DbConnection` successfully initiates its connection to the remote database. The callback accepts three arguments: a reference to the `DbConnection`, the `Identity` by which SpacetimeDB identifies this connection, and a private access token which can be saved and later passed to [`withToken`](#method-withtoken) to authenticate the same user in future connections.
#### Callback `onConnectError`
@@ -173,7 +173,7 @@ class DbConnectionBuilder {
}
```
-Chain a call to `.onDisconnect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote module, either as a result of a call to [`disconnect`](#method-disconnect) or due to an error.
+Chain a call to `.onDisconnect(callback)` to your builder to register a callback to run when your `DbConnection` disconnects from the remote database, either as a result of a call to [`disconnect`](#method-disconnect) or due to an error.
#### Method `withToken`
diff --git a/docs/sdks/typescript/quickstart.md b/docs/sdks/typescript/quickstart.md
index 4978ddbe..b47bd9fc 100644
--- a/docs/sdks/typescript/quickstart.md
+++ b/docs/sdks/typescript/quickstart.md
@@ -7,7 +7,7 @@ Please note that TypeScript is supported as a client language only. **Before you
- [Rust](/docs/modules/rust/quickstart)
- [C#](/docs/modules/c-sharp/quickstart)
-By the end of this introduciton, you will have created a basic single page web app which connects to the `quickstart-chat` module created in the above module quickstart guides.
+By the end of this introduciton, you will have created a basic single page web app which connects to the `quickstart-chat` database created in the above module quickstart guides.
## Project structure
@@ -393,7 +393,7 @@ import { Identity } from '@clockworklabs/spacetimedb-sdk';
## Create your SpacetimeDB client
-Now that we've imported the `DbConnection` type, we can use it to connect our app to our module.
+Now that we've imported the `DbConnection` type, we can use it to connect our app to our database.
Add the following to your `App` function, just below `const [newMessage, setNewMessage] = useState('');`:
@@ -630,7 +630,7 @@ Try opening a few incognito windows to see what it's like with multiple users!
### Notify about new users
-We can also register `onInsert` and `onDelete` callbacks for the purpose of handling events, not just state. For example, we might want to show a notification any time a new user connects to the module.
+We can also register `onInsert` and `onDelete` callbacks for the purpose of handling events, not just state. For example, we might want to show a notification any time a new user connects to the database.
Note that these callbacks can fire in two contexts:
diff --git a/docs/unity/part-1.md b/docs/unity/part-1.md
index f19a28bf..ebe81167 100644
--- a/docs/unity/part-1.md
+++ b/docs/unity/part-1.md
@@ -83,8 +83,8 @@ When you build a new connection to SpacetimeDB, that connection will be added to
Click on the `GameManager` object in the scene and click **Add Component**. Search for and select the `SpacetimeDBNetworkManager` to add it to your `GameManager` object.
-Our Unity project is all set up! If you press play, it will show a blank screen, but it should start the game without any errors. Now we're ready to get started on our SpacetimeDB server module, so we have something to connect to!
+Our Unity project is all set up! If you press play, it will show a blank screen, but it should start the game without any errors. Now we're ready to get started on our SpacetimeDB database server, so we have something to connect to!
### Create the Server Module
-We've now got the very basics set up. In [part 2](part-2) you'll learn the basics of how how to create a SpacetimeDB server module and how to connect to it from your client.
\ No newline at end of file
+We've now got the very basics set up. In [part 2](part-2) you'll learn the basics of how how to create a SpacetimeDB server module and how to connect to the database from your client.
\ No newline at end of file
diff --git a/docs/unity/part-2.md b/docs/unity/part-2.md
index 3bb45476..367d6a88 100644
--- a/docs/unity/part-2.md
+++ b/docs/unity/part-2.md
@@ -382,7 +382,7 @@ You should see something like the following output:
### Connecting our Client
:::server-rust
-Next let's connect our client to our module. Let's start by modifying our `debug` reducer. Rename the reducer to be called `connect` and add `client_connected` in parentheses after `spacetimedb::reducer`. The end result should look like this:
+Next let's connect our client to our database. Let's start by modifying our `debug` reducer. Rename the reducer to be called `connect` and add `client_connected` in parentheses after `spacetimedb::reducer`. The end result should look like this:
```rust
#[spacetimedb::reducer(client_connected)]
@@ -397,11 +397,11 @@ The `client_connected` argument to the `spacetimedb::reducer` macro indicates to
> SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur.
>
> - `init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --delete-data`.
-> - `client_connected` - Called when a user connects to the SpacetimeDB module. Their identity can be found in the `sender` value of the `ReducerContext`.
-> - `client_disconnected` - Called when a user disconnects from the SpacetimeDB module.
+> - `client_connected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `sender` value of the `ReducerContext`.
+> - `client_disconnected` - Called when a user disconnects from the SpacetimeDB database.
:::
:::server-csharp
-Next let's connect our client to our module. Let's start by modifying our `Debug` reducer. Rename the reducer to be called `Connect` and add `ReducerKind.ClientConnected` in parentheses after `SpacetimeDB.Reducer`. The end result should look like this:
+Next let's connect our client to our database. Let's start by modifying our `Debug` reducer. Rename the reducer to be called `Connect` and add `ReducerKind.ClientConnected` in parentheses after `SpacetimeDB.Reducer`. The end result should look like this:
```csharp
[Reducer(ReducerKind.ClientConnected)]
@@ -411,13 +411,13 @@ public static void Connect(ReducerContext ctx)
}
```
-The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribute indicates to SpacetimeDB that this is a special reducer. This reducer is only every called by SpacetimeDB itself when a client connects to your module.
+The `ReducerKind.ClientConnected` argument to the `SpacetimeDB.Reducer` attribute indicates to SpacetimeDB that this is a special reducer. This reducer is only every called by SpacetimeDB itself when a client connects to your database.
> SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur.
>
> - `ReducerKind.Init` - Called the first time you publish your module and anytime you clear the database with `spacetime publish --delete-data`.
-> - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB module. Their identity can be found in the `Sender` value of the `ReducerContext`.
-> - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB module.
+> - `ReducerKind.ClientConnected` - Called when a user connects to the SpacetimeDB database. Their identity can be found in the `Sender` value of the `ReducerContext`.
+> - `ReducerKind.ClientDisconnected` - Called when a user disconnects from the SpacetimeDB database.
:::
Publish your module again by running:
@@ -462,7 +462,7 @@ This will generate a set of files in the `client-unity/Assets/autogen` directory
└── SpacetimeDBClient.g.cs
```
-This will also generate a file in the `client-unity/Assets/autogen/SpacetimeDBClient.g.cs` directory with a type aware `DbConnection` class. We will use this class to connect to your module from Unity.
+This will also generate a file in the `client-unity/Assets/autogen/SpacetimeDBClient.g.cs` directory with a type aware `DbConnection` class. We will use this class to connect to your database from Unity.
> IMPORTANT! At this point there will be an error in your Unity project. Due to a [known issue](https://docs.unity3d.com/6000.0/Documentation/Manual/csharp-compiler.html) with Unity and C# 9 you need to insert the following code into your Unity project.
>
@@ -475,7 +475,7 @@ This will also generate a file in the `client-unity/Assets/autogen/SpacetimeDBCl
>
> Add this snippet to the bottom of your `GameManager.cs` file in your Unity project. This will hopefully be resolved in Unity soon.
-### Connecting to the Module
+### Connecting to the Database
At this point we can set up Unity to connect your Unity client to the server. Replace your imports at the top of the `GameManager.cs` file with:
@@ -494,7 +494,7 @@ Replace the implementation of the `GameManager` class with the following.
public class GameManager : MonoBehaviour
{
const string SERVER_URL = "http://127.0.0.1:3000";
- const string MODULE_NAME = "blackholio";
+ const string DB_NAME = "blackholio";
public static event Action OnConnected;
public static event Action OnSubscriptionApplied;
@@ -512,13 +512,13 @@ public class GameManager : MonoBehaviour
Application.targetFrameRate = 60;
// In order to build a connection to SpacetimeDB we need to register
- // our callbacks and specify a SpacetimeDB server URI and module name.
+ // our callbacks and specify a SpacetimeDB server URI and database name.
var builder = DbConnection.Builder()
.OnConnect(HandleConnect)
.OnConnectError(HandleConnectError)
.OnDisconnect(HandleDisconnect)
.WithUri(SERVER_URL)
- .WithModuleName(MODULE_NAME);
+ .WithModuleName(DB_NAME);
// If the user has a SpacetimeDB auth token stored in the Unity PlayerPrefs,
// we can use it to authenticate the connection.
@@ -580,7 +580,7 @@ public class GameManager : MonoBehaviour
}
```
-Here we configure the connection to the database, by passing it some callbacks in addition to providing the `SERVER_URI` and `MODULE_NAME` to the connection. When the client connects, the SpacetimeDB SDK will call the `HandleConnect` method, allowing us to start up the game.
+Here we configure the connection to the database, by passing it some callbacks in addition to providing the `SERVER_URI` and `DB_NAME` to the connection. When the client connects, the SpacetimeDB SDK will call the `HandleConnect` method, allowing us to start up the game.
In our `HandleConnect` callback we building a subscription and are calling `Subscribe` and subscribing to all data in the database. This will cause SpacetimeDB to synchronize the state of all your tables with your Unity client's SpacetimeDB SDK's "client cache". You can also subscribe to specific tables using SQL syntax, e.g. `SELECT * FROM my_table`. Our [SQL documentation](/docs/sql) enumerates the operations that are accepted in our SQL syntax.
diff --git a/docs/unity/part-3.md b/docs/unity/part-3.md
index e4aef92c..9c632514 100644
--- a/docs/unity/part-3.md
+++ b/docs/unity/part-3.md
@@ -508,7 +508,7 @@ public static Entity SpawnCircleAt(ReducerContext ctx, uint player_id, uint mass
The `EnterGame` reducer takes one argument, the player's `name`. We can use this name to display as a label for the player in the match, by storing the name on the player's row. We are also spawning some circles for the player to control now that they are entering the game. To do this, we choose a random position within the bounds of the arena and create a new entity and corresponding circle row.
:::
-Let's also modify our `disconnect` reducer to remove the circles from the arena when the player disconnects from the server.
+Let's also modify our `disconnect` reducer to remove the circles from the arena when the player disconnects from the database server.
:::server-rust
```rust
diff --git a/docs/unity/part-4.md b/docs/unity/part-4.md
index 9ec81bd5..17797869 100644
--- a/docs/unity/part-4.md
+++ b/docs/unity/part-4.md
@@ -611,7 +611,7 @@ So far you've learned how to configure a new Unity project to work with Spacetim
So far you've learned how to configure a new Unity project to work with SpacetimeDB, how to develop, build, and publish a SpacetimeDB server module. Within the module, you've learned how to create tables, update tables, and write reducers. You've learned about special reducers like `ClientConnected` and `Init` and how to created scheduled reducers. You learned how we can used scheduled reducers to implement a physics simulation right within your module.
:::
-You've also learned how view module logs and connect your client to your server module, call reducers from the client and synchronize the data with client. Finally you learned how to use that synchronized data to draw game objects on the screen, so that we can interact with them and play a game!
+You've also learned how view module logs and connect your client to your database server, call reducers from the client and synchronize the data with client. Finally you learned how to use that synchronized data to draw game objects on the screen, so that we can interact with them and play a game!
And all of that completely from scratch!
From 6ea415a4839d7414232b9e8d223372b5167f50c8 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:18:50 +0100
Subject: [PATCH 02/11] the name is for the database, not the module
---
docs/deploying/spacetimedb-standalone.md | 2 +-
docs/http/database.md | 2 +-
docs/sdks/c-sharp/index.md | 6 +++---
docs/sdks/c-sharp/quickstart.md | 4 ++--
docs/sdks/rust/index.md | 4 ++--
docs/sdks/typescript/index.md | 4 ++--
docs/sdks/typescript/quickstart.md | 4 ++--
docs/unity/part-3.md | 2 +-
docs/unity/part-4.md | 10 +++++-----
9 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/docs/deploying/spacetimedb-standalone.md b/docs/deploying/spacetimedb-standalone.md
index 34cb8ccf..49b92c27 100644
--- a/docs/deploying/spacetimedb-standalone.md
+++ b/docs/deploying/spacetimedb-standalone.md
@@ -168,7 +168,7 @@ If you have uncommented the `/v1/publish` restriction in Step 3 then you won't b
```bash
spacetime build
scp target/wasm32-unknown-unknown/release/spacetime_module.wasm ubuntu@:/home/ubuntu/
-ssh ubuntu@ spacetime publish -s local --bin-path spacetime_module.wasm
+ssh ubuntu@ spacetime publish -s local --bin-path spacetime_module.wasm
```
You could put the above commands into a shell script to make publishing to your server easier and faster. It's also possible to integrate a script like this into Github Actions to publish on some event (like a PR merging into master).
diff --git a/docs/http/database.md b/docs/http/database.md
index 0ac41070..de495511 100644
--- a/docs/http/database.md
+++ b/docs/http/database.md
@@ -127,7 +127,7 @@ Accessible through the CLI as `spacetime delete `.
## `GET /v1/database/:name_or_identity/names`
-Get the names this datbase can be identified by.
+Get the names this database can be identified by.
#### Returns
diff --git a/docs/sdks/c-sharp/index.md b/docs/sdks/c-sharp/index.md
index 7e97c3f1..3e6c22a0 100644
--- a/docs/sdks/c-sharp/index.md
+++ b/docs/sdks/c-sharp/index.md
@@ -66,12 +66,12 @@ class DbConnection
}
```
-Construct a `DbConnection` by calling `DbConnection.Builder()`, chaining configuration methods, and finally calling `.Build()`. At a minimum, you must specify `WithUri` to provide the URI of the SpacetimeDB instance, and `WithModuleName` to specify the module's name or identity.
+Construct a `DbConnection` by calling `DbConnection.Builder()`, chaining configuration methods, and finally calling `.Build()`. At a minimum, you must specify `WithUri` to provide the URI of the SpacetimeDB instance, and `WithModuleName` to specify the database's name or identity.
| Name | Description |
|---------------------------------------------------------|--------------------------------------------------------------------------------------------|
| [WithUri method](#method-withuri) | Set the URI of the SpacetimeDB instance hosting the remote database. |
-| [WithModuleName method](#method-withmodulename) | Set the name or identity of the remote module. |
+| [WithModuleName method](#method-withmodulename) | Set the name or identity of the remote database. |
| [OnConnect callback](#callback-onconnect) | Register a callback to run when the connection is successfully established. |
| [OnConnectError callback](#callback-onconnecterror) | Register a callback to run if the connection is rejected or the host is unreachable. |
| [OnDisconnect callback](#callback-ondisconnect) | Register a callback to run when the connection ends. |
@@ -98,7 +98,7 @@ class DbConnectionBuilder
}
```
-Configure the SpacetimeDB domain name or `Identity` of the remote module which identifies it within the SpacetimeDB instance or cluster.
+Configure the SpacetimeDB domain name or `Identity` of the remote database which identifies it within the SpacetimeDB instance or cluster.
### Callback `OnConnect`
diff --git a/docs/sdks/c-sharp/quickstart.md b/docs/sdks/c-sharp/quickstart.md
index b8a1dce1..aa41a3e7 100644
--- a/docs/sdks/c-sharp/quickstart.md
+++ b/docs/sdks/c-sharp/quickstart.md
@@ -121,7 +121,7 @@ void Main()
## Connect to database
-Before we connect, we'll store the SpacetimeDB host name and our module name in constants `HOST` and `DB_NAME`.
+Before we connect, we'll store the SpacetimeDB host name and our database name in constants `HOST` and `DB_NAME`.
A connection to a SpacetimeDB database is represented by a `DbConnection`. We configure `DbConnection`s using the builder pattern, by calling `DbConnection.Builder()`, chaining method calls to set various connection parameters and register callbacks, then we cap it off with a call to `.Build()` to begin the connection.
@@ -140,7 +140,7 @@ To `Program.cs`, add:
/// The URI of the SpacetimeDB instance hosting our chat module.
const string HOST = "http://localhost:3000";
-/// The module name we chose when we published our module.
+/// The database name we chose when we published our module.
const string DBNAME = "quickstart-chat";
/// Load credentials from a file and connect to the database.
diff --git a/docs/sdks/rust/index.md b/docs/sdks/rust/index.md
index 887ac50a..4ff515f7 100644
--- a/docs/sdks/rust/index.md
+++ b/docs/sdks/rust/index.md
@@ -65,7 +65,7 @@ impl DbConnection {
}
```
-Construct a `DbConnection` by calling `DbConnection::builder()` and chaining configuration methods, then calling `.build()`. You must at least specify `with_uri`, to supply the URI of the SpacetimeDB to which you published your module, and `with_module_name`, to supply the human-readable SpacetimeDB domain name or the raw `Identity` which identifies the module.
+Construct a `DbConnection` by calling `DbConnection::builder()` and chaining configuration methods, then calling `.build()`. You must at least specify `with_uri`, to supply the URI of the SpacetimeDB to which you published your module, and `with_module_name`, to supply the human-readable SpacetimeDB domain name or the raw `Identity` which identifies the database.
| Name | Description |
|-----------------------------------------------------------|--------------------------------------------------------------------------------------|
@@ -95,7 +95,7 @@ impl DbConnectionBuilder {
}
```
-Configure the SpacetimeDB domain name or `Identity` of the remote module which identifies it within the SpacetimeDB instance or cluster.
+Configure the SpacetimeDB domain name or `Identity` of the remote database which identifies it within the SpacetimeDB instance or cluster.
#### Callback `on_connect`
diff --git a/docs/sdks/typescript/index.md b/docs/sdks/typescript/index.md
index b670c5f8..71c5bb10 100644
--- a/docs/sdks/typescript/index.md
+++ b/docs/sdks/typescript/index.md
@@ -106,7 +106,7 @@ class DbConnection {
}
```
-Construct a `DbConnection` by calling `DbConnection.builder()` and chaining configuration methods, then calling `.build()`. You must at least specify `withUri`, to supply the URI of the SpacetimeDB to which you published your module, and `withModuleName`, to supply the human-readable SpacetimeDB domain name or the raw `Identity` which identifies the module.
+Construct a `DbConnection` by calling `DbConnection.builder()` and chaining configuration methods, then calling `.build()`. You must at least specify `withUri`, to supply the URI of the SpacetimeDB to which you published your module, and `withModuleName`, to supply the human-readable SpacetimeDB domain name or the raw `Identity` which identifies the database.
| Name | Description |
|-------------------------------------------------------|--------------------------------------------------------------------------------------|
@@ -137,7 +137,7 @@ class DbConnectionBuilder {
```
-Configure the SpacetimeDB domain name or hex string encoded `Identity` of the remote module which identifies it within the SpacetimeDB instance or cluster.
+Configure the SpacetimeDB domain name or hex string encoded `Identity` of the remote database which identifies it within the SpacetimeDB instance or cluster.
#### Callback `onConnect`
diff --git a/docs/sdks/typescript/quickstart.md b/docs/sdks/typescript/quickstart.md
index b47bd9fc..a99a03fd 100644
--- a/docs/sdks/typescript/quickstart.md
+++ b/docs/sdks/typescript/quickstart.md
@@ -459,11 +459,11 @@ Add the following to your `App` function, just below `const [newMessage, setNewM
}, []);
```
-Here we are configuring our SpacetimeDB connection by specifying the server URI, module name, and a few callbacks including the `onConnect` callback. When `onConnect` is called after connecting, we store the connection state, our `Identity`, and our SpacetimeDB credentials in our React state. If there is an error connecting, we print that error to the console as well.
+Here we are configuring our SpacetimeDB connection by specifying the server URI, database name, and a few callbacks including the `onConnect` callback. When `onConnect` is called after connecting, we store the connection state, our `Identity`, and our SpacetimeDB credentials in our React state. If there is an error connecting, we print that error to the console as well.
We are also using `localStorage` to store our SpacetimeDB credentials. This way, we can reconnect to SpacetimeDB with the same `Identity` and token if we refresh the page. The first time we connect, we won't have any credentials stored, so we pass `undefined` to the `withToken` method. This will cause SpacetimeDB to generate new credentials for us.
-If you chose a different name for your module, replace `quickstart-chat` with that name, or republish your module as `quickstart-chat`.
+If you chose a different name for your database, replace `quickstart-chat` with that name, or republish your module as `quickstart-chat`.
In the `onConnect` function we are also subscribing to the `message` and `user` tables. When we subscribe, SpacetimeDB will run our subscription queries and store the result in a local "client cache". This cache will be updated in real-time as the data in the table changes on the server. The `onApplied` callback is called after SpacetimeDB has synchronized our subscribed data with the client cache.
diff --git a/docs/unity/part-3.md b/docs/unity/part-3.md
index 9c632514..cbbfc034 100644
--- a/docs/unity/part-3.md
+++ b/docs/unity/part-3.md
@@ -1208,7 +1208,7 @@ At this point, after publishing our module we can press the play button to see t
- If you get an error when running the generate command, make sure you have an empty subfolder in your Unity project Assets folder called `autogen`
-- If you get an error in your Unity console when starting the game, double check that you have published your module and you have the correct module name specified in your `GameManager`.
+- If you get an error in your Unity console when starting the game, double check that you have published your module and you have the correct database name specified in your `GameManager`.
### Next Steps
diff --git a/docs/unity/part-4.md b/docs/unity/part-4.md
index 17797869..93a84cfd 100644
--- a/docs/unity/part-4.md
+++ b/docs/unity/part-4.md
@@ -579,15 +579,15 @@ We didn't even have to update the client, because our client's `OnDelete` callba
Notice that the food automatically respawns as you vaccuum them up. This is because our scheduled reducer is automatically replacing the food 2 times per second, to ensure that there is always 600 food on the map.
## Connecting to Maincloud
-- Publish to Maincloud `spacetime publish -s maincloud --delete-data`
- - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`).
+- Publish to Maincloud `spacetime publish -s maincloud --delete-data`
+ - `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`).
- Update the URL in the Unity project to: `https://maincloud.spacetimedb.com`
-- Update the module name in the Unity project to ``.
+- Update the database name in the Unity project to ``.
- Clear the PlayerPrefs in Start() within `GameManager.cs`
- Your `GameManager.cs` should look something like this:
```csharp
const string SERVER_URL = "https://maincloud.spacetimedb.com";
-const string MODULE_NAME = "";
+const string DB_NAME = "";
...
@@ -600,7 +600,7 @@ private void Start()
}
```
-To delete your Maincloud module, you can run: `spacetime delete -s maincloud `
+To delete your Maincloud database, you can run: `spacetime delete -s maincloud `
# Conclusion
From 20b2e7ba804861219a3a50a7dd2722d21d0d2130 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:22:23 +0100
Subject: [PATCH 03/11] reducers are exposed by databases, not modules
---
docs/sdks/c-sharp/index.md | 14 +++++++-------
docs/sdks/rust/index.md | 14 +++++++-------
docs/sdks/typescript/index.md | 16 ++++++++--------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/docs/sdks/c-sharp/index.md b/docs/sdks/c-sharp/index.md
index 3e6c22a0..21abea4a 100644
--- a/docs/sdks/c-sharp/index.md
+++ b/docs/sdks/c-sharp/index.md
@@ -222,7 +222,7 @@ The `IDbContext` interface is implemented by connections and contexts to *every*
|---------------------------------------------------------------|--------------------------------------------------------------------------|
| [`IRemoteDbContext` interface](#interface-iremotedbcontext) | Module-specific `IDbContext`. |
| [`Db` method](#method-db) | Provides access to the subscribed view of the remote database's tables. |
-| [`Reducers` method](#method-reducers) | Provides access to reducers exposed by the remote module. |
+| [`Reducers` method](#method-reducers) | Provides access to reducers exposed by the remote database. |
| [`Disconnect` method](#method-disconnect) | End the connection. |
| [Subscribe to queries](#subscribe-to-queries) | Register SQL queries to receive updates about matching rows. |
| [Read connection metadata](#read-connection-metadata) | Access the connection's `Identity` and `ConnectionId` |
@@ -498,7 +498,7 @@ class EventContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Record `Event`
@@ -522,7 +522,7 @@ record Event
}
```
-Event when we are notified that a reducer ran in the remote module. The [`ReducerEvent`](#record-reducerevent) contains metadata about the reducer run, including its arguments and termination [`Status`](#record-status).
+Event when we are notified that a reducer ran in the remote database. The [`ReducerEvent`](#record-reducerevent) contains metadata about the reducer run, including its arguments and termination [`Status`](#record-status).
This event is passed to row callbacks resulting from modifications by the reducer.
@@ -574,7 +574,7 @@ record Event
}
```
-Event when we are notified of a transaction in the remote module which we cannot associate with a known reducer. This may be an ad-hoc SQL query or a reducer for which we do not have bindings.
+Event when we are notified of a transaction in the remote database which we cannot associate with a known reducer. This may be an ad-hoc SQL query or a reducer for which we do not have bindings.
This event is passed to [row callbacks](#callback-oninsert) resulting from modifications by the transaction.
@@ -668,7 +668,7 @@ class ReducerEventContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `SubscriptionEventContext`
@@ -699,7 +699,7 @@ class SubscriptionEventContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `ErrorContext`
@@ -741,7 +741,7 @@ class ErrorContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Access the client cache
diff --git a/docs/sdks/rust/index.md b/docs/sdks/rust/index.md
index 4ff515f7..941bb819 100644
--- a/docs/sdks/rust/index.md
+++ b/docs/sdks/rust/index.md
@@ -220,7 +220,7 @@ struct DbConnection {
}
```
-The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Trait `DbContext`
@@ -528,7 +528,7 @@ struct EventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Enum `Event`
@@ -553,7 +553,7 @@ spacetimedb_sdk::Event
spacetimedb_sdk::Event::Reducer(spacetimedb_sdk::ReducerEvent)
```
-Event when we are notified that a reducer ran in the remote module. The [`ReducerEvent`](#struct-reducerevent) contains metadata about the reducer run, including its arguments and termination [`Status`](#enum-status).
+Event when we are notified that a reducer ran in the remote database. The [`ReducerEvent`](#struct-reducerevent) contains metadata about the reducer run, including its arguments and termination [`Status`](#enum-status).
This event is passed to row callbacks resulting from modifications by the reducer.
@@ -589,7 +589,7 @@ This event is passed to [row `on_delete` callbacks](#callback-on_delete) resulti
#### Variant `UnknownTransaction`
-Event when we are notified of a transaction in the remote module which we cannot associate with a known reducer. This may be an ad-hoc SQL query or a reducer for which we do not have bindings.
+Event when we are notified of a transaction in the remote database which we cannot associate with a known reducer. This may be an ad-hoc SQL query or a reducer for which we do not have bindings.
This event is passed to [row callbacks](#callback-on_insert) resulting from modifications by the transaction.
@@ -710,7 +710,7 @@ struct ReducerEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `SubscriptionEventContext`
@@ -741,7 +741,7 @@ struct SubscriptionEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `ErrorContext`
@@ -783,7 +783,7 @@ struct ErrorContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Access the client cache
diff --git a/docs/sdks/typescript/index.md b/docs/sdks/typescript/index.md
index 71c5bb10..6d6f7afe 100644
--- a/docs/sdks/typescript/index.md
+++ b/docs/sdks/typescript/index.md
@@ -216,7 +216,7 @@ class DbConnection {
}
```
-The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Interface `DbContext`
@@ -257,7 +257,7 @@ interface DbContext {
}
```
-The `reducers` field of a `DbContext` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of a `DbContext` provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Method `disconnect`
@@ -469,7 +469,7 @@ class EventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Type `Event`
@@ -499,7 +499,7 @@ type Event =
{ tag: 'Reducer'; value: ReducerEvent }
```
-Event when we are notified that a reducer ran in the remote module. The [`ReducerEvent`](#type-reducerevent) contains metadata about the reducer run, including its arguments and termination status(#type-updatestatus).
+Event when we are notified that a reducer ran in the remote database. The [`ReducerEvent`](#type-reducerevent) contains metadata about the reducer run, including its arguments and termination status(#type-updatestatus).
This event is passed to row callbacks resulting from modifications by the reducer.
@@ -540,7 +540,7 @@ This event is passed to [row `onDelete` callbacks](#callback-ondelete) resulting
{ tag: 'UnknownTransaction' }
```
-Event when we are notified of a transaction in the remote module which we cannot associate with a known reducer. This may be an ad-hoc SQL query or a reducer for which we do not have bindings.
+Event when we are notified of a transaction in the remote database which we cannot associate with a known reducer. This may be an ad-hoc SQL query or a reducer for which we do not have bindings.
This event is passed to [row callbacks](#callback-oninsert) resulting from modifications by the transaction.
@@ -676,7 +676,7 @@ class ReducerEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `SubscriptionEventContext`
@@ -705,7 +705,7 @@ class SubscriptionEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `ErrorContext`
@@ -744,7 +744,7 @@ class ErrorContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Access the client cache
From 15af09c2b8d3903e42968988de62ed5594abc046 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:22:46 +0100
Subject: [PATCH 04/11] don't name clients "modules" too
---
docs/modules/c-sharp/quickstart.md | 2 +-
docs/modules/rust/quickstart.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/modules/c-sharp/quickstart.md b/docs/modules/c-sharp/quickstart.md
index 42e15ab8..83eea400 100644
--- a/docs/modules/c-sharp/quickstart.md
+++ b/docs/modules/c-sharp/quickstart.md
@@ -311,6 +311,6 @@ spacetime sql quickstart-chat "SELECT * FROM Message"
You've just set up your first database in SpacetimeDB! You can find the full code for this client [in the C# server module example](https://github.com/clockworklabs/com.clockworklabs.spacetimedbsdk/tree/master/examples~/quickstart-chat/server).
-The next step would be to create a client module that interacts with this module. You can use any of SpacetimDB's supported client languages to do this. Take a look at the quick start guide for your client language of choice: [Rust](/docs/sdks/rust/quickstart), [C#](/docs/sdks/c-sharp/quickstart), or [TypeScript](/docs/sdks/typescript/quickstart).
+The next step would be to create a client that interacts with this module. You can use any of SpacetimDB's supported client languages to do this. Take a look at the quick start guide for your client language of choice: [Rust](/docs/sdks/rust/quickstart), [C#](/docs/sdks/c-sharp/quickstart), or [TypeScript](/docs/sdks/typescript/quickstart).
If you are planning to use SpacetimeDB with the Unity game engine, you can skip right to the [Unity Comprehensive Tutorial](/docs/unity/part-1).
diff --git a/docs/modules/rust/quickstart.md b/docs/modules/rust/quickstart.md
index cbb80154..b65f3af3 100644
--- a/docs/modules/rust/quickstart.md
+++ b/docs/modules/rust/quickstart.md
@@ -275,6 +275,6 @@ spacetime sql quickstart-chat "SELECT * FROM message"
You can find the full code for this module [in the SpacetimeDB module examples](https://github.com/clockworklabs/SpacetimeDB/tree/master/modules/quickstart-chat).
-You've just set up your first database in SpacetimeDB! The next step would be to create a client module that interacts with this module. You can use any of SpacetimDB's supported client languages to do this. Take a look at the quickstart guide for your client language of choice: [Rust](/docs/sdks/rust/quickstart), [C#](/docs/sdks/c-sharp/quickstart), or [TypeScript](/docs/sdks/typescript/quickstart).
+You've just set up your first database in SpacetimeDB! The next step would be to create a client that interacts with this module. You can use any of SpacetimDB's supported client languages to do this. Take a look at the quickstart guide for your client language of choice: [Rust](/docs/sdks/rust/quickstart), [C#](/docs/sdks/c-sharp/quickstart), or [TypeScript](/docs/sdks/typescript/quickstart).
If you are planning to use SpacetimeDB with the Unity game engine, you can skip right to the [Unity Comprehensive Tutorial](/docs/unity/part-1).
From c4a32b1fb76e8f16987f7e9337eb832f1d1bbe2a Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:23:50 +0100
Subject: [PATCH 05/11] Modules have no state, the database has it
---
docs/unity/part-3.md | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/docs/unity/part-3.md b/docs/unity/part-3.md
index cbbfc034..a5f10e0f 100644
--- a/docs/unity/part-3.md
+++ b/docs/unity/part-3.md
@@ -7,7 +7,7 @@ This progressive tutorial is continued from [part 2](/docs/unity/part-2).
### Spawning Food
:::server-rust
-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 module 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 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.
@@ -78,7 +78,7 @@ pub fn spawn_food(ctx: &ReducerContext) -> Result<(), String> {
```
:::
:::server-csharp
-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 module 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.
From 64fd3c9efc31c185c6f66e32c5a3f92ee7d7c0e6 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:24:03 +0100
Subject: [PATCH 06/11] more database instead of client connection
---
docs/unity/part-2.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/docs/unity/part-2.md b/docs/unity/part-2.md
index 367d6a88..c2685eab 100644
--- a/docs/unity/part-2.md
+++ b/docs/unity/part-2.md
@@ -392,7 +392,7 @@ pub fn connect(ctx: &ReducerContext) -> Result<(), String> {
}
```
-The `client_connected` argument to the `spacetimedb::reducer` macro indicates to SpacetimeDB that this is a special reducer. This reducer is only every called by SpacetimeDB itself when a client connects to your module.
+The `client_connected` argument to the `spacetimedb::reducer` macro indicates to SpacetimeDB that this is a special reducer. This reducer is only every called by SpacetimeDB itself when a client connects to your database.
> SpacetimeDB gives you the ability to define custom reducers that automatically trigger when certain events occur.
>
From d16fb51fb90b21edd0162bd4f59937935d07ee61 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:25:11 +0100
Subject: [PATCH 07/11] databases are hosted, not modules
---
docs/modules/c-sharp/index.md | 2 +-
docs/sdks/c-sharp/index.md | 2 +-
docs/sdks/c-sharp/quickstart.md | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/docs/modules/c-sharp/index.md b/docs/modules/c-sharp/index.md
index 3237e020..9074bf67 100644
--- a/docs/modules/c-sharp/index.md
+++ b/docs/modules/c-sharp/index.md
@@ -1002,7 +1002,7 @@ namespace SpacetimeDB
Methods for writing to a private debug log. Log messages will include file and line numbers.
-Log outputs of a running module can be inspected using the `spacetime logs` command:
+Log outputs of a running database can be inspected using the `spacetime logs` command:
```text
spacetime logs
diff --git a/docs/sdks/c-sharp/index.md b/docs/sdks/c-sharp/index.md
index 21abea4a..bce98160 100644
--- a/docs/sdks/c-sharp/index.md
+++ b/docs/sdks/c-sharp/index.md
@@ -87,7 +87,7 @@ class DbConnectionBuilder
}
```
-Configure the URI of the SpacetimeDB instance or cluster which hosts the remote module.
+Configure the URI of the SpacetimeDB instance or cluster which hosts the remote database attached to the module.
### Method `WithModuleName`
diff --git a/docs/sdks/c-sharp/quickstart.md b/docs/sdks/c-sharp/quickstart.md
index aa41a3e7..4053d90d 100644
--- a/docs/sdks/c-sharp/quickstart.md
+++ b/docs/sdks/c-sharp/quickstart.md
@@ -127,7 +127,7 @@ A connection to a SpacetimeDB database is represented by a `DbConnection`. We co
In our case, we'll supply the following options:
-1. A `WithUri` call, to specify the URI of the SpacetimeDB host where our module is running.
+1. A `WithUri` call, to specify the URI of the SpacetimeDB host where our database is running.
2. A `WithModuleName` call, to specify the name or `Identity` of our database. Make sure to pass the same name here as you supplied to `spacetime publish`.
3. A `WithToken` call, to supply a token to authenticate with.
4. An `OnConnect` callback, to run when the remote database acknowledges and accepts our connection.
@@ -137,7 +137,7 @@ In our case, we'll supply the following options:
To `Program.cs`, add:
```csharp
-/// The URI of the SpacetimeDB instance hosting our chat module.
+/// The URI of the SpacetimeDB instance hosting our database containing the chat module.
const string HOST = "http://localhost:3000";
/// The database name we chose when we published our module.
From 6aa5d9c881c1e9cd8561eea85297a5dec61a8d81 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:25:37 +0100
Subject: [PATCH 08/11] users interact with databases, not modules
---
docs/index.md | 2 +-
docs/sdks/c-sharp/index.md | 4 ++--
docs/sdks/c-sharp/quickstart.md | 6 +++---
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/docs/index.md b/docs/index.md
index ad712251..a8b671c0 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -229,7 +229,7 @@ Clients are regular software applications that developers can choose how to depl
### Identity
-A SpacetimeDB `Identity` identifies someone interacting with a module. It is a long lived, public, globally valid identifier that will always refer to the same end user, even across different connections.
+A SpacetimeDB `Identity` identifies someone interacting with a database. It is a long lived, public, globally valid identifier that will always refer to the same end user, even across different connections.
A user's `Identity` is attached to every [reducer call](#reducer) they make, and you can use this to decide what they are allowed to do.
diff --git a/docs/sdks/c-sharp/index.md b/docs/sdks/c-sharp/index.md
index bce98160..ae30518c 100644
--- a/docs/sdks/c-sharp/index.md
+++ b/docs/sdks/c-sharp/index.md
@@ -191,7 +191,7 @@ class DbConnection
}
```
-The `Db` property of the `DbConnection` provides access to the subscribed view of the remote database's tables. See [Access the client cache](#access-the-client-cache).
+The `Db` property of the `DbConnection` provides access to the subscribed view of the remote database module's tables. See [Access the client cache](#access-the-client-cache).
### Property `Reducers`
@@ -203,7 +203,7 @@ class DbConnection
}
```
-The `Reducers` field of the `DbConnection` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` field of the `DbConnection` provides access to reducers exposed by the module of the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Interface `IDbContext`
diff --git a/docs/sdks/c-sharp/quickstart.md b/docs/sdks/c-sharp/quickstart.md
index 4053d90d..a42765fa 100644
--- a/docs/sdks/c-sharp/quickstart.md
+++ b/docs/sdks/c-sharp/quickstart.md
@@ -453,7 +453,7 @@ void PrintMessagesInOrder(RemoteTables tables)
Since the input loop will be blocking, we'll run our processing code in a separate thread.
-This thread will loop until the thread is signaled to exit, calling the update function `FrameTick` on the `DbConnection` to process any updates received from the module, and `ProcessCommand` to process any commands received from the input loop.
+This thread will loop until the thread is signaled to exit, calling the update function `FrameTick` on the `DbConnection` to process any updates received from the database, and `ProcessCommand` to process any commands received from the input loop.
Afterward, close the connection to the database.
@@ -488,9 +488,9 @@ The input loop will read commands from standard input and send them to the proce
Supported Commands:
-1. Send a message: `message`, send the message to the module by calling `Reducer.SendMessage` which is automatically generated by `spacetime generate`.
+1. Send a message: `message`, send the message to the database by calling `Reducer.SendMessage` which is automatically generated by `spacetime generate`.
-2. Set name: `name`, will send the new name to the module by calling `Reducer.SetName` which is automatically generated by `spacetime generate`.
+2. Set name: `name`, will send the new name to the database by calling `Reducer.SetName` which is automatically generated by `spacetime generate`.
To `Program.cs`, add:
From bc1cbb27d93250b627f511d3408cacfca6d8a2a2 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 27 Mar 2025 18:25:42 +0100
Subject: [PATCH 09/11] fix typo
---
STYLE.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/STYLE.md b/STYLE.md
index b9d80706..31481db8 100644
--- a/STYLE.md
+++ b/STYLE.md
@@ -337,7 +337,7 @@ The first time a tutorial or series introduces a new type / function / method /
### Tutorial code
-If the tutorial involves writing code, e.g. for a module or client, the tutorial should include the complete result code within its text. Ideally, it should be possible for a reader to copy and paste all the code blocks in the document into a file, effectively concatentating them together, and wind up with a coherent and runnable program. Sometimes this is not possible, e.g. because C# requires wrapping your whole file in a bunch of scopes. In this case, precede each code block with a sentence that describes where the reader is going to paste it.
+If the tutorial involves writing code, e.g. for a module or client, the tutorial should include the complete result code within its text. Ideally, it should be possible for a reader to copy and paste all the code blocks in the document into a file, effectively concatenating them together, and wind up with a coherent and runnable program. Sometimes this is not possible, e.g. because C# requires wrapping your whole file in a bunch of scopes. In this case, precede each code block with a sentence that describes where the reader is going to paste it.
Include even uninteresting code, like imports! You can rush through these without spending too much time on them, but make sure that every line of code required to make the project work appears in the tutorial.
From 9d674f0db7f521549af1d7a7c44fea0b7604c0d1 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Wed, 2 Apr 2025 21:03:09 +0200
Subject: [PATCH 10/11] Apply suggestions from code review
Co-authored-by: Tyler Cloutier
---
docs/sdks/c-sharp/index.md | 12 ++++++------
docs/sdks/c-sharp/quickstart.md | 4 ++--
docs/sdks/rust/index.md | 10 +++++-----
docs/sdks/rust/quickstart.md | 2 +-
docs/sdks/typescript/index.md | 12 ++++++------
docs/unity/part-1.md | 4 ++--
docs/unity/part-2.md | 2 +-
docs/unity/part-3.md | 2 +-
8 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/docs/sdks/c-sharp/index.md b/docs/sdks/c-sharp/index.md
index ae30518c..3fd4c9b0 100644
--- a/docs/sdks/c-sharp/index.md
+++ b/docs/sdks/c-sharp/index.md
@@ -87,7 +87,7 @@ class DbConnectionBuilder
}
```
-Configure the URI of the SpacetimeDB instance or cluster which hosts the remote database attached to the module.
+Configure the URI of the SpacetimeDB instance or cluster which hosts the remote module and database.
### Method `WithModuleName`
@@ -191,7 +191,7 @@ class DbConnection
}
```
-The `Db` property of the `DbConnection` provides access to the subscribed view of the remote database module's tables. See [Access the client cache](#access-the-client-cache).
+The `Db` property of the `DbConnection` provides access to the subscribed view of the remote database's tables. See [Access the client cache](#access-the-client-cache).
### Property `Reducers`
@@ -222,7 +222,7 @@ The `IDbContext` interface is implemented by connections and contexts to *every*
|---------------------------------------------------------------|--------------------------------------------------------------------------|
| [`IRemoteDbContext` interface](#interface-iremotedbcontext) | Module-specific `IDbContext`. |
| [`Db` method](#method-db) | Provides access to the subscribed view of the remote database's tables. |
-| [`Reducers` method](#method-reducers) | Provides access to reducers exposed by the remote database. |
+| [`Reducers` method](#method-reducers) | Provides access to reducers exposed by the remote module. |
| [`Disconnect` method](#method-disconnect) | End the connection. |
| [Subscribe to queries](#subscribe-to-queries) | Register SQL queries to receive updates about matching rows. |
| [Read connection metadata](#read-connection-metadata) | Access the connection's `Identity` and `ConnectionId` |
@@ -498,7 +498,7 @@ class EventContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Record `Event`
@@ -668,7 +668,7 @@ class ReducerEventContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `SubscriptionEventContext`
@@ -699,7 +699,7 @@ class SubscriptionEventContext {
}
```
-The `Reducers` property of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `Reducers` property of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `ErrorContext`
diff --git a/docs/sdks/c-sharp/quickstart.md b/docs/sdks/c-sharp/quickstart.md
index a42765fa..44065195 100644
--- a/docs/sdks/c-sharp/quickstart.md
+++ b/docs/sdks/c-sharp/quickstart.md
@@ -121,7 +121,7 @@ void Main()
## Connect to database
-Before we connect, we'll store the SpacetimeDB host name and our database name in constants `HOST` and `DB_NAME`.
+Before we connect, we'll store the SpacetimeDB hostname and our database name in constants `HOST` and `DB_NAME`.
A connection to a SpacetimeDB database is represented by a `DbConnection`. We configure `DbConnection`s using the builder pattern, by calling `DbConnection.Builder()`, chaining method calls to set various connection parameters and register callbacks, then we cap it off with a call to `.Build()` to begin the connection.
@@ -137,7 +137,7 @@ In our case, we'll supply the following options:
To `Program.cs`, add:
```csharp
-/// The URI of the SpacetimeDB instance hosting our database containing the chat module.
+/// The URI of the SpacetimeDB instance hosting our chat database and module.
const string HOST = "http://localhost:3000";
/// The database name we chose when we published our module.
diff --git a/docs/sdks/rust/index.md b/docs/sdks/rust/index.md
index 941bb819..4c180f52 100644
--- a/docs/sdks/rust/index.md
+++ b/docs/sdks/rust/index.md
@@ -220,7 +220,7 @@ struct DbConnection {
}
```
-The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Trait `DbContext`
@@ -528,7 +528,7 @@ struct EventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Enum `Event`
@@ -710,7 +710,7 @@ struct ReducerEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `SubscriptionEventContext`
@@ -741,7 +741,7 @@ struct SubscriptionEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `ErrorContext`
@@ -783,7 +783,7 @@ struct ErrorContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Access the client cache
diff --git a/docs/sdks/rust/quickstart.md b/docs/sdks/rust/quickstart.md
index c0faac40..a2be2000 100644
--- a/docs/sdks/rust/quickstart.md
+++ b/docs/sdks/rust/quickstart.md
@@ -136,7 +136,7 @@ In our case, we'll supply the following options:
To `client/src/main.rs`, add:
```rust
-/// The URI of the SpacetimeDB instance hosting our database containing chat module.
+/// The URI of the SpacetimeDB instance hosting our chat database and module.
const HOST: &str = "http://localhost:3000";
/// The database name we chose when we published our module.
diff --git a/docs/sdks/typescript/index.md b/docs/sdks/typescript/index.md
index 6d6f7afe..a4732d3d 100644
--- a/docs/sdks/typescript/index.md
+++ b/docs/sdks/typescript/index.md
@@ -216,7 +216,7 @@ class DbConnection {
}
```
-The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the `DbConnection` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Interface `DbContext`
@@ -257,7 +257,7 @@ interface DbContext {
}
```
-The `reducers` field of a `DbContext` provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of a `DbContext` provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Method `disconnect`
@@ -469,7 +469,7 @@ class EventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
### Type `Event`
@@ -676,7 +676,7 @@ class ReducerEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `SubscriptionEventContext`
@@ -705,7 +705,7 @@ class SubscriptionEventContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Type `ErrorContext`
@@ -744,7 +744,7 @@ class ErrorContext {
}
```
-The `reducers` field of the context provides access to reducers exposed by the remote database. See [Observe and invoke reducers](#observe-and-invoke-reducers).
+The `reducers` field of the context provides access to reducers exposed by the remote module. See [Observe and invoke reducers](#observe-and-invoke-reducers).
## Access the client cache
diff --git a/docs/unity/part-1.md b/docs/unity/part-1.md
index ebe81167..f19a28bf 100644
--- a/docs/unity/part-1.md
+++ b/docs/unity/part-1.md
@@ -83,8 +83,8 @@ When you build a new connection to SpacetimeDB, that connection will be added to
Click on the `GameManager` object in the scene and click **Add Component**. Search for and select the `SpacetimeDBNetworkManager` to add it to your `GameManager` object.
-Our Unity project is all set up! If you press play, it will show a blank screen, but it should start the game without any errors. Now we're ready to get started on our SpacetimeDB database server, so we have something to connect to!
+Our Unity project is all set up! If you press play, it will show a blank screen, but it should start the game without any errors. Now we're ready to get started on our SpacetimeDB server module, so we have something to connect to!
### Create the Server Module
-We've now got the very basics set up. In [part 2](part-2) you'll learn the basics of how how to create a SpacetimeDB server module and how to connect to the database from your client.
\ No newline at end of file
+We've now got the very basics set up. In [part 2](part-2) you'll learn the basics of how how to create a SpacetimeDB server module and how to connect to it from your client.
\ No newline at end of file
diff --git a/docs/unity/part-2.md b/docs/unity/part-2.md
index c2685eab..65518400 100644
--- a/docs/unity/part-2.md
+++ b/docs/unity/part-2.md
@@ -512,7 +512,7 @@ public class GameManager : MonoBehaviour
Application.targetFrameRate = 60;
// In order to build a connection to SpacetimeDB we need to register
- // our callbacks and specify a SpacetimeDB server URI and database name.
+ // our callbacks and specify a SpacetimeDB server URI and module name.
var builder = DbConnection.Builder()
.OnConnect(HandleConnect)
.OnConnectError(HandleConnectError)
diff --git a/docs/unity/part-3.md b/docs/unity/part-3.md
index a5f10e0f..808c9bb6 100644
--- a/docs/unity/part-3.md
+++ b/docs/unity/part-3.md
@@ -1208,7 +1208,7 @@ At this point, after publishing our module we can press the play button to see t
- If you get an error when running the generate command, make sure you have an empty subfolder in your Unity project Assets folder called `autogen`
-- If you get an error in your Unity console when starting the game, double check that you have published your module and you have the correct database name specified in your `GameManager`.
+- If you get an error in your Unity console when starting the game, double check that you have published your module and you have the correct module name specified in your `GameManager`.
### Next Steps
From 8ca6fe33493bbe458371d81f66889eb7f6105208 Mon Sep 17 00:00:00 2001
From: Tamaro Skaljic <49238587+tamaro-skaljic@users.noreply.github.com>
Date: Thu, 3 Apr 2025 00:36:29 +0200
Subject: [PATCH 11/11] Apply suggestions from code review
Co-authored-by: Tyler Cloutier
---
docs/unity/part-2.md | 6 +++---
docs/unity/part-4.md | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/unity/part-2.md b/docs/unity/part-2.md
index 65518400..df97db9c 100644
--- a/docs/unity/part-2.md
+++ b/docs/unity/part-2.md
@@ -494,7 +494,7 @@ Replace the implementation of the `GameManager` class with the following.
public class GameManager : MonoBehaviour
{
const string SERVER_URL = "http://127.0.0.1:3000";
- const string DB_NAME = "blackholio";
+ const string MODULE_NAME = "blackholio";
public static event Action OnConnected;
public static event Action OnSubscriptionApplied;
@@ -518,7 +518,7 @@ public class GameManager : MonoBehaviour
.OnConnectError(HandleConnectError)
.OnDisconnect(HandleDisconnect)
.WithUri(SERVER_URL)
- .WithModuleName(DB_NAME);
+ .WithModuleName(MODULE_NAME);
// If the user has a SpacetimeDB auth token stored in the Unity PlayerPrefs,
// we can use it to authenticate the connection.
@@ -580,7 +580,7 @@ public class GameManager : MonoBehaviour
}
```
-Here we configure the connection to the database, by passing it some callbacks in addition to providing the `SERVER_URI` and `DB_NAME` to the connection. When the client connects, the SpacetimeDB SDK will call the `HandleConnect` method, allowing us to start up the game.
+Here we configure the connection to the database, by passing it some callbacks in addition to providing the `SERVER_URI` and `MODULE_NAME` to the connection. When the client connects, the SpacetimeDB SDK will call the `HandleConnect` method, allowing us to start up the game.
In our `HandleConnect` callback we building a subscription and are calling `Subscribe` and subscribing to all data in the database. This will cause SpacetimeDB to synchronize the state of all your tables with your Unity client's SpacetimeDB SDK's "client cache". You can also subscribe to specific tables using SQL syntax, e.g. `SELECT * FROM my_table`. Our [SQL documentation](/docs/sql) enumerates the operations that are accepted in our SQL syntax.
diff --git a/docs/unity/part-4.md b/docs/unity/part-4.md
index 93a84cfd..7e77fc83 100644
--- a/docs/unity/part-4.md
+++ b/docs/unity/part-4.md
@@ -582,12 +582,12 @@ Notice that the food automatically respawns as you vaccuum them up. This is beca
- Publish to Maincloud `spacetime publish -s maincloud --delete-data`
- `` This name should be unique and cannot contain any special characters other than internal hyphens (`-`).
- Update the URL in the Unity project to: `https://maincloud.spacetimedb.com`
-- Update the database name in the Unity project to ``.
+- Update the module name in the Unity project to ``.
- Clear the PlayerPrefs in Start() within `GameManager.cs`
- Your `GameManager.cs` should look something like this:
```csharp
const string SERVER_URL = "https://maincloud.spacetimedb.com";
-const string DB_NAME = "";
+const string MODULE_NAME = "";
...