Fullstack CourseLearn by building
Back to week 4

Topic

Notes API — Ship slice milestone

Definition

Milestone P4 proves a shippable Notes slice: Docker Compose for Postgres, list indexes via migration, attachment metadata upload, and a swappable NotesEventsPublisher with an in-memory adapter.

In simpler words

Understand how to ship Notes with Compose, indexes, attachments, and an event seam.

Replaces the old all-in-one hands-on topic. Capstone coding concepts, not a long deployment essay.

After this you can

  • Provide docker-compose.yml with Postgres
  • Add index migration for list filters/sorts
  • Upload attachment metadata + disk blob; publish note.created

What this stage covers

Definition

This stage is a Notes API build slice: read the official Nest chapter, understand the matching Nest concepts, then take the quiz to lock it in.

In simpler words

Score ≥80% on the quiz below to save roadmap progress — exactly like every other topic.

Official docs: Nest file upload + testing + deployment chapters — https://docs.nestjs.com/techniques/file-upload

Key Nest pieces to understand: a Docker Compose file, an events publisher seam, and an attachments upload route

Supplemental Nest/SQL links live under /resources.

Optional practice: rebuild the same slice for Notes in your own workspace to cement the pattern.

What a correct build includes

- [ ] docker-compose.yml with postgres
- [ ] Index migration for list filters
- [ ] Attachment metadata + FileInterceptor
- [ ] Publisher interface + in-memory adapter on create

Use this as the acceptance checklist while you study the concepts and answer the quiz.

Deliverables

Definition

Deliverables are the concrete Nest files and behaviors a correct version of this stage produces.

In simpler words

Aim for the smallest vertical slice that satisfies these — not a sprawling redesign.

Compose Postgres; index migration; attachment upload endpoint

NotesEventsPublisher interface + InMemoryNotesEventsPublisher fired on create

README / lesson awareness of RabbitMQ swap + idempotency (judgment note)

Keep in mind

  • Judgment without Compose/indexes/code is incomplete.
  • You do not need a real Redis/Rabbit cluster for P4 — you need the seams.

Test

Check your understanding

At least 10 questions — mix of concept, syntax, practical, and logic. Score ≥80% (enforced by the API) to save progress.

Checking your session…

15 questions · concept 5 · syntax 3 · practical 4 · logic 3

1. What does Notes P4 ship?
Concept
2. How do you prove P4?
Syntax
3. Why an in-memory publisher adapter?
Practical
4. What should attachments store in Postgres?
Logic
5. Why an index migration in P4?
Concept
6. Is PLATFORM.md alone enough?
Practical
7. Must Redis be live to pass P4?
Syntax
8. When should create publish an event?
Logic
9. Why Compose in P4?
Concept
10. Which P4 shortcut is wrong?
Practical
11. Why inject a NotesEventsPublisher interface?
Conceptadvanced
constructor(private readonly events: NotesEventsPublisher) {}
// after creating a note:
this.events.publish('note.created', note);
12. What should P4 store for attachments in Postgres?
Syntaxintermediate
await repo.save({ noteId, key: storageKey, mime, size });
13. Why add this index in P4?
Practicaladvanced
await q.query('CREATE INDEX idx_notes_author ON notes(author_id)');
14. What does adding Postgres to Compose give P4?
Logicintermediate
services:
  postgres:
    image: postgres:16
    volumes:
      - ./data/postgres:/var/lib/postgresql/data
15. What belongs at the comment for P4 event publishing?
Conceptadvanced
const note = await this.repo.save(dto);
// ?
return note;

Checking your session…