Architecture Decisions
MVP architecture decisions for the Linkage frontend SDK
Package boundaries
- Headless graph types, serialization, and commands live in
lib/open/src/libandlib/open/src/core. - React components and hooks live in
lib/open/src/react. - Server-only helpers live in
lib/open/src/server. - Public entrypoints remain split:
@linkage-open/lib@linkage-open/lib/react@linkage-open/lib/server
Canonical schema authoring
- Zod-first authoring.
- Schemas are serialized with zodex
zerializefor registries and workflow JSON. - JSON Schema compatibility is not required in v0.
- Use
z.enum,z.union,z.default, andz.describeto encode metadata.
Portable workflow JSON (skeleton)
Top-level fields:
schemaVersionnodesByIdedgesByIdviewport(optional)metadata(optional)
Node fields:
id(stable)type(registry key)name(optional)positiondata(optional)input/output(optional config maps)
Edge fields:
id(stable)sourcetargetsourceHandle/targetHandle(optional)data(optional)
Deterministic serialization:
- Sort nodes and edges by
idbefore converting to by-id maps. - Omit UI-only fields (selection, dragging).
- Avoid undefined keys.
See Workflow JSON for the concrete v1 schema and migration behavior.
Port type system (static validation)
- Port types are zodex-serialized Zod schemas.
- Compatibility rules:
anyaccepts any output.- Identical normalized schemas are compatible.
- Union inputs accept any compatible branch.
- Literal/enum outputs are compatible with the same base primitive.
- Objects/arrays require structural equality.
- Refinements and transforms are ignored in v0.
MVP adapter transports
- Mock adapter for demos/tests.
- REST adapter with polling, optional SSE for live updates.
- Only
subscribeis required in v0;startRun,cancelRun,fetchRun, andfetchNodeOutputare optional.