# Guide: Composing Apps (Compositor & Sockets)

Beyond nesting components, ChainRender has an **on-chain compositor** (`CompositionRouter`) that assembles multiple
components/scenes into one output via **sockets** — named slots a child plugs into.

## Sockets

A parent composition declares sockets; children plug into them by reference (by hash). This lets you build layered
scenes and spatial compositions on-chain, generically — the compositor resolves each socket's child at render time.

```ts
// a composition with named sockets, each filled by a referenced component hash
compose.ref(childComponentHash); // a child plugged into a socket
```

## Spatial composition

With spatial 3D placement, sockets can situate children *in 3D space* — components positioned in a scene, not just
stacked in a document. The compositor assembles the spatial layout on-chain.

## Capability aggregation

A composition's capability envelope is the **union** of its children's — you can't escape a child's declared
capabilities by composing it, and the composition is graded as a whole. This is what keeps composed apps honest.

## Forking

Any composition can be forked, recording its parent on-chain (App DNA) — so compositions are traceable, reusable
building blocks. See **[Composition & Mini-Apps](../concepts/composition.md)**.

## Related
- **[Composition & Mini-Apps](../concepts/composition.md)** · **[Advanced Scenes, 3D & Effects](../concepts/advanced-scenes.md)**
