Aller au contenu principal

2. Architecture

AUSUS 2.0 is a layered monorepo. Each layer depends only on layers below it; there are no upward or sideways dependencies between peers. Layer numbers come from each package's composer.json (extra.ausus.layer).

LayerPackageRoleDepends on
L0ausus/kernelFrozen DTOs + contracts (Definition, Contracts, Compiled)
L1ausus/entity-engineCompiler, Canonicalizer, Hasher, ClosureValidator, AuthorizationEvaluator, EntityEngine::bind, RuntimeEntity, in-memory schema repokernel
L1ausus/authoringClosed PHP DSL (Definition, Expr) → EntityDefinitionkernel
L3ausus/persistence-memoryReference in-memory PersistenceDriverkernel
L4ausus/api-runtimeHTTP API: resolve → bind → invoke/readkernel, entity-engine
L5ausus/view-systemViewDefinition / PageDefinition / SectionDefinition metadatakernel
L5@ausus/react-rendererGeneric React UI over the HTTP API(HTTP only)
L6ausus/cliDSL frontend (discover/scan/load) + ausus compile + FileSchemaRepositorykernel, authoring, entity-engine

Diagram

┌─────────────────────────────────────────────┐
L6 CLI │ DslFrontend ── Compiler ── FileSchemaRepo │
(ausus/cli) │ entities/*.php → .ausus/schemas + index │
└───────────────┬─────────────────────────────┘
│ writes / reads
L5 Presentation ┌─────────────────▼──────────────┐ ┌──────────────────┐
view-system │ ViewDefinition → pages/sections│ │ @ausus/react- │
react-renderer │ (projection XOR action) │──▶│ renderer (HTTP) │
└─────────────────┬───────────────┘ └────────┬─────────┘
│ │ fetch
L4 API ┌─────────────────▼────────────────────────────▼─────────┐
api-runtime │ RuntimeApi: GET /api/entities/{e}[/projections|/actions]│
└─────────────────┬───────────────────────────────────────┘
│ resolve → bind → invoke/read
L3 Persistence ┌─────────────────▼───────────┐
persistence- │ PersistenceDriver (contract)│ ← MemoryDriver (reference)
memory └─────────────────┬───────────┘

L1 Engine ┌─────────────────▼───────────────────────────────────────┐
entity-engine │ Compiler · Canonicalizer · Hasher · ClosureValidator │
authoring │ AuthorizationEvaluator · EntityEngine::bind │
│ RuntimeEntity (invoke/read) ◀── DSL (authoring) │
└─────────────────┬───────────────────────────────────────┘
│ consumes
L0 Kernel ┌─────────────────▼───────────────────────────────────────┐
kernel │ EntityDefinition, FieldDefinition, ActionDefinition, │
│ ProjectionDefinition, Expression, EntitySchema, │
│ Contracts (EntityEngine, RuntimeEntity, SchemaRepository,│
│ AuthorizationEvaluator, Context, PersistenceDriver) │
└─────────────────────────────────────────────────────────┘

Boundary rules enforced by 2.0

  • The kernel (L0) has zero dependencies and knows no source format, no storage, no HTTP.
  • The runtime (RuntimeEntity) never recompiles, never loads the DSL, and depends only on the PersistenceDriver contract (not a concrete driver).
  • The API runtime (L4) consumes only SchemaRepository, EntityEngine, and RuntimeEntity — never the Compiler/Canonicalizer/Hasher/DSL frontend.
  • The React renderer (L5) imports no AUSUS PHP package; it speaks only the HTTP contract.