APP / STANDARD · V1

REFERENCE RUNTIME / NEXT.JS

One system.
Two runtimes.
Zero drift.

A framework-neutral operating model for building product slices that stay understandable, testable, and portable.

Inspect the architecture
Contracts firstRoutes stay thinServer stays serverProof before release

01 / THE SHAPE

Six layers. One direction of dependency.

Frameworks are delivery mechanisms. Product language, contracts, and behavior are the durable center.

01

Framework

Route shell

Compose modules, declare page metadata, and translate route inputs. Keep business decisions out.

adapter
02

Feature

Product module

Own the use case, its public entry point, and the smallest complete product slice.

portable
03

Boundary

Runtime contract

Validate every external input before it becomes trusted application data.

portable
04

Infrastructure

Server adapter

Keep secrets, persistence, provider SDKs, and fallbacks behind an explicit server-only seam.

adapter
05

Interface

UI system

Build primitives from tokens; build product UI from primitives; isolate browser state at the leaf.

portable
06

Delivery

Proof

Test contracts and failure paths first, then verify type safety, production output, and accessibility.

portable

02 / THE ADAPTERS

Same rule. Native expression.

Switch runtimes to see where framework syntax changes—and where the architecture must not.

01

Route composition

app/**/page.tsx

The route translates framework context and renders a feature entry point.

02

Server reads

Async Server Component

Fetch at the server boundary and return validated, serializable data.

03

External HTTP

route.ts handler

Public endpoints use Web Request/Response and authenticate at the data boundary.

04

Private code

server-only + *.server.ts

Provider SDKs and secrets must fail the build if imported by client code.

05

Document metadata

metadata / generateMetadata

Every shareable route owns an accurate title, description, and preview contract.

06

Failure UI

error.tsx / not-found.tsx

Expected failures are modeled; unexpected failures become observable and recoverable.

03 / THE REFERENCE SLICE

A place for every decision.

The tree is intentionally boring. Predictability is a feature when teams and agents share a codebase.

reference-applicationportable by default
app/ or src/routes/       # framework-owned route adapters
modules/<feature>/        # product-owned vertical slices
  <feature>.contract.ts   # runtime input/output boundary
  <feature>.server.ts     # secrets, persistence, providers
  <feature>.client.tsx    # smallest interactive island
  <feature>.tsx           # server-safe feature composition
  index.ts                # intentional public API
ui/primitives/            # token-driven, product-agnostic UI
lib/                      # truly cross-feature capabilities
tests/                    # contracts, failures, integration proof
RULE 01

Imports point inward.

Routes know modules. Modules know contracts and UI. The portable core never knows the router.

RULE 02

Files say where they run.

Use explicit .server and .client seams so runtime mistakes fail early.

RULE 03

Barrels are product APIs.

Every module exposes a small, deliberate entry point instead of making its internals globally reachable.

04 / DEFINITION OF ALIGNED

Before an app earns the standard.

This is the review lens—not a collection of optional suggestions.

  1. 01

    A new contributor can locate a feature without knowing the framework.

    REQUIRED
  2. 02

    Every network, database, environment, and user input crosses a runtime contract.

    REQUIRED
  3. 03

    Framework imports stop at route, navigation, metadata, and server-runtime adapters.

    REQUIRED
  4. 04

    Client state is local to the interaction that needs it; the page shell stays server-rendered.

    REQUIRED
  5. 05

    The application has a safe fallback for optional external services.

    REQUIRED
  6. 06

    Tests name the contract and failure behavior they protect.

    REQUIRED
  7. 07

    The same product vocabulary appears in code, UI, telemetry, and documentation.

    REQUIRED
  8. 08

    Production build evidence is required before release evidence is recorded.

    REQUIRED

THE OPERATING BELIEF

“Portable does not mean generic. It means the product owns the idea and the framework owns the translation.”
Review from the top