Phase 00 · Lesson 06

Exercises and Phase Exit

≈ 4 min core reading · 908 source/companion words
Learning contract

What you should be able to do after this

  • Explain Exercises and Phase Exit without relying on framework buzzwords.
  • Connect the lesson to the phase outcome: Explain the complete TaskFlow request path and identify which layer owns presentation, transport, business rules, persistence, identity, and operations.
  • Reproduce the relevant behavior and verify it with evidence.
  • Diagnose at least one representative failure instead of guessing.
Figure 0.6 — TaskFlow boundary map
Browser interaction
Next.js presentation boundary
HTTP request
NestJS controller/guard
Service/business rules
Prisma persistence
PostgreSQL
HTTP response
UI update
This lesson belongs to Phase 00. Keep the full request/data path visible even when today's code changes only one box.
Instructor workflow: predict first → implement the smallest slice → run it → inspect evidence → break one assumption → diagnose → explain it back. Do not copy the whole code block before understanding the first failing boundary.

Phase 00

Exercises, Knowledge Checks & Phase Exit Turn the diagrams into working mental models before Phase 01 introduces tools and commands.

Book 6 · Active learning and assessment Course baseline: September 17, 2026 · Windows-first · Project-driven · Production-oriented

Contents 1. How to practice 6. Design scenarios

2. Warm-up questions 7. Version policy exercises

3. Architecture classification 8. Capstone Phase 00 challenge

4. Request-tracing exercises 9. Answer guide

5. Debugging scenarios 10. Exit checklist

Phase 00 | Page 2 of 7

Phase 00 is complete only when you can reason without the diagram This book converts passive reading into active recall. Do the exercises before reading the answer guide. The goal is not perfect wording; the goal is correct ownership and causal reasoning.

Warm-up questions

1. What problem does a backend API solve that a purely browser-based application cannot safely solve? 2. Why is Prisma not the database? 3. Why does a valid JWT not automatically mean a user may edit every task? 4. What is the value of keeping Next.js and NestJS independent even inside one repository? 5. Why might Node 24 LTS be a better course runtime than Node 26 Current? 6. Why are major-version upgrades treated as separate projects?

Architecture classification

For each responsibility, write the primary owning layer: browser/Next.js, NestJS, Prisma, PostgreSQL, Supabase Auth, TanStack Query, or CI/CD.

Responsibility Your answer

Show a validation error beside a form field __________________________________

Decide whether a workspace member can delete a project __________________________________

Translate a service result into HTTP 201 __________________________________

Persist a new Task row __________________________________

Generate a typed database query API __________________________________

Establish the signed-in user identity __________________________________

Cache a GET /tasks result in the frontend __________________________________

Run tests before deployment __________________________________

Enforce a unique database constraint __________________________________

Phase 00 | Page 3 of 7

Trace the request

Scenario A - Create task A signed-in user enters “Prepare Q4 report” and clicks Create. Write the request journey from click to persisted row and back to visible UI. Name at least seven boundaries or responsibilities.

Your trace:

Scenario B - Unauthorized edit User A guesses the ID of User B’s task and sends a PATCH request manually. Where must the system reject the request? Why is hiding the button in the UI insufficient?

Your reasoning:

Debugging scenarios

Symptom First three things you would inspect

Browser says CORS blocked

POST /tasks returns 404

POST returns 400 with a title error

PATCH returns 403

Phase 00 | Page 4 of 7

API returns 500 after a database write

Request succeeds but UI still shows old tasks

Design scenarios

1. Add task priority. List every layer that may need to change. Do not write code. 2. Add workspace roles. Explain why the role should not be trusted from a browser form field. 3. Add a dashboard count. Decide whether the count is persistent truth, server state, or local UI state. 4. Add realtime comments. Explain why you would first build ordinary HTTP comments before adding realtime delivery.

Version policy exercises

Imagine Prisma 8 becomes stable halfway through Phase 20. Choose the best response and explain why:

1. Upgrade immediately because newer is always better. 2. Ignore all future security updates forever. 3. Keep the course on its locked Prisma version, record Prisma 8 as an ecosystem note, and plan a separate migration exercise after a stable milestone. 4. Mix Prisma 8 CLI commands into the existing Prisma 7 project.

Phase 00 | Page 5 of 7

Capstone Phase 00 challenge

On blank paper or a whiteboard, design the request path for: “An authenticated workspace member marks a task complete.”

Your diagram must show:

□ Browser interaction. □ Next.js / React. □ Server-state layer. □ HTTP method and resource. □ Access token. □ NestJS route/controller. □ Token validation. □ Authorization/ownership or membership decision. □ Service rule. □ Prisma update. □ PostgreSQL. □ Response. □ Frontend cache/UI update. □ At least two possible failure points.

Answer guide

Architecture classification

Responsibility Primary owner

Show field error Next.js / form layer

Can member delete project? NestJS authorization/business layer

HTTP 201 NestJS controller/HTTP layer

Persist Task PostgreSQL via Prisma

Typed DB query API Prisma

Signed-in identity Supabase Auth; backend verifies token

Cache GET /tasks TanStack Query

Pre-deploy checks CI/CD

Phase 00 | Page 6 of 7

Unique constraint PostgreSQL schema

Unauthorized edit The browser is not a trusted security boundary. The backend must verify the token, establish the caller identity, and check workspace membership/ownership/permissions before the update service performs the mutation. A hidden button improves UX but does not prevent a crafted HTTP request.

Prisma upgrade policy Choice C. The course baseline remains reproducible; the upgrade is treated as an explicit migration with changelog review, compatibility testing and a rollback plan.

Phase 00 exit checklist

□ I can explain Browser → Next.js → NestJS → Prisma → PostgreSQL. □ I can distinguish authentication from authorization. □ I understand why Supabase Auth and Supabase PostgreSQL solve different responsibilities. □ I understand why TanStack Query is not the database. □ I can explain why the course uses a version manifest. □ I know why Prisma 7.9.1 is a hard lock. □ I can describe TaskFlow’s growth from Todo to collaborative application. □ I can identify the most likely layer from an HTTP status or browser symptom. □ I completed the capstone diagram without copying the atlas.

NEXT PHASE

Phase 01 moves from architecture to the development environment. We will verify Windows, PowerShell, Node 24 LTS, pnpm, Git, editor/tooling, PATH behavior and a reproducible project workspace - with explicit checkpoints before any application scaffolding.

Phase 00 | Page 7 of 7

Executable lesson studio · architecture

Now turn the explanation into engineering skill.

Exercises and Phase Exit matters because it changes a real boundary in TaskFlow. The goal is to understand the inputs, owner, observable output, and failure modes before adding more abstraction.

By the end, you should be able to

  • Explain Exercises and Phase Exit in terms of concrete inputs, ownership, outputs, and evidence.
  • Implement or reproduce the smallest TaskFlow slice that demonstrates this architecture concept.
  • Diagnose one representative architecture failure using observable evidence instead of trial-and-error.
Figure 0.6B — Mental model
User intent
UI boundary
API contract
business rule
persistence
observable result
Read left-to-right while implementing. When debugging, walk right-to-left until the first observed fact differs from your prediction.
Code-along sequence

One coherent change at a time

  1. 01

    Restate the goal of “Exercises and Phase Exit” as one observable behavior. Write the success signal before touching code.

  2. 02

    Trace the boundary map: User intent → UI boundary → API contract → business rule → persistence → observable result. Mark the one boundary this lesson changes.

  3. 03

    Inspect the current repository state and record the exact files, route, table, or runtime involved. Avoid creating an abstraction before you can name the existing owner.

  4. 04

    Implement the smallest vertical slice. Add one coherent change, run the narrowest verification command, and read the output before continuing.

  5. 05

    Connect the slice to TaskFlow’s phase artifact: A one-page architecture map plus an ADR-style note describing the responsibilities of Next.js, NestJS, Prisma, PostgreSQL/Supabase, and supporting infrastructure.. Verify behavior from the outside as a user or API client would.

  6. 06

    Create one controlled failure that is safe to reproduce. Predict the symptom first, capture evidence, locate the earliest broken boundary, then fix only that cause.

  7. 07

    Close the reference and rebuild or explain the core change from memory. Record what you would monitor or test before trusting the same change in production.

txtBoundary trace
Input -> owner -> transformation -> observable output -> failure evidence

Do not copy this as a finished answer. Predict what each boundary does, type the smallest useful slice, run it, then compare the result with your prediction.

Verification

Prove the happy path

  1. Run the narrowest relevant command or request and require a clean exit/status.
  2. Inspect the boundary-specific evidence: terminal output, Network panel, database row/query plan, test report, container health, or deployment logs.
  3. Repeat the behavior once after the change so a one-off cached or stale result cannot masquerade as success.
Break it on purpose

Build debugging memory

  1. Letting controllers call the database directly everywhere
  2. Change one assumption in the architecture example—identity, input, configuration, ordering, connectivity, or state—and predict the exact symptom before running it.
SymptomInvestigation path
Expected result does not appear

Return to the nearest observable boundary: input, network, process log, database, or rendered UI. Compare actual evidence with the predicted path.

A shortcut appears to fix it

Change one variable at a time and reproduce the original failure after the fix; otherwise you have correlation, not diagnosis.

Closed-reference challenge

Can you transfer the idea?

Without copying the final source, create a second small scenario that applies “Exercises and Phase Exit” to a different TaskFlow resource or input. Write the acceptance criteria first, implement it, and provide the evidence that each criterion is satisfied.

Explain-back

Answer these without reopening the solution

  1. What problem does Exercises and Phase Exit solve in TaskFlow, and what would be observably wrong without it?
  2. Which part of the architecture boundary owns the decision, and which neighboring layer must not own it?
  3. What evidence proves the happy path instead of merely suggesting it worked?
  4. Name one realistic failure or abuse case and the first place you would inspect.
  5. If requirements doubled tomorrow, which part of this design should stay stable and which part is allowed to change?
Lesson studio

Turn the reading into skill

01

Do it

Record the architecture decisions that should remain stable through later phases.

Use the smallest change that demonstrates this lesson. Stop after it works and capture evidence.
02

Break it safely

Letting controllers call the database directly everywhere

Predict the symptom before causing the failure. Then locate the earliest boundary where reality diverges from expectation.
03

Explain it back

Why does this responsibility live here, what input does it trust, what output proves success, and what would go wrong if another layer owned it?

If your explanation is vague, repeat the boundary trace before moving on.
Exit ticket

Before marking complete

Close the reference. Reproduce the core idea from memory or explain the exact request/data flow aloud. Then check your diff or notes for accidental shortcuts that bypass validation, authorization, error handling, or verification earned in earlier phases.