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
| Area | What it is | What exists today | Where it lives |
|---|---|---|---|
| Playbook | How Ziteox builds: docs, guidelines, architecture | This docs tree | docs/playbook · docs/playbook/ |
| Library | Components, 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 |
| Templates | Starter projects with the right structure, config and wiring from day one | Available (next-site) | docs/templates · docs/templates/ |
| Systems | Shared, swappable building systems (Auth, Payments, Email, File storage) | Designs; code lives in the portal repo today | docs/systems · docs/systems/ |
| Core | Machinery, not content: connector, registry, secrets vault, logging | Design stage | docs/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| KPlain list of the same relationships:
- Projects consume
@ziteox/ui.@ziteox/effectsis 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/ # ReservedTooling:
| Tool | Role |
|---|---|
| pnpm workspaces | Package linking (packages/*, examples/*, apps/*) |
| Turborepo | Cached builds across packages |
TypeScript (tsc) | Compile @ziteox/ui and @ziteox/effects to dist/ |
| Next.js + fumadocs | Docs 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 domainExport model
Consumers import from:
| Import path | Contents |
|---|---|
@ziteox/ui | All public symbols |
@ziteox/ui/theme | Theme domain |
@ziteox/ui/materials | Surface materials |
@ziteox/ui/navigation | Navigation domain |
@ziteox/ui/branding | Branding 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
| Path | Purpose | Public? |
|---|---|---|
shared/hooks/use-mounted.ts | Hydration guard for client components | No |
shared/hooks/use-skip-initial-animation.ts | Suppress first-paint motion/transition | No |
shared/hooks/use-prefers-reduced-motion.ts | prefers-reduced-motion media query | No |
animations/springs.ts | Shared motion spring presets | No |
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": trueinpackage.jsonkeeps it off the registry until it is ready for a public layer. - Peers.
reactandreact-dom;threeand@react-three/fiberare optional peers, needed only forparticle-morph. - Styling. Inline styles and CSS variables only (no Tailwind), same rule as
@ziteox/ui. - Build.
tsctodist/, 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.
| Pattern | Implementation |
|---|---|
| Routing links | Plain <a> (not next/link) |
| Icons | Inline SVG (no lucide-react in package) |
| Styling | Scoped ziteox-* CSS injected per component (no Tailwind in package) |
| Theme persistence | next-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:
- CSS transitions — simple morphs (e.g.
HamburgerButton) 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-jsxruntime
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-domnext-themes(theme domain)motion(animated components)
Apps install peers once. The package does not bundle them.
Adding a new component (checklist)
- Choose domain — see domain-boundaries
- Add component file under
packages/ui/src/<domain>/ - Export from domain
index.ts - Re-export from
packages/ui/src/index.ts - Add subpath to
package.jsonexportsif new domain - Add
docs/ui/<component>.mdxand list it indocs/meta.json - Add playground example if useful
- Run
pnpm build