MANIFESTO // 2025

Real‑Time Web Without the Hangover: Why TX‑2 ECS Changes Everything

Every few years, the web development world rediscovers the same dream: what if building real‑time, multiplayer, stateful apps didn’t feel like wrestling a pile of ad‑hoc patches?

We bolt WebSockets onto REST. We sprinkle in a state library or two. We invent yet another RPC layer. It all sort of works—until the app is big, the team is bigger, and any change risks a regression in some forgotten corner.

TX‑2 ECS starts from a different premise. Instead of treating state management, rendering, networking, and real‑time sync as separate problems, it adopts the architecture game engines have been refining for years: an Entity–Component–System (ECS) core, wired directly into a web‑native runtime.


The Architecture: One World, Two Contexts

The typical modern web stack is built on a quiet lie: the idea that it’s fine to have one shape of state on the server (SQL), another in your client store (Redux/Zustand), and a third in your UI (DOM), as long as you have enough glue code in between.

TX‑2 rejects that. The ECS world is the state model.

  • Server: You have a world of entities, components, and systems that implement core domain logic.
  • SSR: That world is serialized—snapshots, state, and all—into HTML.
  • Client: The browser "hydrates" that exact same world, waking up the entities and systems without missing a frame.

Renderers are not special; they are just systems that read components and produce DOM. Networking is not special; it’s a system that serializes changes and applies deltas. There is no second store hiding behind your view layer.


Composability That Survives Five Years of Feature Requests

Every experienced engineer knows that the hardest part of software is not getting version one out the door. It’s version twenty‑seven, after marketing, product, and three reorgs have left their fingerprints everywhere.

“Can we make premium users’ avatars have a gold outline? Oh, and it should also glow during special events if they’re online.”

In a typical OOP‑heavy or component-tree stack, this involves a trail of compromises. You extend a base Avatar component, add a boolean flag, thread isPremium through six layers, duplicate CSS, and hope you didn't break the admin dashboard.

In TX‑2, this request is dull in the best possible way.

  • Premium is a component.
  • Online is a component.
  • VisualState is a component.

To implement the feature, you write a small system: AvatarGlowSystem. It queries for entities with [Avatar, Premium, Online] and updates the style. The rest of the codebase doesn’t know or care. You don’t perform surgery on old code; you simply compose a new behavior.


Real‑Time Sync That Doesn’t Bleed Your Budget

If you’ve ever run a popular real‑time app, you know the dirty secret: it’s expensive. Egress, CPU, and memory add up.

Most stacks start by sending full JSON snapshots over WebSockets. TX‑2 is opinionated about making sure you don’t stay there. Because the framework understands exactly which component fields have changed, it ships Deltas, not snapshots.

  • Naive Approach: Sending a 4KB user state snapshot @ 20 ticks/sec = 80KB/sec per user.
  • TX-2 Approach: Sending a 200-byte delta (only what changed) @ 20 ticks/sec = 4KB/sec per user.
  • That is a 20x reduction in bandwidth.

Security That Isn't an Afterthought

In most real-time frameworks, security is the tax you pay at the end of the project. You manually sanitize inputs, patch prototype pollution holes, and wrap every WebSocket handler in try/catch blocks.

In TX-2, security is the pavement you walk on.

  • XSS Neutralized: The Server-Side Renderer (SSR) automatically sanitizes attributes and strips dangerous event handlers before HTML ever hits the client.
  • No Prototype Pollution: The state deserializer explicitly blocks dangerous keys (__proto__, constructor), closing the most common vector for attacking state synchronization.
  • Gated RPCs: The Remote Procedure Call system includes declarative Rate Limiting and Authorization checks.

Developer Experience That Ages Well

The true test of a framework is not how pleasant it feels in the honeymoon phase. It’s how it behaves when the codebase has grown and the team has rotated. Onboarding new developers to TX-2 is radically simpler. The boundaries are clear because the architecture forces them to be.

Web Architecture, Corrected.

TX‑2 ECS is not a silver bullet. But if you are building applications that look like living systems—multiplayer tools, simulations, real‑time dashboards, collaborative editors—the traditional web stack makes you pay a tax in complexity.

By centering an ECS world, unifying state across server and client, and baking in efficient sync, TX‑2 offers an alternative. It treats your application like a world, not a collection of disconnected widgets.

npm install tx2-ecs
© 2025 TX-2 // Built with tx2-ecsSketchpad → TX-2 → Web