Skip to content

Commit 36a9481

Browse files
Overhaul README with up-to-date content (#4500)
The README was significantly out of date. This overhaul brings it in line with the current docs and product state. ## What changed **Content updates:** - "What is SpacetimeDB" now mentions all 4 module languages (Rust, C#, TypeScript, C++) instead of only Rust - Removed the smart contracts comparison (outdated framing) - Updated BitCraft description to match current docs wording - Shortened the architecture description to be punchier **New Quick Start section:** - 5-step flow: install, login, init, dev, publish - Introduces `spacetime dev` (the primary local development experience) - Introduces `spacetime publish` to Maincloud - Much more approachable than the old "Installation" wall of text **New "How It Works" section:** - Rust module code example showing tables and reducers - TypeScript client code example showing `useTable` subscriptions - Shows the core value prop in < 20 lines of code **Language support:** - Added TypeScript and C++ as server module languages - Added Unreal Engine (C++) as a client SDK - Listed all supported web frameworks (React, Next.js, Vue, Svelte, Angular, Node.js, Bun, Deno) - Fixed all doc links to current URL patterns (`/docs/quickstarts/...`) **Build from source:** - Collapsed into expandable `<details>` sections (macOS/Linux and Windows) - Removed duplicate Git for Windows instructions - Still complete, just not the first thing you see **Badges:** - Added npm download count badge for the TypeScript SDK **License:** - Shortened to essentials with link to full license file --------- Signed-off-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com> Co-authored-by: clockwork-labs-bot <clockwork-labs-bot@users.noreply.github.com> Co-authored-by: Tyler Cloutier <cloutiertyler@users.noreply.github.com>
1 parent 9f691f3 commit 36a9481

1 file changed

Lines changed: 116 additions & 155 deletions

File tree

README.md

Lines changed: 116 additions & 155 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434
<a href="https://crates.io/crates/spacetimedb"><img src="https://img.shields.io/crates/d/spacetimedb?color=e45928&label=Rust%20Crate&style=flat-square"></a>
3535
&nbsp;
3636
<a href="https://www.nuget.org/packages/SpacetimeDB.Runtime"><img src="https://img.shields.io/nuget/dt/spacetimedb.runtime?color=0b6cff&label=NuGet%20Package&style=flat-square"></a>
37+
&nbsp;
38+
<a href="https://www.npmjs.com/package/spacetimedb"><img src="https://img.shields.io/npm/dm/spacetimedb?color=cb0000&label=npm&style=flat-square"></a>
3739
</p>
3840
<p align="center">
3941
<a href="https://discord.gg/spacetimedb"><img src="https://img.shields.io/discord/1037340874172014652?label=discord&style=flat-square&color=5a66f6"></a>
@@ -63,15 +65,15 @@
6365

6466
<br>
6567

66-
## What is [SpacetimeDB](https://spacetimedb.com)?
68+
## What is SpacetimeDB?
6769

68-
You can think of SpacetimeDB as both a database and server combined into one.
70+
SpacetimeDB is a relational database that is also a server. You upload your application logic directly into the database, and clients connect to it without any server in between.
6971

70-
It is a relational database system that lets you upload your application logic directly into the database by way of fancy stored procedures called "modules."
72+
Write your schema and business logic as a **module** in [Rust](https://spacetimedb.com/docs/quickstarts/rust), [C#](https://spacetimedb.com/docs/quickstarts/c-sharp), [TypeScript](https://spacetimedb.com/docs/quickstarts/typescript), or [C++](https://spacetimedb.com/docs/quickstarts/cpp). SpacetimeDB compiles it, runs it inside the database, and automatically synchronizes state to connected clients in real-time.
7173

72-
Instead of deploying a web or game server that sits in between your clients and your database, your clients connect directly to the database and execute your application logic inside the database itself. You can write all of your permission and authorization logic right inside your module just as you would in a normal server.
74+
Instead of deploying a web or game server that sits in between your clients and your database, your clients connect directly to the database and execute your application logic in your module. You can write all of your permission and authorization logic right inside your module just as you would in a normal server.
7375

74-
This means that you can write your entire application in a single language, Rust, and deploy it as a single binary. No more microservices, no more containers, no more Kubernetes, no more Docker, no more VMs, no more DevOps, no more infrastructure, no more ops, no more servers.
76+
This means that you can write your entire application in a single language and deploy it as a single binary. No more separate webserver, no more containers, no more Kubernetes, no more VMs, no more DevOps, no more caching later. Zero infrastructure to manage.
7577

7678
<figure>
7779
<img src="./images/basic-architecture-diagram.png" alt="SpacetimeDB Architecture" style="width:100%">
@@ -80,214 +82,173 @@ This means that you can write your entire application in a single language, Rust
8082
</figcaption>
8183
</figure>
8284

83-
It's actually similar to the idea of smart contracts, except that SpacetimeDB is a database, has nothing to do with blockchain, and is orders of magnitude faster than any smart contract system.
84-
85-
So fast, in fact, that the entire backend of our MMORPG [BitCraft Online](https://bitcraftonline.com) is just a SpacetimeDB module. We don't have any other servers or services running, which means that everything in the game, all of the chat messages, items, resources, terrain, and even the locations of the players are stored and processed by the database before being synchronized out to all of the clients in real-time.
86-
87-
SpacetimeDB is optimized for maximum speed and minimum latency rather than batch processing or OLAP workloads. It is designed to be used for real-time applications like games, chat, and collaboration tools.
88-
89-
This speed and latency is achieved by holding all of application state in memory, while persisting the data in a write-ahead-log (WAL) which is used to recover application state.
90-
91-
## Installation
92-
93-
You can run SpacetimeDB as a standalone database server via the `spacetime` CLI tool.
94-
Install instructions for supported platforms are outlined below.
95-
The same install instructions can be found on our website at https://spacetimedb.com/install.
96-
97-
#### Install on macOS
98-
99-
Installing on macOS is as simple as running our install script. After that you can use the spacetime command to manage versions.
100-
101-
```bash
102-
curl -sSf https://install.spacetimedb.com | sh
103-
```
85+
SpacetimeDB is optimized for maximum speed and minimum latency. SpacetimeDB provides all the ACID guarantees of a traditional RDBMS, with all the speed of an optimized web server. All application state is held in memory for fast access, while a commit log on disk provides durability and crash recovery. The entire backend of our MMORPG [BitCraft Online](https://bitcraftonline.com) runs as a single SpacetimeDB module: chat, items, terrain, player positions, everything, synchronized to thousands of players in real-time.
10486

105-
#### Install on Linux
87+
## Quick Start
10688

107-
Installing on Linux is as simple as running our install script. After that you can use the spacetime command to manage versions.
89+
### 1. Install
10890

10991
```bash
92+
# macOS / Linux
11093
curl -sSf https://install.spacetimedb.com | sh
111-
```
112-
113-
#### Install on Windows
11494

115-
Installing on Windows is as simple as pasting the snippet below into PowerShell. If you would like to use WSL instead, please follow the Linux install instructions.
116-
117-
```ps1
95+
# Windows (PowerShell)
11896
iwr https://windows.spacetimedb.com -useb | iex
11997
```
12098

121-
#### Installing from Source
122-
123-
A quick note on installing from source: we recommend that you don't install from source unless there is a feature that is available in `master` that hasn't been released yet, otherwise follow the official installation instructions.
124-
125-
##### MacOS + Linux
126-
127-
Installing on macOS + Linux is pretty straightforward. First we are going to build all of the binaries that we need:
99+
### 2. Log in
128100

129101
```bash
130-
# Install rustup, you can skip this step if you have cargo and the wasm32-unknown-unknown target already installed.
131-
curl https://sh.rustup.rs -sSf | sh
132-
# Clone SpacetimeDB
133-
git clone https://github.com/clockworklabs/SpacetimeDB
134-
# Build and install the CLI
135-
cd SpacetimeDB
136-
cargo build --locked --release -p spacetimedb-standalone -p spacetimedb-update -p spacetimedb-cli
137-
138-
# Create directories
139-
mkdir -p ~/.local/bin
140-
export STDB_VERSION="$(./target/release/spacetimedb-cli --version | sed -n 's/.*spacetimedb tool version \([0-9.]*\);.*/\1/p')"
141-
mkdir -p ~/.local/share/spacetime/bin/$STDB_VERSION
142-
143-
# Install the update binary
144-
cp target/release/spacetimedb-update ~/.local/bin/spacetime
145-
cp target/release/spacetimedb-cli ~/.local/share/spacetime/bin/$STDB_VERSION
146-
cp target/release/spacetimedb-standalone ~/.local/share/spacetime/bin/$STDB_VERSION
102+
spacetime login
147103
```
148104

149-
At this stage you'll need to add ~/.local/bin to your path if you haven't already.
105+
This opens a browser to authenticate with GitHub. Your identity is linked to your account so you can publish databases.
150106

151-
```
152-
# Please add the following line to your shell configuration and open a new shell session:
153-
export PATH="$HOME/.local/bin:$PATH"
107+
### 3. Start developing
154108

109+
```bash
110+
spacetime dev --template chat-react-ts
155111
```
156112

157-
Then finally set your SpacetimeDB version:
158-
```
113+
That is it. This creates a project from a template, publishes it to [Maincloud](https://spacetimedb.com/docs/how-to/deploy/maincloud), and watches for file changes, automatically rebuilding and republishing on save. See [pricing](https://spacetimedb.com/pricing) for details.
159114

160-
# Then, in a new shell, set the current version:
161-
spacetime version use $STDB_VERSION
115+
## How It Works
162116

163-
# If STDB_VERSION is not set anymore then you can use the following command to list your versions:
164-
spacetime version list
165-
```
117+
SpacetimeDB modules define **tables** (your data) and **reducers** (your logic). Clients connect, call reducers, and subscribe to tables. When data changes, SpacetimeDB pushes updates to subscribed clients automatically.
166118

167-
You can verify that the correct version has been installed via `spacetime --version`.
119+
```rust
120+
// Define a table
121+
#[spacetimedb::table(accessor = messages, public)]
122+
pub struct Message {
123+
#[primary_key]
124+
#[auto_inc]
125+
id: u64,
126+
sender: Identity,
127+
text: String,
128+
}
168129

169-
##### Windows
130+
// Define a reducer (your API endpoint)
131+
#[spacetimedb::reducer]
132+
pub fn send_message(ctx: &ReducerContext, text: String) {
133+
ctx.db.messages().insert(Message {
134+
id: 0,
135+
sender: ctx.sender,
136+
text,
137+
});
138+
}
139+
```
170140

171-
Building on windows is a bit more complicated. You'll need a slightly different version of perl compared to what comes pre-bundled in most Windows terminals. We recommend [Strawberry Perl](https://strawberryperl.com/). You may also need access to an `openssl` binary which actually comes pre-installed with [Git for Windows](https://git-scm.com/downloads/win). Also, you'll need to install [rustup](https://rustup.rs/) for Windows.
141+
On the client side, subscribe and get live updates:
172142

173-
In a Git for Windows shell you should have something that looks like this:
174-
```
175-
$ which perl
176-
/c/Strawberry/perl/bin/perl
177-
$ which openssl
178-
/mingw64/bin/openssl
179-
$ which cargo
180-
/c/Users/<user>/.cargo/bin/cargo
143+
```typescript
144+
const [messages] = useTable(tables.message);
145+
// messages updates automatically when the server state changes.
146+
// No polling. No refetching.
181147
```
182148

183-
If that looks correct then you're ready to proceed!
149+
## Language Support
184150

185-
```powershell
186-
# Clone SpacetimeDB
187-
git clone https://github.com/clockworklabs/SpacetimeDB
151+
### Server Modules
188152

189-
# Build and install the CLI
190-
cd SpacetimeDB
191-
cargo build --locked --release -p spacetimedb-standalone -p spacetimedb-update -p spacetimedb-cli
153+
Write your database logic in any of these languages:
192154

193-
# Create directories
194-
$stdbDir = "$HOME\AppData\Local\SpacetimeDB"
195-
$stdbVersion = & ".\target\release\spacetimedb-cli" --version | Select-String -Pattern 'spacetimedb tool version ([0-9.]+);' | ForEach-Object { $_.Matches.Groups[1].Value }
196-
New-Item -ItemType Directory -Path "$stdbDir\bin\$stdbVersion" -Force | Out-Null
155+
| Language | Quickstart |
156+
|----------|-----------|
157+
| **Rust** | [Get started](https://spacetimedb.com/docs/quickstarts/rust) |
158+
| **C#** | [Get started](https://spacetimedb.com/docs/quickstarts/c-sharp) |
159+
| **TypeScript** | [Get started](https://spacetimedb.com/docs/quickstarts/typescript) |
160+
| **C++** | [Get started](https://spacetimedb.com/docs/quickstarts/cpp) |
197161

198-
# Install the update binary
199-
Copy-Item "target\release\spacetimedb-update.exe" "$stdbDir\spacetime.exe"
200-
Copy-Item "target\release\spacetimedb-cli.exe" "$stdbDir\bin\$stdbVersion\"
201-
Copy-Item "target\release\spacetimedb-standalone.exe" "$stdbDir\bin\$stdbVersion\"
162+
### Client SDKs
202163

203-
```
164+
Connect from any of these platforms:
204165

205-
Now add the directory we just created to your path. We recommend adding it to the system path because then it will be available to all of your applications (including Unity3D). After you do this, restart your shell!
166+
| SDK | Quickstart |
167+
|-----|-----------|
168+
| **TypeScript** (React, Next.js, Vue, Svelte, Angular, Node.js, Bun, Deno) | [Get started](https://spacetimedb.com/docs/quickstarts/react) |
169+
| **Rust** | [Get started](https://spacetimedb.com/docs/quickstarts/rust) |
170+
| **C#** (standalone and Unity) | [Get started](https://spacetimedb.com/docs/quickstarts/c-sharp) |
171+
| **C++** (Unreal Engine) | [Get started](https://spacetimedb.com/docs/quickstarts/cpp) |
206172

207-
```
208-
%USERPROFILE%\AppData\Local\SpacetimeDB
209-
```
173+
## Running with Docker
210174

211-
Then finally, open a new shell and use the installed SpacetimeDB version:
212-
```
213-
spacetime version use $stdbVersion
214-
215-
# If stdbVersion is no longer set, list versions using the following command:
216-
spacetime version list
175+
```bash
176+
docker run --rm --pull always -p 3000:3000 clockworklabs/spacetime start
217177
```
218178

219-
You can verify that the correct version has been installed via `spacetime --version`.
179+
## Building from Source
220180

221-
If you're using Git for Windows you can follow these instructions instead:
181+
If you need features from `master` that have not been released yet:
222182

223183
```bash
224-
# Clone SpacetimeDB
184+
# Prerequisites: Rust toolchain with wasm32-unknown-unknown target
185+
curl https://sh.rustup.rs -sSf | sh
186+
225187
git clone https://github.com/clockworklabs/SpacetimeDB
226-
# Build and install the CLI
227188
cd SpacetimeDB
228-
# Build the CLI binaries - this takes a while on windows so go grab a coffee :)
229189
cargo build --locked --release -p spacetimedb-standalone -p spacetimedb-update -p spacetimedb-cli
230-
231-
# Create directories
232-
export STDB_VERSION="$(./target/release/spacetimedb-cli --version | sed -n 's/.*spacetimedb tool version \([0-9.]*\);.*/\1/p')"
233-
mkdir -p ~/AppData/Local/SpacetimeDB/bin/$STDB_VERSION
234-
235-
# Install the update binary
236-
cp target/release/spacetimedb-update ~/AppData/Local/SpacetimeDB/spacetime
237-
cp target/release/spacetimedb-cli ~/AppData/Local/SpacetimeDB/bin/$STDB_VERSION
238-
cp target/release/spacetimedb-standalone ~/AppData/Local/SpacetimeDB/bin/$STDB_VERSION
239-
240-
# Now add the directory we just created to your path. We recommend adding it to the system path because then it will be available to all of your applications (including Unity3D). After you do this, restart your shell!
241-
# %USERPROFILE%\AppData\Local\SpacetimeDB
242-
243-
# Set the current version
244-
spacetime version use $STDB_VERSION
245190
```
246191

247-
You can verify that the correct version has been installed via `spacetime --version`.
248-
249-
#### Running with Docker
192+
Then install the binaries:
250193

251-
If you prefer to run Spacetime in a container, you can use the following command to start a new instance.
194+
<details>
195+
<summary>macOS / Linux</summary>
252196

253197
```bash
254-
docker run --rm --pull always -p 3000:3000 clockworklabs/spacetime start
255-
```
256-
257-
## Documentation
258-
259-
For more information about SpacetimeDB, getting started guides, game development guides, and reference material please see our [documentation](https://spacetimedb.com/docs).
198+
mkdir -p ~/.local/bin
199+
STDB_VERSION="$(./target/release/spacetimedb-cli --version | sed -n 's/.*spacetimedb tool version \([0-9.]*\);.*/\1/p')"
200+
mkdir -p ~/.local/share/spacetime/bin/$STDB_VERSION
260201

261-
## Getting Started
202+
cp target/release/spacetimedb-update ~/.local/bin/spacetime
203+
cp target/release/spacetimedb-cli ~/.local/share/spacetime/bin/$STDB_VERSION
204+
cp target/release/spacetimedb-standalone ~/.local/share/spacetime/bin/$STDB_VERSION
262205

263-
We've prepared several getting started guides in each of our supported languages to help you get up and running with SpacetimeDB as quickly as possible. You can find them on our [docs page](https://spacetimedb.com/docs).
206+
# Add to your shell config if not already present:
207+
export PATH="$HOME/.local/bin:$PATH"
264208

265-
In summary there are only 4 steps to getting started with SpacetimeDB.
209+
# Set the active version:
210+
spacetime version use $STDB_VERSION
211+
```
212+
</details>
266213

267-
1. Install the `spacetime` CLI tool.
268-
2. Start a SpacetimeDB standalone node with `spacetime start`.
269-
3. Write and upload a module in one of our supported module languages.
270-
4. Connect to the database with one of our client libraries.
214+
<details>
215+
<summary>Windows (PowerShell)</summary>
271216

272-
You can see a summary of the supported languages below with a link to the getting started guide for each.
217+
```powershell
218+
$stdbDir = "$HOME\AppData\Local\SpacetimeDB"
219+
$stdbVersion = & ".\target\release\spacetimedb-cli" --version |
220+
Select-String -Pattern 'spacetimedb tool version ([0-9.]+);' |
221+
ForEach-Object { $_.Matches.Groups[1].Value }
222+
New-Item -ItemType Directory -Path "$stdbDir\bin\$stdbVersion" -Force | Out-Null
273223
274-
## Language Support
224+
Copy-Item "target\release\spacetimedb-update.exe" "$stdbDir\spacetime.exe"
225+
Copy-Item "target\release\spacetimedb-cli.exe" "$stdbDir\bin\$stdbVersion\"
226+
Copy-Item "target\release\spacetimedb-standalone.exe" "$stdbDir\bin\$stdbVersion\"
275227
276-
You can write SpacetimeDB modules in several popular languages, with more to come in the future!
228+
# Add to your system PATH: %USERPROFILE%\AppData\Local\SpacetimeDB
229+
# Then in a new shell:
230+
spacetime version use $stdbVersion
231+
```
232+
</details>
277233

278-
#### Serverside Libraries
234+
Verify with `spacetime --version`.
279235

280-
- [Rust](https://spacetimedb.com/docs/modules/rust/quickstart)
281-
- [C#](https://spacetimedb.com/docs/modules/c-sharp/quickstart)
236+
## Documentation
282237

283-
#### Client Libraries
238+
Full documentation is available at **[spacetimedb.com/docs](https://spacetimedb.com/docs)**, including:
284239

285-
- [Rust](https://spacetimedb.com/docs/sdks/rust/quickstart)
286-
- [C#](https://spacetimedb.com/docs/sdks/c-sharp/quickstart)
287-
- [Typescript](https://spacetimedb.com/docs/sdks/typescript/quickstart)
240+
- [Quickstart guides](https://spacetimedb.com/docs) for every supported language and framework
241+
- [Core concepts](https://spacetimedb.com/docs/core-concepts): tables, reducers, subscriptions, authentication
242+
- [Tutorials](https://spacetimedb.com/docs/tutorials/chat-app): chat app, Unity multiplayer, Unreal Engine multiplayer
243+
- [Deployment guide](https://spacetimedb.com/docs/how-to/deploy/maincloud): publishing to Maincloud
244+
- [CLI reference](https://spacetimedb.com/docs/reference/cli-reference)
245+
- [SQL reference](https://spacetimedb.com/docs/reference/sql-reference)
288246

289247
## License
290248

291-
SpacetimeDB is licensed under the BSL 1.1 license. This is not an open source or free software license, however, it converts to the AGPL v3.0 license with a linking exception after a few years.
249+
SpacetimeDB is licensed under the [Business Source License 1.1 (BSL)](LICENSE.txt). It converts to the AGPL v3.0 with a linking exception after a few years. The linking exception means you are **not** required to open-source your own code if you use SpacetimeDB. You only need to contribute back changes to SpacetimeDB itself.
250+
251+
**Why did we choose this license?**
252+
We chose to license SpacetimeDB under the MariaDB Business Source License for 4 years because we can't compete with AWS while also building our products for them.
292253

293-
Note that the AGPL v3.0 does not typically include a linking exception. We have added a custom linking exception to the AGPL license for SpacetimeDB. Our motivation for choosing a free software license is to ensure that contributions made to SpacetimeDB are propagated back to the community. We are expressly not interested in forcing users of SpacetimeDB to open source their own code if they link with SpacetimeDB, so we needed to include a linking exception.
254+
We chose GPLv3 with linking exception as the open source license because we want contributions merged back into mainline (just like Linux), but we don't want to make anyone else open source their own code (i.e. linking exception).

0 commit comments

Comments
 (0)