quickstart-chat issues with Claude Code
Ahoy! Very interesting tool, excited to try it out Claude Code and I tried to install the quickstart-chat app, vanilla.
It was fiddly business, we got there in the end (took ~one instance worth of context.) Here's CC's writeup, I hope this is useful.
In particular I noticed the version depenency was wrong for the rust-client (first attempt, aborted) and I think the quickstart-chat. Given that quickstart-chat is a rust client, the presence of both is confusing but quickstart seems the more recent.
Getting SpacetimeDB Quickstart-Chat Working: The Ideal Path
Here's a summary of the steps needed to get the SpacetimeDB quickstart-chat example working, following the most direct path:
1. Setting up the proper Rust environment
# Install Rust with rustup (not Homebrew) to ensure proper WebAssembly support
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.84.0 --profile default --target wasm32-unknown-unknown
# Add WebAssembly target support
rustup target add wasm32-unknown-unknown
2. Installing and running SpacetimeDB
# Install SpacetimeDB CLI
curl -sSf https://install.spacetimedb.com | sh
# Add SpacetimeDB to PATH
export PATH="$HOME/.local/bin:$PATH"
# Start SpacetimeDB in the background
spacetime start > /tmp/spacetime.log 2>&1 &
3. Publishing the module
# Navigate to the quickstart-chat module directory
cd modules/quickstart-chat
# Build and publish the module
spacetime publish --server http://127.0.0.1:3000 --anonymous chat-demo
4. Building and running the client
# Create a directory for the client
mkdir -p quickstart-chat-client/src
# Copy the module bindings
cp -R modules/quickstart-chat/module_bindings quickstart-chat-client/src/
# Create Cargo.toml with proper dependencies
cat > quickstart-chat-client/Cargo.toml << EOF
[package]
name = "quickstart-chat-client"
version = "0.1.0"
edition = "2021"
[dependencies]
spacetimedb-sdk = "1.0.1"
EOF
# Create main.rs with the client code, using the correct module name
# (Key point: The with_token handling should be optional for first-time users)
# Build and run the client
cd quickstart-chat-client
cargo run
Feedback for SpacetimeDB developers
-
Rust installation instructions: The documentation should emphasize that rustup (not Homebrew Rust) is required for proper WebAssembly support, with specific instructions for the target.
-
Client authentication handling: The example should better handle first-time connections without credentials. Currently, it uses
.expect()which causes errors for new users. -
Module ownership and permissions: We encountered several permission errors when trying to republish or update modules. A clearer ownership model or easier way to manage modules for development would be helpful.
-
Non-interactive client options: The example could benefit from a non-interactive mode for testing, as interactive terminal input can be challenging in some environments.
-
Better error messages: When the server isn't running, the client error messages could be more clear about connection issues.
-
Documentation for common operations: More examples for common tasks like listing databases, checking status, deleting, and updating modules would be helpful.
-
WebAssembly optimization warnings: The warning about missing wasm-opt is confusing for beginners. Either include it or make the warning less prominent.
-
Consistent API across language SDKs: Ensure authentication and connection patterns are consistent across different SDKs.
-
Offline development mode: A simpler local development experience that doesn't require authentication would help developers get started more quickly.
I followed the instructions and got it working myself, np. Score one for team human!
I do think putting a quickstart guide for AI in the repo docs is a good idea for us game designer muppets who want to vibe our way to the next MMO (or have fun crashing against the context limit trying!) Rust and Spacetime look v promising for this as they are very simple and the code is tiny relative to js / ts twisty maze esp.
Thanks for following up! I'm glad that the instructions were easy to follow for a human.
We do have plans to improve our AI-readability though!
We also created these issues:
- https://github.com/clockworklabs/SpacetimeDB/issues/3083
- https://github.com/clockworklabs/SpacetimeDB/issues/2545
- https://github.com/clockworklabs/SpacetimeDB/issues/3081
Some folks from the dev team also had this to say about the expect piece:
Claude is wrong about the expect call in
with_token. From the doc comment ofspacetimedb_sdk::credentials::File::load:Returns
Errif I/O fails,Noneif credentials have not previously been stored, orSomeif credentials are successfully loaded from disk. After unwrapping theResult, the returnedOptioncan be passed to [super::DbConnectionBuilder::with_token].Note that the return type of that method is
Result<Option<String>, CredentialFileError>.
It would be nice if the quickstart for typescript as rust was made into some code I could pull down ready to go. Preferably in docker compose.
@chrisjd20 A complete TypeScript quickstart client is here: https://github.com/clockworklabs/spacetimedb-typescript-sdk/tree/main/examples/quickstart-chat. Is that what you're looking for? (It's compatible with either a Rust or C# quickstart-chat server modules, but we don't have server-side support for TypeScript.. yet).
@bfops thanks I didnt realize that existed. I managed to get it from build to run into a single docker compose as I was suggesting (server and client both built and running):
https://github.com/chrisjd20/spacetimedb-chat-quickstart-example