Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 9 additions & 0 deletions npm-packages/create-spacetime/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
node_modules/
dist/
*.log

.env*

.DS_Store
*.tgz
*.tsbuildinfo
12 changes: 12 additions & 0 deletions npm-packages/create-spacetime/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
src/
*.ts
!*.d.ts

# config files
.eslintrc*
.prettierrc*
tsconfig*.json
.gitignore

*.log
*.tsbuildinfo
6 changes: 6 additions & 0 deletions npm-packages/create-spacetime/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"semi": true,
"singleQuote": false,
"printWidth": 100,
"tabWidth": 2
}
77 changes: 77 additions & 0 deletions npm-packages/create-spacetime/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# create-spacetime

## Overview

This package contains the official CLI tool for creating SpacetimeDB projects. The CLI allows you to quickly scaffold new SpacetimeDB applications with a template of your choice (React frontends with Rust or C# backends).

## Installation

To create a new SpacetimeDB project:

```bash
npm create spacetime@latest
```

## Usage

To create a project you can run the interactive setup or specify options directly.

```bash
npm create spacetime@latest my-spacetime-app -- -t rust
```

Skip interactive prompts with `-y` (defaults server language to Rust):

```bash
npm create spacetime@latest my-spacetime-app -- -y
```

The `-t` flag selects your server language template.

Available templates:

- `rust` - Rust server with React client
- `csharp` - C# server with React client

Create in your current directory using `.` as the project name:

```sh
npm create spacetime@latest .
```

Use a local SpacetimeDB server instead of Maincloud:

```bash
npm create spacetime@latest my-spacetime-app -- --local
```

## What You Get

Creates a full-stack SpacetimeDB app with server module and React frontend, including build scripts and example chat app.

## Requirements

- Node.js 18+ and npm 8+
- SpacetimeDB CLI (optional for creation, required for Maincloud deployment) - [spacetimedb.com/install](https://spacetimedb.com/install)

## Running The Project

After project creation:

```bash
cd my-spacetime-app
npm run dev
```

Your React app will be available at `http://localhost:5173`.

To deploy your SpacetimeDB module:

```bash
npm run local # Local deployment
npm run deploy # Deploy to Maincloud
```

## Learn More

- [SpacetimeDB Documentation](https://spacetimedb.com/docs)
59 changes: 59 additions & 0 deletions npm-packages/create-spacetime/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{
"name": "create-spacetime",
"version": "0.0.6",
"type": "module",
"author": {
"name": "Clockwork Labs",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/clockworklabs/SpacetimeDB.git",
"directory": "cli/create-spacetime"
},
"engines": {
"node": ">=18.0.0",
"npm": ">=8.0.0"
},
"bin": {
"create-spacetime": "./dist/index.js"
},
"files": [
"dist/**/*"
],
"scripts": {
"build": "tsc",
"dev": "tsc --watch",
"clean": "rm -rf dist",
"lint": "eslint src --ext .ts",
"lint:fix": "eslint src --ext .ts --fix",
"format": "prettier --write src/**/*.ts src/*.ts",
"format:check": "prettier --check src/**/*.ts",
"prepare": "npm run build",
"prepublishOnly": "npm run clean && npm run lint && npm run format:check && npm run build",
"size-check": "npm pack --dry-run",
"test": "npm run build && node dist/index.js test-app --dry-run"
},
"dependencies": {
"chalk": "^5.3.2",
"commander": "^12.0.0",
"cross-spawn": "^7.0.3",
"degit": "^2.8.4",
"fs-extra": "^11.2.0",
"inquirer": "^9.2.15",
"ora": "^8.0.1",
"validate-npm-package-name": "^5.0.0",
"which": "^4.0.0"
},
"devDependencies": {
"@types/cross-spawn": "^6.0.6",
"@types/degit": "^2.8.6",
"@types/fs-extra": "^11.0.4",
"@types/inquirer": "^9.0.7",
"@types/node": "^20.11.24",
"@types/validate-npm-package-name": "^4.0.2",
"@types/which": "^3.0.3",
"prettier": "^3.2.5",
"typescript": "^5.5.4"
}
}
Loading
Loading