Lesson 19 · Senior v2 architecture
Mock senior v2 architecture interview pack
A retrieval-first practice pack for turning the whole v2 architecture course into answers you can say clearly under pressure.
Your win: run a realistic senior v2 architecture mock interview on yourself, score the answers honestly, and turn weak spots into a precise revision plan.
The format
This page works best if you treat it like a real interview. Answer first. Then check the points. Then answer again more cleanly.
- Round 1 · Core architecture vocabulary — 6 questions
- Round 2 · Trade-offs, smells, and design review — 6 questions
- Round 3 · Repo-grounded architecture reasoning — 6 questions
- Time target — 60–90 seconds per answer
Round 1 · Core architecture vocabulary
These questions test whether the foundation really belongs to you rather than only sounding familiar.
- What is the real purpose of ports and adapters?
- What is a composition root?
- What makes a dependency-inversion leak load-bearing rather than cosmetic?
- What does CQRS mean in this repo?
- Why is `database.Ext` important?
- What does sqlc actually buy the architecture?
- Ports and adapters. The core owns interfaces for what it needs, while concrete DB/transport code implements them from the outside so the dependency direction stays healthy.
- Composition root. It is the edge where concrete repos, handlers, and transports are assembled; the core should not own that construction.
- Load-bearing leak. It changes who depends on whom — especially when the core imports or constructs concrete infrastructure.
- CQRS here. Lightweight separation of command and query handlers; no bus, no event sourcing, direct invocation from controllers.
- `database.Ext`. It lets one repo method accept either a pool or a transaction handle, which makes transactional composition practical.
- sqlc. It keeps SQL explicit while generating type-safe Go, a querier interface, mocks, and repo-friendly query seams in eureka.
Round 2 · Trade-offs, smells, and design review
This is where the mock starts feeling more senior. Naming the pattern is not enough; the judgment matters more.
- Why is the conversationmgmt leak a better teaching example than a random messy file?
- Why is Fowler’s CQRS caveat still important here?
- Why is sqlc not automatically the right answer for every service?
- When does a transport-agnostic handler become a real design win?
- What makes a module worth copying versus merely worth studying?
- What is the danger of treating architecture purely as folder naming?
- conversationmgmt leak. It is concrete, local, and changes the dependency direction, so it teaches the actual architectural failure mode instead of a vague cleanliness complaint.
- Fowler caveat. CQRS adds risky complexity; this repo intentionally keeps the lightweight form because the extra machinery often is not worth it.
- sqlc trade-off. Query-heavy services benefit more from generated safety; simpler CRUD services may not earn back the codegen and operational complexity.
- Transport-agnostic win. It is valuable when the business logic stays central and wrappers remain thin, so behavior does not drift by protocol.
- Worth copying. A module worth copying has healthy seams, clearer wiring, and better boundary discipline — not just cleaner file names.
- Folder naming danger. It can hide a broken dependency story behind architecture-themed names.
Round 3 · Repo-grounded architecture reasoning
This round is what makes the mock specific to your actual backend work instead of generic architecture trivia.
- Which modules are the best v2 examples in this repo, and why?
- What is the eureka read/write asymmetry rule?
- Why does constructor-not-literal matter for eureka repos?
- How does the repo reuse logic across gRPC, Kafka, and NATS?
- Why do v1 and v2 coexist?
- How would you explain this architecture honestly in a senior interview?
- Best examples. `system_notification` for CQRS, spike `email` for clean module wiring, and eureka `assessment` for sqlc plus read/write asymmetry.
- Read/write asymmetry. Reads may call queriers directly where allowed, but mutating writes must go through repository interfaces so invariants and hooks are protected.
- Constructor-not-literal. Eureka repos carry a querier field that the constructor initializes; a bare struct literal leaves it nil and can panic.
- Transport reuse. Business logic lives in reusable handlers/subscribers while wrappers do protocol translation and delegation.
- v1 + v2 coexistence. It is the migration strategy: new bounded contexts grow in v2 while legacy code is maintained but not expanded.
- Senior explanation. Describe it as pragmatic hexagonal/CQRS/sqlc architecture with real strengths, deliberate trade-offs, and a few load-bearing smells you can name honestly.
Self-scoring rubric
| Score | Meaning |
|---|---|
| 0 | I could not explain it without notes. |
| 1 | I gave fragments, but the answer was incomplete or fuzzy. |
| 2 | I explained the main idea, but missed the trade-off or repo-grounded consequence. |
| 3 | I gave a strong, clear answer with model + trade-off + repo consequence. |
Q1. The main rule of this mock pack is…
Sources. This pack synthesizes the whole course into retrieval practice.