Restructure into pnpm monorepo with game shell, docs, and SpacetimeDB backend
- Restructure flat static prototype into pnpm workspace monorepo - apps/game: playable shell with R3F 3D scene, HUD, SpacetimeDB connection - apps/docs: design docs and prototypes - apps/site: landing page - packages/ui: shared Button and Panel primitives - services/spacetimedb: backend module (9 tables, 11 reducers) - Archive legacy static files to archive/legacy-static/ - Game loop: connect, undock, target, approach, dock, mine, sell - Add pnpm-workspace.yaml, tsconfig.base.json, spacetime.json
This commit is contained in:
91
README.md
91
README.md
@@ -1,37 +1,84 @@
|
||||
# VOID::NAV
|
||||
|
||||
Vite + React + TypeScript documentation and prototype hub for the Space-Game project.
|
||||
VOID::NAV is now a pnpm workspace monorepo for the game website, living design docs, browser game shell, and SpacetimeDB backend module.
|
||||
|
||||
## Layout
|
||||
|
||||
```text
|
||||
apps/docs Existing docs, interactive demos, and vertical slice
|
||||
apps/site Public landing page / game website
|
||||
apps/game Playable game shell connected to SpacetimeDB bindings
|
||||
packages/ui Small shared UI primitives and CSS tokens
|
||||
services/spacetimedb TypeScript SpacetimeDB module
|
||||
archive/legacy-static Legacy static prototype files kept for reference
|
||||
```
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 24+
|
||||
- pnpm 9+
|
||||
- SpacetimeDB CLI for backend build, generation, and local DB runs
|
||||
|
||||
The SpacetimeDB CLI is not vendored. Frontend builds use the committed placeholder bindings in `apps/game/src/module_bindings`; run `pnpm generate:bindings` after installing the CLI to replace them with generated bindings.
|
||||
|
||||
## Development
|
||||
|
||||
```bash
|
||||
pnpm install
|
||||
pnpm dev
|
||||
pnpm dev:docs
|
||||
pnpm dev:site
|
||||
pnpm dev:game
|
||||
```
|
||||
|
||||
## Build
|
||||
Default ports:
|
||||
|
||||
```bash
|
||||
pnpm build
|
||||
```
|
||||
- docs: `http://localhost:5173/docs`
|
||||
- site: `http://localhost:5174`
|
||||
- game: `http://localhost:5175`
|
||||
|
||||
## Routes
|
||||
|
||||
- `/` - landing page
|
||||
- `/docs` - documentation overview
|
||||
- `/docs/demos/*` - converted interactive demos
|
||||
- `/docs/prototypes/game-hud` - HUD style reference for future demos
|
||||
- `/app` - future game application shell
|
||||
|
||||
## Browser Routing
|
||||
|
||||
This app uses browser-history routes. The Vite dev server works without extra setup.
|
||||
Static production hosting must rewrite all routes to `index.html`.
|
||||
|
||||
Example Netlify rule:
|
||||
The public site links to docs and game via:
|
||||
|
||||
```text
|
||||
/* /index.html 200
|
||||
VITE_DOCS_URL=http://localhost:5173/docs
|
||||
VITE_GAME_URL=http://localhost:5175
|
||||
```
|
||||
|
||||
For Vercel or another static host, configure the equivalent SPA fallback to `index.html`.
|
||||
The game shell reads:
|
||||
|
||||
```text
|
||||
VITE_SPACETIME_URI=http://localhost:3000
|
||||
VITE_SPACETIME_DATABASE=void-nav-dev
|
||||
```
|
||||
|
||||
## Builds
|
||||
|
||||
```bash
|
||||
pnpm --filter @void-nav/docs build
|
||||
pnpm --filter @void-nav/site build
|
||||
pnpm --filter @void-nav/game build
|
||||
pnpm build
|
||||
pnpm check
|
||||
```
|
||||
|
||||
## SpacetimeDB
|
||||
|
||||
Root `spacetime.json` points at `services/spacetimedb` and generates TypeScript bindings into `apps/game/src/module_bindings`.
|
||||
|
||||
With the CLI installed:
|
||||
|
||||
```bash
|
||||
spacetime build --module-path services/spacetimedb
|
||||
pnpm generate:bindings
|
||||
pnpm dev:db
|
||||
```
|
||||
|
||||
`pnpm dev:db` targets the SpacetimeDB CLI server nickname `local` so development publishes to `http://127.0.0.1:3000` instead of any configured cloud default.
|
||||
|
||||
Initial reducers:
|
||||
|
||||
- `connectPlayer(displayName: string)`
|
||||
- `renamePlayer(displayName: string)`
|
||||
- `seedWorld()`
|
||||
- `ping()`
|
||||
|
||||
The game shell calls `connectPlayer` after connection, subscribes to starter shell rows, and displays connection, player, ship, system, station, and reducer status. When SpacetimeDB is unavailable or bindings are still placeholders, it shows a clear disconnected/error state.
|
||||
|
||||
Reference in New Issue
Block a user