You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 8, 2025. It is now read-only.
Copy file name to clipboardExpand all lines: docs/deploying/maincloud.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ spacetime login
23
23
```
24
24
25
25
1. Open the SpacetimeDB website and log in using your GitHub login.
26
-
1. You should now be able to see your published modules [by navigating to your profile on the website](/profile).
26
+
1. You should now be able to see your published modules https://spacetimedb.com/profile, or you can navigate to your database directly at https://spacetimedb.com/my-cool-module.
Copy file name to clipboardExpand all lines: docs/deploying/spacetimedb-standalone.md
+47-7Lines changed: 47 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -82,29 +82,69 @@ server {
82
82
listen 80;
83
83
server_name example.com;
84
84
85
-
location / {
85
+
#########################################
86
+
# By default SpacetimeDB is completely open so that anyone can publish to it. If you want to block
87
+
# users from creating new databases you should keep this section commented out. Otherwise, if you
88
+
# want to open it up (probably for dev environments) then you can uncomment this section and then
89
+
# also comment out the location / section below.
90
+
#########################################
91
+
# location / {
92
+
# proxy_pass http://localhost:3000;
93
+
# proxy_http_version 1.1;
94
+
# proxy_set_header Upgrade $http_upgrade;
95
+
# proxy_set_header Connection "Upgrade";
96
+
# proxy_set_header Host $host;
97
+
# }
98
+
99
+
# Anyone can subscribe to any database.
100
+
# Note: This is the only section *required* for the websocket to function properly. Clients will
101
+
# be able to create identities, call reducers, and subscribe to tables through this websocket.
102
+
location ~ ^/v1/database/[^/]+/subscribe$ {
86
103
proxy_pass http://localhost:3000;
87
104
proxy_http_version 1.1;
88
105
proxy_set_header Upgrade $http_upgrade;
89
106
proxy_set_header Connection "Upgrade";
90
107
proxy_set_header Host $host;
91
108
}
92
109
93
-
# This restricts who can publish new databases to your SpacetimeDB instance. We recommend
94
-
# restricting this ability to local connections.
95
-
location /v1/publish {
96
-
allow 127.0.0.1;
97
-
deny all;
110
+
# Uncomment this section to allow all HTTP reducer calls
111
+
# location ~ ^/v1/[^/]+/call/[^/]+$ {
112
+
# proxy_pass http://localhost:3000;
113
+
# proxy_http_version 1.1;
114
+
# proxy_set_header Upgrade $http_upgrade;
115
+
# proxy_set_header Connection "Upgrade";
116
+
# proxy_set_header Host $host;
117
+
# }
118
+
119
+
# Uncomment this section to allow all HTTP sql requests
120
+
# location ~ ^/v1/[^/]+/sql$ {
121
+
# proxy_pass http://localhost:3000;
122
+
# proxy_http_version 1.1;
123
+
# proxy_set_header Upgrade $http_upgrade;
124
+
# proxy_set_header Connection "Upgrade";
125
+
# proxy_set_header Host $host;
126
+
# }
127
+
128
+
# NOTE: This is required for the typescript sdk to function, it is optional
129
+
# for the rust and the C# SDKs.
130
+
location /v1/identity {
98
131
proxy_pass http://localhost:3000;
99
132
proxy_http_version 1.1;
100
133
proxy_set_header Upgrade $http_upgrade;
101
134
proxy_set_header Connection "Upgrade";
102
135
proxy_set_header Host $host;
103
136
}
137
+
138
+
# Block all other routes explicitly. Only localhost can use these routes. If you want to open your
139
+
# server up so that anyone can publish to it you should comment this section out.
140
+
location / {
141
+
allow 127.0.0.1;
142
+
deny all;
143
+
}
104
144
}
105
145
```
106
146
107
-
This configuration contains a restriction to the `/v1/publish` route. This restriction makes it so that you can only publish to the database if you're publishing from a local connection on the host.
147
+
This configuration by default blocks all connections other than `/v1/identity` and `/v1/database/<database-name>/subscribe` which only allows the most basic functionality. This will prevent all remote users from publishing to your SpacetimeDB instance.
While SpacetimeDB doesn't support nested transactions,
192
+
a reducer can [schedule another reducer](https://docs.rs/spacetimedb/latest/spacetimedb/attr.reducer.html#scheduled-reducers) to run at an interval,
193
+
or at a specific time.
191
194
:::
192
195
:::server-csharp
193
196
```csharp
@@ -207,19 +210,12 @@ public static void World(ReducerContext ctx)
207
210
// ...
208
211
}
209
212
```
210
-
:::
211
-
212
-
:::server-rust
213
-
While SpacetimeDB doesn't support nested transactions,
214
-
a reducer can [schedule another reducer](https://docs.rs/spacetimedb/latest/spacetimedb/attr.reducer.html#scheduled-reducers) to run at an interval,
215
-
or at a specific time.
216
-
:::
217
-
:::server-csharp
218
213
While SpacetimeDB doesn't support nested transactions,
219
214
a reducer can [schedule another reducer](/docs/modules/c-sharp#scheduled-reducers) to run at an interval,
220
215
or at a specific time.
221
216
:::
222
217
218
+
223
219
### Client
224
220
A **client** is an application that connects to a [database](#database). A client logs in using an [identity](#identity) and receives an [connection id](#connectionid) to identify the connection. After that, it can call [reducers](#reducer) and query public [tables](#table).
Copy file name to clipboardExpand all lines: docs/modules/c-sharp/index.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -88,6 +88,8 @@ This creates a `dotnet` project in `my-project-directory` with the following `St
88
88
</Project>
89
89
```
90
90
91
+
> NOTE: It is important to not change the `StdbModule.csproj` name because SpacetimeDB assumes that this will be the name of the file.
92
+
91
93
This is a standard `csproj`, with the exception of the line `<RuntimeIdentifier>wasi-wasm</RuntimeIdentifier>`.
92
94
This line is important: it allows the project to be compiled to a WebAssembly module.
93
95
@@ -223,9 +225,9 @@ However:
223
225
224
226
# Tables
225
227
226
-
Tables are declared using the [`[SpacetimeDB.Table]` attribute](#table-attribute).
228
+
Tables are declared using the `[SpacetimeDB.Table]` attribute.
227
229
228
-
This macro is applied to a C# `partial class` or `partial struct` with named fields. (The `partial` modifier is required to allow code generation to add methods.) All of the fields of the table must be marked with [`[SpacetimeDB.Type]`](#type-attribute).
230
+
This macro is applied to a C# `partial class` or `partial struct` with named fields. (The `partial` modifier is required to allow code generation to add methods.) All of the fields of the table must be marked with [`[SpacetimeDB.Type]`](#attribute-spacetimedbtype).
229
231
230
232
The resulting type is used to store rows of the table. It's a normal class (or struct). Row values are not special -- operations on row types do not, by themselves, modify the table. Instead, a [`ReducerContext`](#class-reducercontext) is needed to get a handle to the table.
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).
313
313
314
-
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).
314
+
The next step would be to create a client that interacts with this module. You can use any of SpacetimeDB'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).
315
315
316
316
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).
If you haven't already started the SpacetimeDB server, run the `spacetime start` command in a _separate_ terminal and leave it running while you continue following along.
230
+
227
231
## Publish the module
228
232
229
233
And that's all of our module code! We'll run `spacetime publish` to compile our module and publish it on SpacetimeDB. `spacetime publish` takes an optional name which will map to the database's unique `Identity`. Clients can connect either by name or by `Identity`, but names are much more user-friendly. If you'd like, come up with a unique name that contains only URL-safe characters (letters, numbers, hyphens and underscores), and fill it in where we've written `quickstart-chat`.
230
234
231
-
From the `quickstart-chat` directory, run:
235
+
From the `quickstart-chat` directory, run in another tab:
232
236
233
237
```bash
234
238
spacetime publish --project-path server quickstart-chat
@@ -239,7 +243,7 @@ spacetime publish --project-path server quickstart-chat
239
243
You can use the CLI (command line interface) to run reducers. The arguments to the reducer are passed in JSON format.
Copy file name to clipboardExpand all lines: docs/sdks/c-sharp/index.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ The SpacetimeDB client for C# contains all the tools you need to build native cl
23
23
If you would like to create a console application using .NET, you can create a new project using `dotnet new console` and add the SpacetimeDB SDK to your dependencies:
24
24
25
25
```bash
26
-
dotnet add package spacetimedbsdk
26
+
dotnet add package SpacetimeDB.ClientSDK
27
27
```
28
28
29
29
(See also the [CSharp Quickstart](/docs/modules/c-sharp/quickstart) for an in-depth example of such a console application.)
Copy file name to clipboardExpand all lines: docs/sdks/c-sharp/quickstart.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ Open the project in your IDE of choice.
22
22
23
23
## Add the NuGet package for the C# SpacetimeDB SDK
24
24
25
-
Add the `SpacetimeDB.ClientSDK`[NuGet package](https://www.nuget.org/packages/spacetimedbsdk) using Visual Studio or Rider _NuGet Package Manager_ or via the .NET CLI:
25
+
Add the `SpacetimeDB.ClientSDK`[NuGet package](https://www.nuget.org/packages/SpacetimeDB.ClientSDK/) using Visual Studio or Rider _NuGet Package Manager_ or via the .NET CLI:
26
26
27
27
```bash
28
28
dotnet add package SpacetimeDB.ClientSDK
@@ -141,15 +141,15 @@ To `Program.cs`, add:
141
141
conststringHOST="http://localhost:3000";
142
142
143
143
/// The database name we chose when we published our module.
144
-
conststringDBNAME="quickstart-chat";
144
+
conststringDB_NAME="quickstart-chat";
145
145
146
146
/// Load credentials from a file and connect to the database.
0 commit comments