Full-stack milestone architecture
What you need to know
A full-stack milestone combines the pieces you have learned into one coherent application. River Books Editorial has public articles and a private draft editor. The key design decision is to keep the access policy and write rules in one server-owned boundary.
By the end, you can: define route, DAL and action contracts; choose persistence boundary.
Trace the two request paths
Public browser -> public page -> published article projectionEditor browser -> draft page -> verified principal -> DAL -> draft DTOEditor form -> Server Action -> verified principal -> DAL -> revision-checked writeApproved API client -> Route Handler -> verified principal -> DAL -> private JSONExpected behavior: All protected paths reach the same access boundary; the public path never returns drafts.
How it works
Use the V8 fixture as a local design exercise. The public home page lists published articles; /drafts/[id] is an editor page; /api/drafts/[id] is a private JSON read interface. A form submits a title and expected revision to a Server Action. The DAL owns authorization, validation and the revision update. Pages and handlers call the DAL directly rather than fetching their own HTTP route from the server. In a real deployment the repository should use a relational database with scoped queries and migrations. Here the local Node SQLite fixture is an independent executable model; the staged Next.js UI uses mutable in-memory synthetic preview records, not a durable shared database. The lab identity is fixed server-side, explicitly not a login provider. A fixed editor identity would grant every caller the same privileges if deployed. Keep the fixture local and replace the preview identity with verified sessions that fail closed before any integration or deployment. Do not deploy the preview. Keep the public view and private response paths distinct, and do not cache draft content across requests. This architecture is sufficient for a small editorial team; adding services or a queue would not improve the stated task.
Define a typed save outcome
type SaveResult = | {kind:'saved'; revision:number} | {kind:'invalid'; message:string} | {kind:'conflict'} | {kind:'not-found'} | {kind:'forbidden'} | {kind:'unauthenticated'};function feedback(result:SaveResult) { switch(result.kind){ case 'saved': return `Saved revision ${result.revision}`; case 'invalid': return result.message; case 'conflict': return 'Reload the latest draft before retrying.'; default: return 'Draft unavailable for this operation.'; }}console.log(feedback({kind:'saved',revision:2}));Expected behavior: Saved revision 2. A conflict has a different recovery path from invalid input or denied access.
Common mistake
Do not put one copy of the access policy in the page and a different copy in the action. That creates drift. Do not interpret an in-memory demo write as durable persistence across process restarts or replicas.
Practice and verification
Draw the route tree, mark which modules are server-only and write the response contract for a missing draft. Choose a durable database for a later integrated run and describe how the adapter must preserve the DAL contract. Use the supplied staged starter and reference fixture.
Scope: App Router, proposed Next.js 16.x and React 19, Cache Components disabled. Framework snippets are staged, not executed; local policy, SQLite and HTTP transport evidence is separate. Exact patched dependencies and platform contracts are pending.
Further reading: Auth · Bff · Actions · Security Data