Phase 09 · Lesson 14

Mastery Capstone Lab

≈ 2 min core reading · 202 source/companion words
Learning contract

What you should be able to do after this

  • Explain Mastery Capstone Lab without relying on framework buzzwords.
  • Connect the lesson to the phase outcome: Integrate Prisma 7.9.1 as a repeatable persistence layer with schema, generated client, adapter/configuration, migrations, and NestJS lifecycle.
  • Reproduce the relevant behavior and verify it with evidence.
  • Diagnose at least one representative failure instead of guessing.
Figure 9.14 — TaskFlow boundary map
schema.prisma
migration files
database schema
generated Prisma Client
PrismaService
feature service
This lesson belongs to Phase 09. 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.

Mastery Capstone Lab

This is the transfer exercise for Phase 09: Prisma 7.9.1 Architecture, Configuration & Migrations. The detailed lessons are now closed-book reference material. Your task is to prove that the phase outcome can be reproduced from requirements, repository evidence, and debugging—not by copying a finished implementation.

Target artifact Prisma schema + migration history + generated client + NestJS PrismaService connected to TaskFlow PostgreSQL.

Acceptance criteria - Write the behavior and constraints before implementation. - Identify the owning layer and every boundary crossed. - Implement the smallest complete vertical slice. - Verify the happy path from outside the implementation. - Demonstrate at least one expected failure path. - Run the phase-relevant quality checks. - Review the diff for accidental duplication, leaked responsibilities, missing validation/authorization, and hidden environment assumptions.

Evidence packet Save the command/request used, expected result, actual result, one failure reproduction, the fix, and a short explanation of why the final responsibility belongs where it does. This packet is more valuable than a screenshot of a green page because it demonstrates repeatable engineering reasoning.

Stretch Change one requirement after the first implementation. Measure which files must change. If a tiny domain change causes unrelated layers to move, use that evidence to discuss coupling before adding another abstraction.

Executable lesson studio · prisma

Now turn the explanation into engineering skill.

A guided lesson proves you can follow. A capstone proves you can transfer the model to a requirement with fewer cues.

By the end, you should be able to

  • Integrate Prisma 7.9.1 as a repeatable persistence layer with schema, generated client, adapter/configuration, migrations, and NestJS lifecycle.
  • Produce a reproducible evidence packet for success and failure.
  • Defend the architecture and identify one improvement without overengineering.
Figure 9.14B — Mental model
schema.prisma
migration files
database schema
generated Prisma Client
PrismaService
feature service
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

    Pin Prisma packages to the course version contract and verify all Prisma package versions match.

  2. 02

    Initialize Prisma with the intended generated-client output and PostgreSQL configuration.

  3. 03

    Model one entity, create the first migration, and inspect the SQL before applying it.

  4. 04

    Generate the client and wire a PrismaService into NestJS with controlled lifecycle.

  5. 05

    Perform a smoke query through the service, then inspect the created database object independently.

  6. 06

    Cause a safe migration/configuration failure and practice reading Prisma error codes instead of reinstalling randomly.

  7. 07

    Run the phase mastery checklist without looking at the provided implementation.

  8. 08

    Perform a short architecture review and document one trade-off you consciously accepted.

txtCapstone evidence packet
Requirement -> implementation diff -> verification -> controlled failure -> diagnosis -> final proof

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. Can explain schema vs migration vs generated client
  2. Can create and inspect a migration
  3. Can wire Prisma to NestJS cleanly
  4. Can diagnose common connection/migration failures
Break it on purpose

Build debugging memory

  1. CLI/client version mismatch
  2. Editing generated client code
SymptomInvestigation path
You can only continue by copying the reference

Return to the mental model and acceptance criteria. Rebuild one smaller slice from first principles before reopening the source.

Everything seems to work but proof is weak

Choose an external observer: HTTP client, browser, database query, test runner, health endpoint, or deployment log, and capture deterministic evidence.

Closed-reference challenge

Can you transfer the idea?

Extend the phase artifact with one requirement not used in the guided example while preserving the same ownership rules and verification strategy.

Explain-back

Answer these without reopening the solution

  1. What did you build without a transcript?
  2. Which boundary caused the most reasoning effort?
  3. Which failure gave the strongest evidence?
  4. What shortcut did you deliberately avoid?
  5. What would you automate before repeating this in a team?
Lesson studio

Turn the reading into skill

01

Do it

Initialize Prisma with the intended generated-client output and PostgreSQL configuration.

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

Break it safely

Editing generated client code

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.