WEB ARCHITECTURE, CORRECTED.
In 1963, Ivan Sutherland drew on a phosphor display with the TX-2 light pen and built the first interactive ECS. TX-2 brings that architecture to the modern web: isomorphic logic, zero bloat, precise control.
Fullstack ECS
Define components once. The same systems run on server and client with deterministic state and hydration.
Reactive Core
Signals, computed values, and effects without VDOM drift. Minimal allocations, maximal control.
SSR + Sync
Server-side rendering with hydration markers plus delta-compressed state synchronization.
Type-Safe RPC
Define procedures with runtime guards and TypeScript inference across the wire.
Performance Discipline
Query indexing, batched updates, and worker-ready schedulers for heavy scenes.
Zero Bloat
ESM-first, tree-shakeable modules. No framework runtime tax.
Architecture
TX-2 is an isomorphic ECS. Define components and systems once; run them on server and client. Hydration carries state across the wire without VDOM.
Entities & Components
- Entity: ID-only container.
- Component: State + reactive signals via defineReactive.
- Systems: Functions over queries; phases: init/update/fixedUpdate/lateUpdate/cleanup.
Reactivity
Signals are first-class. Components expose signals; systems react via effects. No VDOM diffing; direct DOM ops in render system.
Rendering
Client: Render.create wraps a render() returning h() trees. Server: renderDocument(world) emits HTML + hydration markers.
RPC & Sync
RPC definitions live in server; clients call with inferred types. State sync uses delta compression; only dirty signals move.
Deployment
- Bundle: npm run build (core/client/server + types).
- Node SSR: import { renderDocument } from "tx2-ecs/server".
- Client: include /dist/client/index.js or bundle with your app.
Client Render
Use Render.create to bind a render function. h(tag, props, ...children) builds DOM nodes directly; no VDOM diff.
SSR
renderDocument(world, opts) outputs HTML with hydration data. Include <script type="module" src="/dist/client/index.js">.
Hydration
hydrateWorld(world, { root, clearMarkers }) attaches to server markup and restores signals.
State Sync (server-driven)
Track dirty signals; ship deltas. RPC hooks can push state; clients patch into components.
SSR Hydration
This page is server rendered via TX-2 and hydrated on load. No extra framework.
View Render