At least 10 questions — mix of concept, syntax, practical, and logic. Score ≥80% (enforced by the API) to save progress.
15 questions · concept 5 · syntax 3 · practical 4 · logic 3
1. What does Notes P4 ship? Concept
Compose for Postgres, an index migration, attachment metadata upload, and NotesEventsPublisher with in-memory adapter A PLATFORM.md write-up plus Compose but no schema or publisher changes Attachment files stored directly as Postgres bytea columns RabbitMQ wired directly inside NotesService without a publisher port
2. How do you prove P4? Syntax
pnpm course:validate-milestone be-notes-p4 after Compose, indexes, attachments, and publisher exist pnpm course:validate-milestone be-notes-p4 with a live RabbitMQ broker connected docker compose up and confirm the containers start healthy pnpm course:validate-milestone be-notes-p3 now that platform work is done
3. Why an in-memory publisher adapter? Practical
Tests/local can run without a broker while keeping a clean port It buffers events in memory and replays them once RabbitMQ connects It is faster than RabbitMQ so it should be used in production too It stores published events as rows in Postgres for durability
4. What should attachments store in Postgres? Logic
Metadata and storage key — not necessarily giant bytea blobs The full file as a base64 string in a text column A signed download URL that expires with the JWT The file bytes plus a checksum in a bytea column
5. Why an index migration in P4? Concept
Enforce that note titles are unique per author Let TypeORM skip writing migrations for new columns Cache query results in Redis for faster reads Speed filtered/sorted notes lists under load
6. Is PLATFORM.md alone enough? Practical
Yes — as long as it includes the Compose YAML as a code block Yes — if it documents the index and attachment design in detail No — need real Compose/schema/upload/publisher artifacts Yes — a diagram of the publisher port satisfies the grader
7. Must Redis be live to pass P4? Syntax
Yes — the publisher connects to Redis pub/sub on startup Yes — attachment metadata is cached in Redis before Postgres No — the milestone does not require a live Redis cluster Yes — Compose must include a healthy Redis service to pass
8. When should create publish an event? Logic
When a note is created — via the publisher interface Before saving the note, so the event fires even if the save fails Only after a scheduled job flushes the events in a batch From a database trigger rather than the service layer
9. Why Compose in P4? Concept
Compose runs the migrations automatically so you can drop the CLI Compose bundles the app into a single image for production Compose seeds the database from the entity definitions Reproduce Postgres-backed runtime shape for the practice app
10. Which P4 shortcut is wrong? Practical
Providing an in-memory adapter behind the publisher port Adding an index migration for the hot query paths Storing attachment metadata and a storage key Hard-coding RabbitMQ inside NotesService with no publisher interface
11. Why inject a NotesEventsPublisher interface? Concept advanced
constructor(private readonly events: NotesEventsPublisher) {}
// after creating a note:
this.events.publish('note.created', note);It keeps a clean port so tests use an in-memory adapter and the transport can swap It lets the service publish to RabbitMQ and Redis at the same time Interfaces make Nest register the provider automatically without a module It guarantees events are delivered exactly once across brokers
12. What should P4 store for attachments in Postgres? Syntax intermediate
await repo.save({ noteId, key: storageKey, mime, size });The file encoded as base64 text alongside its mime type A presigned upload URL instead of any stored key Metadata and a storage key, not the whole file blob The raw bytes in bytea plus a duplicate copy on disk
13. Why add this index in P4? Practical advanced
await q.query('CREATE INDEX idx_notes_author ON notes(author_id)');To speed filtered and sorted notes lists under load To enforce that each author owns at most one note To make the author_id foreign key constraint valid To let TypeORM eager-load the author without a join
14. What does adding Postgres to Compose give P4? Logic intermediate
services:
postgres:
image: postgres:16
volumes:
- ./data/postgres:/var/lib/postgresql/dataA reproducible Postgres-backed runtime for the practice app It runs migrations and seeds automatically on container start It lets the app skip the DATABASE_URL configuration It bundles Postgres into the app image for a single deploy
15. What belongs at the comment for P4 event publishing? Concept advanced
const note = await this.repo.save(dto);
// ?
return note;this.repo.save(note) a second time to confirm the write this.events.publish("note.created") before the save completes this.events.publish("note.created", note) via the publisher interface await this.cache.set(note.id, note) instead of publishing
Submit quiz Checking your session…