PlaybookArchitecture

Forge architecture

How Forge’s five areas fit together, and how this monorepo is laid out.

Forge architecture

Forge is Ziteox’s internal toolkit for building Ziteox sites and apps. Ziteox’s team and AI agents use it. Clients never get access. Admin and client portals touch Forge only for oversight — they do not build through it.

Open question: Laki said “four (main) layers” but named five areas. This page treats five as current until that is confirmed.

The five areas

AreaWhat it isWhat exists todayWhere it lives
PlaybookHow Ziteox builds: docs, guidelines, architectureThis docs treedocs/playbook · docs/playbook/
LibraryComponents, materials, blocks, and effects@ziteox/ui (published; projects consume this); @ziteox/effects (Forge docs / workspace only for now)docs/library, components, materials, effects · packages/ui, packages/effects
TemplatesStarter projects with the right structure, config and wiring from day oneAvailable (next-site)docs/templates · docs/templates/
SystemsShared, swappable building systems (Auth, Payments, Email, File storage)Designs; code lives in the portal repo todaydocs/systems · docs/systems/
CoreMachinery, not content: connector, registry, secrets vault, loggingDesign stagedocs/core, connector-registry · docs/core/

How projects relate to the areas

Diagrams are shown as Mermaid source; the plain list below each one says the same thing.

flowchart LR
  P[Projects]
  C[Library]
  T[Templates]
  S[Systems]
  K[Core]
  P -->|consume| C
  P -->|start from| T
  P -->|plug into| S
  P -->|connect through| K

Plain list of the same relationships:

  • Projects consume @ziteox/ui. @ziteox/effects is used inside Forge (the docs site) only for now.
  • Projects start from Templates (when templates exist).
  • Projects plug into Systems (Auth, Payments, Email, File storage).
  • Projects connect through Core (connector, registry, secrets, logging).

Repository and packages

This section describes how the Forge monorepo is structured today. Most of it is the Library packages and the docs site.

Monorepo layout

ziteox-forge/
├── packages/
│   ├── ui/                 # @ziteox/ui — shared React components
│   └── effects/            # @ziteox/effects — internal visual effects
├── apps/
│   └── docs/               # Docs site (Next.js + fumadocs)
├── examples/
│   └── playground/         # Vite demo app for local development
├── docs/                   # Human + agent documentation (this tree)
│   ├── playbook/
│   ├── components/
│   ├── ui/
│   ├── effects/
│   ├── templates/
│   ├── systems/
│   └── core/
├── agents/                 # Reserved
├── prompts/                # Reserved
└── standards/              # Reserved

Tooling:

ToolRole
pnpm workspacesPackage linking (packages/*, examples/*, apps/*)
TurborepoCached builds across packages
TypeScript (tsc)Compile @ziteox/ui and @ziteox/effects to dist/
Next.js + fumadocsDocs site in apps/docs (defineDocs points at docs/)

Root scripts:

pnpm install    # Install all workspace dependencies
pnpm build      # Build all packages (turbo)
pnpm dev        # Docs site (turbo --filter=docs)
pnpm clean      # Remove build artifacts

@ziteox/ui package structure

packages/ui/src/
├── index.ts                  # Root public API — re-exports domains only
├── animations/               # Internal motion presets
├── shared/                   # Internal hooks and utilities
│   └── hooks/
├── theme/                    # Theme domain
├── materials/                # Surface materials registry (frosted, ink, emboss)
├── navigation/               # Navigation domain
│   └── toggles/              # HamburgerButton + SiteMenuToggle preset
└── branding/                 # Branding domain

Export model

Consumers import from:

Import pathContents
@ziteox/uiAll public symbols
@ziteox/ui/themeTheme domain
@ziteox/ui/materialsSurface materials
@ziteox/ui/navigationNavigation domain
@ziteox/ui/brandingBranding domain

Each domain has index.ts as its barrel. The root index.ts re-exports domain barrels only — never deep files.

package.json exports field maps subpaths to compiled dist/ outputs.

Internal modules

PathPurposePublic?
shared/hooks/use-mounted.tsHydration guard for client componentsNo
shared/hooks/use-skip-initial-animation.tsSuppress first-paint motion/transitionNo
shared/hooks/use-prefers-reduced-motion.tsprefers-reduced-motion media queryNo
animations/springs.tsShared motion spring presetsNo

Internal modules may change without semver notice. Do not import them from consuming apps.

@ziteox/effects package structure (internal)

packages/effects/src/
├── particle-morph/           # ParticleMorph + its particle engine (three.js, lazy)
├── interactive-dot-text/     # InteractiveDotText (canvas + SVG)
├── fluid-orb/                # FluidOrb (plain WebGL)
└── shared/                   # Internal helpers (reduced motion, CSS variables)
  • Named by what they are. Effects are generic and carry no site copy or layout; site looks live in the docs as example presets.
  • No root entry. Only subpaths are exported (@ziteox/effects/particle-morph, etc.), so heavy pieces never end up in a bundle that didn't ask for them.
  • Private. "private": true in package.json keeps it off the registry until it is ready for a public layer.
  • Peers. react and react-dom; three and @react-three/fiber are optional peers, needed only for particle-morph.
  • Styling. Inline styles and CSS variables only (no Tailwind), same rule as @ziteox/ui.
  • Build. tsc to dist/, like @ziteox/ui.
  • The name "sections" is kept free for future prebuilt page blocks.

Domain-first organization

Components are grouped by product concern (theme, navigation, branding), not by file type.

Rationale:

  • Keeps related code colocated as domains grow
  • Limits cross-domain coupling
  • Makes subpath exports (@ziteox/ui/navigation) meaningful
  • Scales to dozens of components without a flat components/ dump

See domain-boundaries for ownership rules.

Framework-agnostic design

@ziteox/ui targets React 18+ and avoids framework-specific imports in component source.

PatternImplementation
Routing linksPlain <a> (not next/link)
IconsInline SVG (no lucide-react in package)
StylingScoped ziteox-* CSS injected per component (no Tailwind in package)
Theme persistencenext-themes as peer dependency; wrapper in ThemeProvider

Apps using Next.js, Vite, or other React frameworks consume the same package. Next.js App Router consumers import client components ("use client") from client boundaries where required.

Controlled components

Interactive components use controlled state at the public API boundary:

<HamburgerButton isOpen={isOpen} onOpenChange={setIsOpen} />

Rationale:

  • Parent owns state (local state, context, or URL)
  • No hidden global providers required for basic usage
  • Easier to test and compose
  • Menu/nav context can be added at app level when needed

ThemeToggle is an exception at the convenience layer: it reads next-themes internally but still delegates rendering to controlled AnimatedThemeToggler.

Animation strategy

Two tiers — see animation-guidelines:

  1. CSS transitions — simple morphs (e.g. HamburgerButton)
  2. motion (motion/react) — complex SVG/path animation (e.g. AnimatedThemeToggler)

Do not add framer-motion as a separate dependency. Forge standardizes on motion.

Build output

  • Input: packages/ui/src/**/*.tsx|ts
  • Output: packages/ui/dist/ (ESM + .d.ts)
  • Module format: ESM ("type": "module")
  • JSX: react-jsx runtime

The playground resolves @ziteox/ui to source via Vite alias during local dev. Production consumers use compiled dist/.

Dependency model

Runtime libraries are peer dependencies on @ziteox/ui:

  • react, react-dom
  • next-themes (theme domain)
  • motion (animated components)

Apps install peers once. The package does not bundle them.

Adding a new component (checklist)

  1. Choose domain — see domain-boundaries
  2. Add component file under packages/ui/src/<domain>/
  3. Export from domain index.ts
  4. Re-export from packages/ui/src/index.ts
  5. Add subpath to package.json exports if new domain
  6. Add docs/ui/<component>.mdx and list it in docs/meta.json
  7. Add playground example if useful
  8. Run pnpm build