Status: active for the V48 website application layer.
Authoritative layout contract: .docs/BITCODE_SOURCE_LAYOUT.md.
Product UI law: BITCODE_SPEC_V48.md § Frontend component and naming architecture.
apps/uapi/ is the Next.js interface owner: thin App Router pages, HTTP adapters,
and React layers. Domain logic that is not React/Next-specific belongs in
packages/ (@bitcode/api, @bitcode/btd, @bitcode/auth, pipelines, …).
apps/uapi/
├── app/ # Thin page shells + api/ adapters
│ ├── page.tsx / (root)/ # Marketing
│ ├── packs|deposits|reads|docs|conversations|auxillaries/
│ └── api/ # Prefer @bitcode/api handlers
├── components/
│ ├── shadcn/ # Shadcn* primitives
│ ├── bitcode/ # Bitcode* base (pipeline, layout, auth, …)
│ └── {marketing,packs,reads,deposits,docs,conversations,auxillaries}/
│ ├── models|hooks|constants|types/
│ └── <ComponentName>/ # named entry + hooks/styles/__tests__
├── hooks/ # Cross-experience hooks only
├── lib/ # Next glue; re-export packages when possible
├── middleware/
├── networking/
├── types/
├── tests/ # Route/page contracts (unit co-located under components)
└── .storybook/stories/
Product surfaces live under Packs, Deposits, Reads, and Docs.
Shadcn* → Bitcode* → Experience*
- Experiences never import each other.
- Page clients compose components; components do not import page clients.
- New components:
ComponentName/ComponentName.tsx(notindex.tsx).
| Domain | Prefer | Avoid |
|---|---|---|
| Product runs | Pipeline / BitcodePipeline* |
product, product “Executions” UI |
| BTD ledger | journal | coupling journal names to product |
| Agent packages | execution-generics (low-level) |
conflating with product Pipeline |
| Location | Owns |
|---|---|
packages/* |
Shareable domain, pure models, route orchestration, BTD, pipelines |
apps/uapi/ |
Next routes, React, Storybook, thin adapters |
Examples of package homes:
@bitcode/api/pipelines/cancel·orphan-sweep@bitcode/observability/product-analytics@bitcode/authwallet + auth redirect helpers
Order-based: telemetry → security headers → CORS → rate limit → authentication → route rewrite.
- SRP / DRY / explicit TypeScript
- Top-of-file overview on non-trivial modules
- Co-located unit tests under component
__tests__/when practical - Source-safety, auth, ownership checks never weakened for convenience