Welcome to Klura! This guide will help you get up and running with the development environment.
- Node.js: >= 18.0.0
- pnpm: >= 8.0.0 (Install with
npm install -g pnpm) - Git: Latest version
All dependencies have been installed. If you need to reinstall:
pnpm installKlura/
├── apps/
│ ├── backend/ # NestJS backend (initialized)
│ └── klura-front-end/ # Vue 3 frontend (initialized)
├── packages/
│ └── shared/ # Shared types & schemas (✅ complete)
└── game-content/ # Game definitions (✅ example content)
pnpm devThis starts both frontend and backend simultaneously.
pnpm dev:frontend
# or
cd apps/klura-front-end && pnpm devFrontend will be available at: http://localhost:5173
pnpm dev:backend
# or
cd apps/backend && pnpm devBackend will be available at: http://localhost:3000
The shared package has been built and is ready to use. To rebuild:
pnpm build:shared
# or
cd packages/shared && pnpm buildcurl http://localhost:3000/healthExpected response:
{
"status": "ok",
"timestamp": "2025-12-26T..."
}# Check all packages
pnpm type-check
# Check specific package
pnpm --filter @klura/backend type-check-
Monorepo Configuration
- pnpm workspaces configured
- Root package.json with monorepo scripts
-
Shared Package (@klura/shared)
- ✅ Zod schemas for all game entities
- ✅ TypeScript types (inferred from schemas)
- ✅ Theme system (base + victorian-gothic)
- ✅ Built and ready for import
-
Backend (@klura/backend)
- ✅ NestJS initialized with Fastify
- ✅ TypeScript strict mode enabled
- ✅ Basic app structure (AppModule, AppController, AppService)
- ✅ Health check endpoint
- ✅ ESLint configured
- ✅ Dependencies installed
-
Frontend (klura-front-end)
- ✅ Vue 3 + Vite scaffolded
- ✅ TypeScript configured
- ✅ Ready for development
-
Game Content Examples
- ✅ Murder Mystery Engine template
- ✅ Blackwood Mansion variant
- ✅ Blackwood narrative story
- Demonstrates the Game-as-Data pattern
The shared package is already linked via pnpm workspaces. Import it in backend:
// In backend code
import { GameState, GameVariantSchema } from '@klura/shared';
import { victorianGothicTheme } from '@klura/shared/themes';
// Validate data
const validatedVariant = GameVariantSchema.parse(inputData);
// Use types
const state: GameState = {
roomId: 'uuid',
status: 'LOBBY',
// ...
};-
Create Core Modules
-
src/core/game-engine/- Main game orchestration -
src/core/persona-engine/- Role assignment -
src/core/content-loader/- Load game configs
-
-
Set Up Infrastructure
- Redis connection service
- tRPC router module
- WebSocket gateway
-
Create First Plugin
-
src/plugins/murder-mystery.plugin.ts - Implement ACCUSE_PLAYER, EXAMINE_CLUE actions
-
-
Set Up State Management
- Install and configure Pinia
- Create game state store
-
Create UI Components
- Lobby screen
- Game board
- Persona-specific views
-
Integrate Real-time
- Install socket.io-client
- Connect to backend WebSocket
- Handle GAME_UPDATE events
Copy .env.example to .env in apps/backend/:
cd apps/backend
cp .env.example .envEdit .env with your configuration:
- Redis connection details
- Supabase credentials
- JWT secret
Following TDD principles:
- Write a failing test (Red)
- Implement minimal code to pass (Green)
- Refactor for quality (Refactor)
- Commit after each completed task
# Shared package
cd packages/shared && pnpm test
# Backend
cd apps/backend && pnpm test
# All packages
pnpm testCritical: Mutations go through tRPC, updates via Socket.IO.
Client → tRPC (validate) → Backend (process) → Redis (save)
↓
Client ← Socket.IO (broadcast) ← GameGateway ← ─────┘
New games are added via JSON configuration, not code:
/game-content/
├── templates/ # Reusable mechanics
├── variants/ # Themed instances
└── stories/ # Narrative content
If port 3000 or 5173 is already in use:
# Change backend port
# Edit apps/backend/.env: PORT=3001
# Change frontend port
# Edit apps/klura-front-end/vite.config.ts: server.portIf you see type errors after changes to shared package:
# Rebuild shared package
pnpm --filter @klura/shared build
# Restart TypeScript server in your IDEIf packages aren't linking correctly:
# Clean and reinstall
pnpm clean
pnpm install- Architecture:
/conductor/code_styleguides/architecture.md - Tech Stack:
/conductor/tech-stack.md - CLAUDE.md: Guidance for Claude Code
- Project Structure:
/PROJECT_STRUCTURE.md
If you encounter issues:
- Check the documentation in
/conductor/ - Verify all prerequisites are installed
- Ensure environment variables are set correctly
- Check that all dependencies installed successfully
Ready to Start? Run pnpm dev and start building!