Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
f7ed39d
Generate module bindings for all template clients
drogus Jan 9, 2026
2ab9c36
Add spacetimedb init smoketests
drogus Jan 9, 2026
15beaf2
Use log from workspace in basic-rust
drogus Jan 12, 2026
edb161d
Don't update the version of basic-rust on version bump
drogus Jan 12, 2026
2fc4c4f
Fix syntax error in tempaltes tests
drogus Jan 12, 2026
27b2a2f
Add more logs to init tests
drogus Jan 13, 2026
cbe7e4f
Change the log dependency in basic-rust back to 0.4 instead of workspace
drogus Jan 13, 2026
5d0abfd
Remove the pnpm lockfile before installing in templates tests
drogus Jan 13, 2026
2168aa8
pass --yes when publishing in init smoketests
drogus Jan 13, 2026
2d54cf1
Publish locally in init tests
drogus Jan 13, 2026
e2c420c
Fix smoketests on windows
drogus Jan 13, 2026
4b4f94b
Debug smoketests
drogus Jan 13, 2026
4ae08ad
Remove utf-8 from smoketests output (possible fix for widows)
drogus Jan 13, 2026
788b135
Run only init smoketests
drogus Jan 13, 2026
3c890d6
Merge branch 'master' into drogus/templates-tests
drogus Jan 14, 2026
6f25b29
Build TypeScript SDK in smoketests init
drogus Jan 14, 2026
a1deb84
Merge remote-tracking branch 'origin/drogus/templates-tests' into dro…
drogus Jan 14, 2026
33bc850
Use absolute pahts for pnpm in init smoketests
drogus Jan 14, 2026
32037b8
Specify project in dotnet pack
drogus Jan 14, 2026
ccf0ef2
Remove debug args
drogus Jan 14, 2026
6b38933
Revert "Remove debug args"
drogus Jan 14, 2026
420e69e
Another possible windows fix for init tests
drogus Jan 14, 2026
6a40601
Remove templates-list.json, it's no longer used
drogus Jan 14, 2026
bbb0638
Output file path to NPM packages
drogus Jan 14, 2026
cba8bfd
Try pnpm link
drogus Jan 14, 2026
f1f90dc
Run pnpm using a prepared function so it finds executable
drogus Jan 14, 2026
d760970
Reapply "Remove debug args"
drogus Jan 14, 2026
04d7ecf
Revert "Output file path to NPM packages"
drogus Jan 14, 2026
ea7fb12
Merge remote-tracking branch 'origin/master' into drogus/templates-tests
drogus Jan 14, 2026
94723b7
Rename templates to standardize naming
drogus Jan 14, 2026
63e8d61
Merge remote-tracking branch 'origin/master' into drogus/templates-st…
drogus Jan 15, 2026
8498ae7
Merge branch 'drogus/templates-standarization' into drogus/templates-…
drogus Jan 16, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/typescript-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ jobs:
fi

- name: Generate client bindings
working-directory: templates/quickstart-chat-typescript
working-directory: templates/chat-react-ts
run: |
pnpm generate

- name: Check for changes
working-directory: templates/quickstart-chat-typescript
working-directory: templates/chat-react-ts
run: |
"${GITHUB_WORKSPACE}"/tools/check-diff.sh src/module_bindings || {
echo "Error: Bindings are dirty. Please generate bindings again and commit them to this branch."
Expand All @@ -144,7 +144,7 @@ jobs:
# spacetime logs quickstart-chat

- name: Check that quickstart-chat builds
working-directory: templates/quickstart-chat-typescript
working-directory: templates/chat-react-ts
run: pnpm build

- name: Check that templates build
Expand Down
8 changes: 8 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 28 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ members = [
"modules/keynote-benchmarks",
"modules/perf-test",
"modules/module-test",
"templates/quickstart-chat-rust/spacetimedb",
"templates/chat-console-rs/spacetimedb",
"templates/basic-rs/spacetimedb",
"modules/sdk-test",
"modules/sdk-test-connect-disconnect",
"modules/sdk-test-procedure",
Expand Down Expand Up @@ -168,10 +169,16 @@ colored = "2.0.0"
console = { version = "0.15.6" }
convert_case = "0.6.0"
crc32c = "0.6.4"
criterion = { version = "0.5.1", features = ["async", "async_tokio", "html_reports"] }
criterion = { version = "0.5.1", features = [
"async",
"async_tokio",
"html_reports",
] }
crossbeam-channel = "0.5"
crossbeam-queue = "0.3.12"
cursive = { version = "0.20", default-features = false, features = ["crossterm-backend"] }
cursive = { version = "0.20", default-features = false, features = [
"crossterm-backend",
] }
decorum = { version = "0.3.1", default-features = false, features = ["std"] }
derive_more = "0.99"
dialoguer = { version = "0.11", default-features = false }
Expand All @@ -195,14 +202,19 @@ futures-util = "0.3"
getrandom02 = { package = "getrandom", version = "0.2" }
git2 = "0.19"
glob = "0.3.1"
hashbrown = { version = "0.16.1", default-features = false, features = ["equivalent", "inline-more", "rayon", "serde"] }
hashbrown = { version = "0.16.1", default-features = false, features = [
"equivalent",
"inline-more",
"rayon",
"serde",
] }
headers = "0.4"
heck = "0.4"
hex = "0.4.3"
home = "0.5"
hostname = "^0.3"
http = "1.0"
http-body-util= "0.1.3"
http-body-util = "0.1.3"
humantime = "2.1.0"
hyper = "1.0"
hyper-util = { version = "0.1", features = ["tokio"] }
Expand Down Expand Up @@ -232,7 +244,10 @@ paste = "1.0"
percent-encoding = "2.3"
petgraph = { version = "0.6.5", default-features = false }
pin-project-lite = "0.2.9"
pgwire = { version = "0.34.2", default-features = false, features = ["server-api", "pg-ext-types"] }
pgwire = { version = "0.34.2", default-features = false, features = [
"server-api",
"pg-ext-types",
] }
postgres-types = "0.2.5"
pretty_assertions = { version = "1.4", features = ["unstable"] }
proc-macro2 = "1.0"
Expand Down Expand Up @@ -262,7 +277,10 @@ second-stack = "0.3"
self-replace = "1.5"
semver = "1"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = { version = "1.0.128", features = ["raw_value", "arbitrary_precision"] }
serde_json = { version = "1.0.128", features = [
"raw_value",
"arbitrary_precision",
] }
serde_path_to_error = "0.1.9"
serde_with = { version = "3.3.0", features = ["base64", "hex"] }
serial_test = "2.0.0"
Expand All @@ -279,7 +297,9 @@ sqllogictest-engines = "0.17"
sqlparser = "0.38.0"
strum = { version = "0.25.0", features = ["derive"] }
syn = { version = "2", features = ["full", "extra-traits"] }
syntect = { version = "5.0.0", default-features = false, features = ["default-fancy"] }
syntect = { version = "5.0.0", default-features = false, features = [
"default-fancy",
] }
tabled = "0.14.0"
tar = "0.4"
tempdir = "0.3.7"
Expand Down
6 changes: 3 additions & 3 deletions crates/bindings-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
"generate:moduledef": "cargo run -p spacetimedb-codegen --example regen-typescript-moduledef && prettier --write src/lib/autogen",
"generate:client-api": "cargo run -p generate-client-api && prettier --write src/sdk/client_api",
"generate:test-app": "pnpm --filter @clockworklabs/test-app generate",
"generate:examples:quickstart-chat": "pnpm --filter @clockworklabs/quickstart-chat generate",
"generate:examples:basic-react": "pnpm --filter @clockworklabs/basic-react generate",
"generate:examples:chat-react-ts": "pnpm --filter @clockworklabs/chat-react-ts generate",
"generate:examples:react-ts": "pnpm --filter @clockworklabs/react-ts generate",
"generate:examples:empty": "pnpm --filter @clockworklabs/empty-client generate",
"generate": "pnpm generate:moduledef && pnpm generate:client-api && pnpm generate:test-app && pnpm generate:examples:quickstart-chat && pnpm generate:examples:basic-react && pnpm generate:examples:empty",
"generate": "pnpm generate:moduledef && pnpm generate:client-api && pnpm generate:test-app && pnpm generate:examples:chat-react-ts && pnpm generate:examples:react-ts && pnpm generate:examples:empty",
"prepublishOnly": "pnpm run build && pnpm run test && pnpm run size"
},
"main": "dist/index.cjs",
Expand Down
24 changes: 12 additions & 12 deletions crates/cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ fn generate_template_entry(code: &mut String, template_path: &Path, source: &str
// Example: crates/cli
let manifest_rel = manifest_canonical.strip_prefix(&repo_root_canonical).unwrap();

// Example for inside crate: /Users/user/SpacetimeDB/crates/cli/templates/basic-rust/server
// Example for outside crate: /Users/user/SpacetimeDB/modules/quickstart-chat
// Example for inside crate: /Users/user/SpacetimeDB/crates/cli/templates/basic-rs/server
// Example for outside crate: /Users/user/SpacetimeDB/modules/chat-console-rs
let resolved_canonical = repo_root.join(&resolved_base).canonicalize().unwrap();

// If the files are outside of the cli crate we need to copy them to the crate directory,
Expand All @@ -337,8 +337,8 @@ fn generate_template_entry(code: &mut String, template_path: &Path, source: &str
code.push_str(" let mut files = HashMap::new();\n");

for file_path in git_files {
// Example file_path: modules/quickstart-chat/src/lib.rs (relative to repo root)
// Example resolved_base: modules/quickstart-chat
// Example file_path: modules/chat-console-rs/src/lib.rs (relative to repo root)
// Example resolved_base: modules/chat-console-rs
// Example relative_path: src/lib.rs
let relative_path = match file_path.strip_prefix(&resolved_base) {
Ok(p) => p,
Expand All @@ -360,33 +360,33 @@ fn generate_template_entry(code: &mut String, template_path: &Path, source: &str
if full_path.exists() && full_path.is_file() {
let include_path = if let Some(ref copy_dir) = local_copy_dir {
// Outside crate: copy to .templates
// Example dest_file: /Users/user/SpacetimeDB/crates/cli/.templates/parent_parent_modules_quickstart-chat/src/lib.rs
// Example dest_file: /Users/user/SpacetimeDB/crates/cli/.templates/parent_parent_modules_chat-console-rs/src/lib.rs
let dest_file = copy_dir.join(relative_path);
fs::create_dir_all(dest_file.parent().unwrap()).expect("Failed to create parent directory");
copy_if_changed(&full_path, &dest_file)
.unwrap_or_else(|_| panic!("Failed to copy file {:?} to {:?}", full_path, dest_file));

// Example relative_to_manifest: .templates/parent_parent_modules_quickstart-chat/src/lib.rs
// Example relative_to_manifest: .templates/parent_parent_modules_chat-console-rs/src/lib.rs
let relative_to_manifest = dest_file.strip_prefix(manifest_dir).unwrap();
let path_str = relative_to_manifest.to_str().unwrap().replace("\\", "/");
// Watch the original file for changes
// Example: modules/quickstart-chat/src/lib.rs
// Example: modules/chat-console-rs/src/lib.rs
println!("cargo:rerun-if-changed={}", full_path.display());
path_str
} else {
// Inside crate: use path relative to CARGO_MANIFEST_DIR
// Example file_path: crates/cli/templates/basic-rust/server/src/lib.rs
// Example file_path: crates/cli/templates/basic-rs/server/src/lib.rs
// Example manifest_rel: crates/cli
// Result: templates/basic-rust/server/src/lib.rs
// Result: templates/basic-rs/server/src/lib.rs
let relative_to_manifest = file_path.strip_prefix(manifest_rel).unwrap();
let path_str = relative_to_manifest.to_str().unwrap().replace("\\", "/");
// Example: crates/cli/templates/basic-rust/server/src/lib.rs
// Example: crates/cli/templates/basic-rs/server/src/lib.rs
println!("cargo:rerun-if-changed={}", full_path.display());
path_str
};

// Example include_path (inside crate): "templates/basic-rust/server/src/lib.rs"
// Example include_path (outside crate): ".templates/parent_parent_modules_quickstart-chat/src/lib.rs"
// Example include_path (inside crate): "templates/basic-rs/server/src/lib.rs"
// Example include_path (outside crate): ".templates/parent_parent_modules_chat-console-rs/src/lib.rs"
// Example relative_str: "src/lib.rs"
code.push_str(&format!(
" files.insert(\"{}\", include_str!(concat!(env!(\"CARGO_MANIFEST_DIR\"), \"/{}\")));\n",
Expand Down
16 changes: 8 additions & 8 deletions crates/cli/src/subcommands/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1484,11 +1484,11 @@ pub async fn exec(mut config: Config, args: &ArgMatches) -> anyhow::Result<PathB
pub fn init_rust_project(project_path: &Path) -> anyhow::Result<()> {
let export_files = vec![
(
include_str!("../../../../templates/basic-rust/spacetimedb/Cargo.toml"),
include_str!("../../../../templates/basic-rs/spacetimedb/Cargo.toml"),
"Cargo.toml",
),
(
include_str!("../../../../templates/basic-rust/spacetimedb/src/lib.rs"),
include_str!("../../../../templates/basic-rs/spacetimedb/src/lib.rs"),
"src/lib.rs",
),
];
Expand All @@ -1508,15 +1508,15 @@ pub fn init_rust_project(project_path: &Path) -> anyhow::Result<()> {
pub fn init_csharp_project(project_path: &Path) -> anyhow::Result<()> {
let export_files = vec![
(
include_str!("../../../../templates/basic-c-sharp/spacetimedb/StdbModule.csproj"),
include_str!("../../../../templates/basic-cs/spacetimedb/StdbModule.csproj"),
"StdbModule.csproj",
),
(
include_str!("../../../../templates/basic-c-sharp/spacetimedb/Lib.cs"),
include_str!("../../../../templates/basic-cs/spacetimedb/Lib.cs"),
"Lib.cs",
),
(
include_str!("../../../../templates/basic-c-sharp/spacetimedb/global.json"),
include_str!("../../../../templates/basic-cs/spacetimedb/global.json"),
"global.json",
),
];
Expand All @@ -1536,15 +1536,15 @@ pub fn init_csharp_project(project_path: &Path) -> anyhow::Result<()> {
pub fn init_typescript_project(project_path: &Path) -> anyhow::Result<()> {
let export_files = vec![
(
include_str!("../../../../templates/basic-typescript/spacetimedb/package.json"),
include_str!("../../../../templates/basic-ts/spacetimedb/package.json"),
"package.json",
),
(
include_str!("../../../../templates/basic-typescript/spacetimedb/tsconfig.json"),
include_str!("../../../../templates/basic-ts/spacetimedb/tsconfig.json"),
"tsconfig.json",
),
(
include_str!("../../../../templates/basic-typescript/spacetimedb/src/index.ts"),
include_str!("../../../../templates/basic-ts/spacetimedb/src/index.ts"),
"src/index.ts",
),
];
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn cli_init_with_template_creates_project() {
.args([
"init",
"--template",
"basic-rust",
"basic-rs",
"--local",
"--non-interactive",
"test-project",
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn cli_can_publish_spacetimedb_on_disk() {
// dir = <workspace_root>/modules/quickstart-chat
let dir = workspace_dir
.join("templates")
.join("quickstart-chat-rust")
.join("chat-console-rs")
.join("spacetimedb");

let mut cmd = cargo_bin_cmd!("spacetimedb-cli");
Expand Down
2 changes: 1 addition & 1 deletion docs/STYLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -411,4 +411,4 @@ If the tutorial involved writing code, add a link to the complete code. This sho

At the end of the tutorial that builds the `quickstart-chat` module in Rust, you might write:

> You can find the full code for this module in [the SpacetimeDB module examples](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/quickstart-chat-rust/spacetimedb).
> You can find the full code for this module in [the SpacetimeDB module examples](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/chat-console-rs/spacetimedb).
2 changes: 1 addition & 1 deletion docs/docs/00100-intro/00200-quickstarts/00100-react.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Get a SpacetimeDB React app running in under 5 minutes.
</StepText>
<StepCode>
```bash
spacetime dev --template basic-react my-spacetime-app
spacetime dev --template react-ts my-spacetime-app
```
</StepCode>
</Step>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Get a SpacetimeDB TypeScript app running in under 5 minutes.
</StepText>
<StepCode>
```bash
spacetime dev --template basic-typescript my-spacetime-app
spacetime dev --template basic-ts my-spacetime-app
```
</StepCode>
</Step>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/00100-intro/00200-quickstarts/00500-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Get a SpacetimeDB Rust app running in under 5 minutes.
</StepText>
<StepCode>
```bash
spacetime dev --template basic-rust my-spacetime-app
spacetime dev --template basic-rs my-spacetime-app
```
</StepCode>
</Step>
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/00100-intro/00200-quickstarts/00600-c-sharp.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ dotnet workload install wasi-experimental
</StepText>
<StepCode>
```bash
spacetime dev --template basic-c-sharp my-spacetime-app
spacetime dev --template basic-cs my-spacetime-app
```
</StepCode>
</Step>
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/00100-intro/00300-tutorials/00100-chat-app.md
Original file line number Diff line number Diff line change
Expand Up @@ -661,9 +661,9 @@ Output will resemble:
```

You've just set up your first SpacetimeDB module! You can find the full code for this module:
- [TypeScript server module](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/quickstart-chat-typescript)
- [C# server module](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/quickstart-chat-c-sharp/spacetimedb)
- [Rust server module](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/quickstart-chat-rust/spacetimedb)
- [TypeScript server module](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/chat-react-ts)
- [C# server module](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/chat-console-cs/spacetimedb)
- [Rust server module](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/chat-console-rs/spacetimedb)

---

Expand Down Expand Up @@ -1429,7 +1429,7 @@ You've just experienced the core features of SpacetimeDB: real-time synchronizat

### Conclusion

Congratulations! You've built a simple chat app with SpacetimeDB. You can find the full source code for the client we've created in this quickstart tutorial [here](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/quickstart-chat-typescript).
Congratulations! You've built a simple chat app with SpacetimeDB. You can find the full source code for the client we've created in this quickstart tutorial [here](https://github.com/clockworklabs/SpacetimeDB/tree/master/templates/chat-react-ts).

At this point you've learned how to create a basic TypeScript client for your SpacetimeDB `quickstart-chat` module. You've learned how to connect to SpacetimeDB and call reducers to update data. You've learned how to subscribe to table data, and hook it up so that it updates reactively in a React application.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,13 @@ Creates a full-stack React web application with:
#### Use Template
Choose from several built-in templates:

- `basic-typescript` - Basic TypeScript client and server stubs
- `basic-c-sharp` - Basic C# client and server stubs
- `basic-rust` - Basic Rust client and server stubs
- `basic-react` - React web app with TypeScript server
- `quickstart-chat-rust` - Complete Rust chat implementation
- `quickstart-chat-c-sharp` - Complete C# chat implementation
- `quickstart-chat-typescript` - Complete TypeScript chat implementation
- `basic-ts` - Basic TypeScript client and server stubs
- `basic-cs` - Basic C# client and server stubs
- `basic-rs` - Basic Rust client and server stubs
- `react-ts` - React web app with TypeScript server
- `chat-console-rs` - Complete Rust chat implementation
- `chat-console-cs` - Complete C# chat implementation
- `chat-react-ts` - Complete TypeScript chat implementation

You can also clone an existing project by entering a GitHub repository (`owner/repo`) or git URL.

Expand Down
3 changes: 0 additions & 3 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ export default tseslint.config(
'./tsconfig.json',
'./crates/bindings-typescript/tsconfig.json',
'./crates/bindings-typescript/test-app/tsconfig.json',
'./crates/bindings-typescript/examples/basic-react/tsconfig.json',
'./crates/bindings-typescript/examples/empty/tsconfig.json',
'./crates/bindings-typescript/examples/quickstart-chat/tsconfig.json',
'./docs/tsconfig.json',
],
projectService: true,
Expand Down
Loading
Loading