A client-first ECS-based game engine using TypeScript, Vite, and Nx monorepo.
This project follows a strict Entity-Component-System architecture:
- Entities: Opaque IDs only (using type-fest tagged types)
- Components: Pure data, no logic
- Systems: Operate over component sets, no direct system-to-system calls
- Feature-oriented structure: Not "components vs systems"
- Client-first: Browser-based runtime with Vite
- Multiplayer-ready: Networking layer to be added later
- Schema-first serialization: Supports JSON (authoring) and binary (runtime)
/better-ecs
/apps
/client # Browser game (Vite)
/server # Placeholder for future backend
/packages
/engine # ECS, math, serialization, runtime
/shared # Shared utilities/types
nx.json
package.json
tsconfig.base.json
/packages/engine/src
/ecs
entity.ts # Entity type & factory
world.ts # World container
storage.ts # Component storage
/math
index.ts # Math utilities (to be implemented)
/serialization
schema.ts # Component schema interface
json.ts # JSON serialization (to be implemented)
binary.ts # Binary serialization (to be implemented)
index.ts
/core
game.ts # Game initialization
time.ts # Time management (to be implemented)
index.ts
Install dependencies:
npm installRun the client:
npm run devOr run specific app:
npx nx dev client- Entities are IDs only - No classes, no methods
- Components are pure data - No behavior, no cross-references
- Systems do not call each other - Communication via shared data
- Serialization is schema-driven - Not raw JS objects
- Rendering is policy-driven - Draw order is a rendering decision
- Multiplayer is layered later - Architecture stays clean
- Structure precedes implementation - This is bootstrap phase only
This is structure only. The following are NOT implemented yet:
- ❌ Rendering systems
- ❌ Gameplay systems
- ❌ Components (Transform, Renderable, etc.)
- ❌ Serialization logic
- ❌ Networking
- ❌ Editors
- ❌ Game loop logic
After bootstrap:
- Implement core game loop
- Add basic component types (Transform, etc.)
- Create render system
- Add serialization implementation
- Build gameplay systems
- Add networking layer