How aeternus-capital/theatrum works
Project type and purpose
• This is an open-source, monorepo tool written in TypeScript (Deno-compatible) called “Theatrum.”
• It consists of two main packages:
• @theatrum/core – the runtime engine for defining entities, methods, executors, and dispatching calls (no vendor lock-in).
• @theatrum/console – a React/Mantine web UI for exploring & interacting with the core via network calls.
• There is also an “examples/basic” application showing how to wire core into a Deno server and optionally connect a database (e.g., MongoDB integration).
File structure
• Top-level directories:
• docs/ – static documentation and topics (architecture, examples, integrations).
• packages/core/ – core library source, errors, types, executor, entity, method abstractions.
• packages/console/ – web client with UI components (Actors, Entities, Methods, Playground, History), network.js, store layer, bundler & DNT tools.
• examples/basic/ – sample Deno app bootstrapping core, defining User entity & a math/sum method.
• Config files: deno.json, deno.lock in root and in each package; publish workflows in .github; dnt.json for npm builds.
Key insights from the README
• Core is lightweight, runtime-agnostic (works in Deno, service workers, Node via DNT output).
• Console is a standalone SPA that communicates with any Theatrum-powered endpoint.
• No opinions on router/auth – it exposes a minimal RPC layer.
Main components and interactions
a. Components
1. Client Layer
• Browser running @theatrum/console SPA (Actors, Entities, Methods, Playground, History UI).
2. Network/API Layer
• network.js in console → JSON-RPC/HTTP endpoints exposed by the core.
3. Application Server
• Example/basic (or any Theatrum server) using @theatrum/core.
• Sub-components inside core:
– Entity Registry (packages/core/src/entity.ts)
– Method Registry (packages/core/src/method.ts)
– Executor (packages/core/src/executor.ts)
– Error handling (packages/core/src/errors.ts)
– Theatrum orchestrator (packages/core/src/theatrum.ts)
4. Data Layer (optional)
• External services (e.g., MongoDB via integration-mongodb example, file storage, other HTTP APIs).
b. Relationships & Data Flow
• Browser → HTTP RPC → Theatrum server
• Theatrum server → Entities & Methods → Executor
• Executor → (optionally) Database or external service
• Theatrum server → JSON result → Browser
c. Architectural patterns & principles
• Plug-in style registries for Entities and Methods.
• Separation of concerns: core runtime vs. UI client.
• Runtime-agnostic code (no Deno- or Node-specific APIs in core).
• Single-page application for administrative console.
d. Key technologies & frameworks
• Deno + TypeScript (core & server example)
• React + Mantine (console UI)
• JSON-RPC / HTTP for remote calls
• DNT for Node.js packaging