📁 Sangam Dhakal - Portfolio v2.0 - Netscape Navigator 4.0
_
□
×

📚 Interview question

You're asked to choose an architecture for three new .NET systems: a CRUD-heavy internal admin app, a complex insurance-policy administration domain, and a high-scale payments platform. Which architecture do you pick for each, and how do you justify and record those choices?

A staff-level architecture decision across three contrasting systems, matching layered or vertical slice, modular monolith with DDD, and selective services with event-driven integration to domain complexity, scale, team and compliance needs, recorded in ADRs.

Staff / Architect Architecture Expert adr architecture architecture-decisions domain-driven-design microservices modular-monolith

🎯 Key points

  • Start from drivers: quality attributes, domain complexity, scale, team size and structure, compliance, time to market
  • Admin app: vertical slices or simple layered, EF Core directly — trade-off: fastest delivery, but needs a revisit trigger if rules grow
  • Insurance policy domain: modular monolith aligned to bounded contexts, rich DDD aggregates, events between modules — trade-off: modelling effort and boundary discipline for long-term modifiability
  • Payments: a small number of services split by scaling and PCI DSS scope, idempotency, outbox/inbox, strong observability — trade-off: operational cost for availability and compliance isolation
  • Compliance in Australia: Privacy Act/APPs, NDB scheme, APRA CPS 234 for regulated entities, data residency in Australia East/Southeast
  • Decide with stakeholders: product, risk/compliance, security, operations and the delivery teams agree the ranked drivers before options are compared
  • Record each choice in an ADR with context, options, decision, consequences and revisit triggers; back contested points with a time-boxed spike
  • The same organisation can and should use different architectures for different systems; keep practices (CI/CD, observability, security) consistent instead

⏱ 30-second answer

I pick per system, from its drivers, not one house style:

  • Admin app (simple rules, few users): layered or vertical slices, EF Core directly, server-rendered UI. Optimise for delivery speed; no DDD ceremony.
  • Insurance policy administration (complex, long-lived rules): a modular monolith aligned to bounded contexts (Policy, Rating, Claims, Billing), rich DDD aggregates, a Clean/hexagonal core per module, events between modules. Optimise for modifiability and correctness.
  • Payments platform (high scale, strict compliance): a few services split by scaling and PCI DSS scope, idempotent APIs, outbox/inbox, strong observability. Optimise for availability, security and auditability.

Each choice goes in an ADR with options, consequences and revisit triggers. The trade-off: consistency across systems vs fit for each.

🗣 Full answer (senior)

How I would answer this in an interview

"I'd refuse to pick one architecture for all three, because their drivers are completely different. I start each with the same questions: what quality attributes matter most, how complex is the domain, what scale and growth do we expect, how many teams will work on it, and what compliance applies.

The admin app has simple rules and maybe a hundred internal users. Speed of delivery and low maintenance dominate, so I'd build a single ASP.NET Core app with vertical slices, EF Core used directly in handlers, Razor Pages or Blazor for the UI, and Entra ID for sign-in. No repositories, no DDD layers — they'd protect nothing. The insurance policy system is the opposite: rules about cover, endorsements, renewals and rating change for years and must be right. That's where DDD pays off: I'd run event storming to find bounded contexts — Policy, Rating, Underwriting, Billing — and build a modular monolith with a module per context, each with a rich aggregate model and a Clean or hexagonal core, talking through contracts and events. One deployable keeps operations simple for [two or three] teams, and the seams let us extract a module if it ever needs it. The payments platform is where distribution earns its keep: very high throughput, near-zero tolerance for double charges, and PCI DSS scope we want as small as possible. I'd split a small number of services along those lines — a card vault and tokenisation service isolated for PCI, a payment orchestration service, and ledger and reconciliation — with idempotency keys on every API, outbox and inbox for messaging, and serious tracing and SLOs. For example, at [company] I [proposed a similar split in an ADR, ran a spike that measured X], and [we disagreed on Y, I committed to the team's choice, and we revisited after Z].

The mistake I see is a house architecture applied everywhere: the admin app gets microservices, or the payments platform gets a CRUD template. I write an ADR per system with the options, the decision, the consequences and the triggers that would make us revisit it. Architecture is a fit to drivers, and different systems have different drivers."


Drivers per system

Driver Admin app Insurance policy admin Payments platform
Domain complexity Low Very high Medium (but unforgiving)
Scale ~100 users Thousands of users, batch renewals Thousands of TPS at peak
Top quality attributes Delivery speed, low cost Modifiability, correctness, auditability Availability, security, consistency, latency
Teams 1 small team 2–4 teams 3+ teams plus a platform team
Compliance Privacy Act/APPs for staff data APRA CPS 234, Privacy Act, NDB PCI DSS, APRA CPS 234, AUSTRAC obligations where applicable

Decisions

Admin app Insurance policy admin Payments platform
Style Vertical slices (or simple layered) Modular monolith, DDD, Clean core per module Small set of services, event-driven
Data One database, EF Core directly One database, schema per module Database per service; ledger append-only
Integration None or simple APIs Contracts + in-process events, outbox Service Bus/Kafka, outbox + inbox, idempotency keys
Hosting One App Service App Service or Container Apps, scaled out AKS or Container Apps, multi-zone in Australia East, DR in Southeast
Testing Integration tests with Testcontainers Heavy domain unit tests + architecture tests Contract tests, chaos and load tests, reconciliation checks

Production example

At one insurer, using three different architectures was contentious at first. Twelve months on, the admin app had shipped 40 releases with a two-person team, the policy system's modular monolith had absorbed two product launches without structural change, and the payments services held 99.99% availability across peak renewal periods while keeping PCI scope to two services instead of the whole estate.

🔍 What the interviewer is checking

Checks that the candidate can derive different architectures from different drivers, justify them with trade-offs and compliance, and lead the decision through ADRs and evolution triggers.

Green flags

  • Starts from quality attributes, domain complexity, team and compliance for each system
  • Gives three different, well-justified answers
  • Mentions PCI DSS scope, APRA CPS 234, Privacy Act and Australian data residency where relevant
  • Records decisions in ADRs with revisit triggers and fitness functions
  • Shows influence: spikes with data, disagree-and-commit

Red flags

  • One architecture for all three
  • Microservices for the admin app or CRUD for the policy domain
  • No mention of how decisions are recorded or revisited

📚 Learn in depth

1. A repeatable decision process

Business goals --> Quality attributes (ranked) --> Constraints (team, budget, compliance, deadline)
       |                                                     |
       v                                                     v
  Domain analysis (event storming, bounded contexts)   Options (2-3 candidate architectures)
       \__________________________ ____________________________/
                                  v
                    Evaluate against drivers (decision matrix, spikes)
                                  v
                     ADR: decision, consequences, revisit triggers
                                  v
                     Fitness functions in CI and production

The Architecture Tradeoff Analysis Method (ATAM) formalises this; in practice a ranked list of quality attributes plus a couple of time-boxed spikes covers most decisions.

2. The admin app

[Browser] -> [ASP.NET Core: Razor Pages / Minimal APIs, vertical slices] -> [Azure SQL]
                 Entra ID sign-in, EF Core directly

No repositories, no mediator required, no separate API tier. Risk: scope creep turning it into a domain system — the revisit trigger.

3. The insurance policy system

+-------------------------------------------------------------+
|              Policy Admin (one deployable)                  |
| +----------+  +----------+  +-------------+  +-----------+  |
| | Policy   |  | Rating   |  | Underwriting|  | Billing   |  |
| | module   |  | module   |  | module      |  | module    |  |
| +----+-----+  +----+-----+  +------+------+  +-----+-----+  |
|      |  contracts + events (outbox)  |               |       |
+------+-------------+---------------+---------------+-------+
   [policy]       [rating]      [underwriting]     [billing]   schemas

Rich aggregates (Policy with Endorse, Renew, Cancel), value objects (Premium, CoverPeriod), domain events (PolicyRenewed). Temporal tables or event history for auditability.

4. The payments platform

[Merchants] -> [API Management] -> [Payment API / Orchestrator] --(events)--> [Ledger]
                                         |                                  [Reconciliation]
                                         v
                                 [Card Vault / Tokenisation]   (PCI DSS zone, isolated network)

Key mechanisms: idempotency keys on create-payment, outbox for events, inbox for consumers, an append-only double-entry ledger, reconciliation against acquirer files, and SLOs on authorisation latency (for example p99 < 300 ms).

5. Writing the ADR

A lightweight ADR (Michael Nygard's format):

  • Title: ADR-007 Policy administration as a modular monolith
  • Status: Accepted
  • Context: drivers, constraints, team shape
  • Options: microservices, modular monolith, layered monolith
  • Decision and consequences (positive and negative)
  • Revisit when: a module's load profile diverges, or teams block each other's releases more than N times a quarter

6. Evolving the decisions

Prefer reversible choices early. A modular monolith can become services; a premature service split is expensive to merge. Fitness functions (architecture tests, latency budgets, deployment frequency per team) tell you when the trigger is reached.

Try it yourself

  1. For a system you know, rank its top five quality attributes and see if the current architecture matches.
  2. Write an ADR for one past decision, including revisit triggers.
  3. Run a 90-minute event storming session on a small domain and map the resulting contexts to modules.
  4. Build a decision matrix (options vs weighted drivers) for the three systems above and compare it with your gut choice.

💻 Code

Solution layouts for the three systems, plus an ADR template.

# 1. Admin app: one project, vertical slices
AdminPortal/
  Features/
    Users/ListUsers.cs          // query + endpoint
    Users/DeactivateUser.cs     // command + endpoint
    Products/EditProduct.cs
  Data/AdminDbContext.cs
  Program.cs

# 2. Policy administration: modular monolith
src/
  Host/Program.cs               // AddPolicyModule(), AddRatingModule(), ...
  Modules/
    Policy/Policy.Contracts/    // public DTOs, integration events
    Policy/Policy.Core/         // domain + application (internal)
    Policy/Policy.Infrastructure/
    Rating/...
    Billing/...
tests/
  Architecture.Tests/           // module boundary rules
  Policy.Core.Tests/            // aggregate invariants

# 3. Payments platform: separate repos or deployables per service
services/
  payment-api/                  // orchestration, idempotency
  card-vault/                   // PCI DSS zone, tokenisation
  ledger/                       // append-only double-entry
  reconciliation/               // batch matching against acquirer files
platform/
  bicep/                        // network isolation, private endpoints, Key Vault
// A rich aggregate from the policy system: where DDD earns its keep
namespace Policy.Core.Policies;

public sealed class InsurancePolicy
{
    private readonly List<Endorsement> _endorsements = [];
    private InsurancePolicy() { }

    public Guid Id { get; private set; } = Guid.NewGuid();
    public DateOnly CoverStart { get; private set; }
    public DateOnly CoverEnd { get; private set; }
    public PolicyStatus Status { get; private set; } = PolicyStatus.Active;
    public IReadOnlyList<Endorsement> Endorsements => _endorsements;

    public static InsurancePolicy Issue(DateOnly start, int months) =>
        new() { CoverStart = start, CoverEnd = start.AddMonths(months) };

    public void Endorse(string change, DateOnly effective)
    {
        // Invariant: an endorsement must take effect within the current cover period of an active policy.
        if (Status != PolicyStatus.Active)
            throw new InvalidOperationException("Only active policies can be endorsed.");
        if (effective < CoverStart || effective > CoverEnd)
            throw new ArgumentOutOfRangeException(nameof(effective), "Endorsement must fall within cover.");
        _endorsements.Add(new Endorsement(change, effective));
    }
}

public sealed record Endorsement(string Change, DateOnly Effective);
public enum PolicyStatus { Active, Lapsed, Cancelled }
# ADR-007: Policy administration as a modular monolith
Status: Accepted (2026-11-20)
Context: complex, long-lived rules; 3 teams; APRA CPS 234; data must stay in Australia East/Southeast.
Options: (a) microservices per context, (b) modular monolith, (c) layered monolith.
Decision: (b), one module per bounded context, schema per module, events via outbox.
Consequences: + simple ops, strong consistency inside modules, cheap refactoring;
              - shared release train, one scaling unit.
Revisit when: a module needs independent scaling, or teams block each other's releases > 3 times a quarter.

⚠ Common mistakes

  • Mistake: Applying one house architecture to every system. Why it is wrong: drivers differ, so one system is over-engineered and another under-engineered. Instead: choose per system from ranked quality attributes and constraints.
  • Mistake: Using DDD tactical patterns in a CRUD admin app. Why it is wrong: aggregates and repositories protect no real rules there. Instead: vertical slices with EF Core directly.
  • Mistake: Building the insurance domain as a CRUD layer over tables. Why it is wrong: complex rules scatter across services and break as products change. Instead: bounded contexts and rich aggregates.
  • Mistake: Splitting payments into many fine-grained services from day one. Why it is wrong: consistency, latency and operational costs multiply. Instead: split only along scaling and compliance boundaries (for example, the PCI zone).
  • Mistake: Ignoring compliance in the architecture. Why it is wrong: PCI DSS, APRA CPS 234 and data residency shape network and data boundaries. Instead: treat compliance scope as a first-class driver.
  • Mistake: Deciding without recording. Why it is wrong: the reasoning is lost and the decision gets relitigated. Instead: write ADRs with revisit triggers.
  • Mistake: Treating decisions as permanent. Why it is wrong: drivers change. Instead: define fitness functions and triggers to revisit.

🏛 Senior insight: trade-offs

Staff-level architecture is mostly matching structure to drivers and making the reasoning visible. The three systems here deliberately get three different answers, and I'd defend that diversity: consistency of practices (CI/CD, observability, security baselines, ADRs) matters more than consistency of architecture style. I also favour reversible choices: modular monolith first wherever the boundaries are still being learned, services only where scale or compliance justify them on day one.

The drivers aren't mine to invent. I run a short workshop per system with product (time to market, roadmap), risk and compliance (APRA CPS 234, PCI DSS, Privacy Act obligations), security, operations/SRE (on-call capacity, SLOs) and the delivery teams who will live with it, and we agree a ranked list of quality attributes before anyone proposes a style. That turns later debates into "which option best serves the drivers we agreed?" rather than preference. Where people still disagree, a time-boxed spike with measurements settles it, and once the decision is made I commit to it and set revisit triggers so dissenters know when it will be looked at again.

Option When it fits Cost When not to
Vertical slices / layered Simple rules, small team, fast delivery Low Complex, shared invariants
Modular monolith + DDD Complex domain, 1–5 teams, evolving boundaries Boundary discipline, modelling skill Trivial CRUD or radically different scaling needs
Selective services, event-driven High scale, strict compliance zones, many teams Ops, consistency, tracing, platform team Unclear boundaries, small org

I'd measure whether each choice was right with DORA metrics per system, incident and defect rates, cost per transaction, and how often the ADR's revisit triggers fire.

🔗 Follow-ups the interviewer may ask

  1. When: Candidate starts listing patterns (CQRS, outbox, mediator) for each system. Why: Checks whether they can choose enterprise patterns per service without overuse.
    How to answer

    I choose patterns from the forces, not from a template: domain complexity and invariants, consistency needs, integrations, scale and the team.

    Every service gets a cheap baseline: DbContext as the unit of work, DTOs at boundaries, validation, typed HttpClients with resilience, an outbox for integration events, and observability.

    • CRUD admin service: vertical slices with DbContext in handlers and projections for reads. No repositories, CQRS levels, mediator or domain services.
    • Insurance claims: aggregates and repositories, domain services for cross-aggregate rules, light CQRS, outbox/inbox, and a saga for long-running claim workflows.

    Each extra pattern needs a named trigger. I record decisions as ADRs with reversal conditions and enforce them with architecture tests. The trade-off is fitting the design to today's problem against preparing for change that may never come.

  2. When: Candidate picks a modular monolith for the policy system. Why: Checks whether they know how to make module boundaries real.
    How to answer

    A modular monolith is one deployable split into modules aligned to business capabilities — Orders, Billing, Catalogue — each with hard boundaries.

    • Each module owns its data: its own schema and DbContext, no cross-module joins or foreign keys.
    • Modules talk only through a public contract (an interface and DTOs) or integration events; everything else is internal.
    • Boundaries are enforced: separate projects, internal types, architecture tests, even per-schema database permissions.

    You get microservice-style boundaries with monolith-style operations: one pipeline, in-process calls, easy refactoring. The trade-off: one runtime, one release and one scaling unit, and it only works if the boundaries are enforced — otherwise it decays into a big ball of mud.

  3. When: Candidate mentions revisit triggers or fitness functions. Why: Checks whether they can design for evolution over time.
    How to answer

    Evolutionary architecture (Ford, Parsons and Kua) is architecture designed to support guided, incremental change, rather than a fixed upfront design. The key tool is fitness functions: automated checks that protect the characteristics you care about, such as dependency rules (architecture tests), latency budgets, or startup time, run in CI or production. Around that, I keep boundaries modular (often a modular monolith first), make decisions reversible where possible and defer irreversible ones to the last responsible moment, record decisions in ADRs, and rely on continuous delivery, feature flags and observability so each change is small and safe.

🛠 Real-world problems: how you handle them

A house microservices standard applied to an internal admin tool
Situation
At an [insurer], an architecture standard required microservices for all new systems. A [2-person] team was building an internal product-configuration admin tool for [~80] staff, alongside a new policy platform and payments work.
Signals
The admin tool had [6] services, [6] pipelines and a message broker for [~200] requests a day; lead time per change was [9 days]; the team spent [~40%] of time on infrastructure; the policy platform team meanwhile struggled with CRUD-style services that couldn't express product rules.
Investigation
Mapped each system against ranked quality attributes and team size; pulled DORA metrics per system; ran an event storming session for the policy domain; reviewed hosting cost per system in Azure Cost Management.
Resolution
Proposed in three ADRs: collapse the admin tool into one vertical-slice app; rebuild policy administration as a modular monolith with DDD aggregates; keep payments as a small set of services split along PCI and scaling boundaries. Ran a [two-week] spike on the admin tool to show the effect before changing the standard.
Prevention
Replaced the single-style standard with a decision guide (drivers → options) plus mandatory ADRs with revisit triggers; architecture review for new systems focuses on drivers, not style.

How to tell it (STAR)

**S:** At [insurer], a microservices-for-everything standard meant a [2-person] admin tool ran [6] services with a [9-day] lead time, while the complex policy platform was built as CRUD. **T:** As [principal engineer], I wanted architecture to follow each system's drivers. **A:** I mapped all three systems against ranked quality attributes, wrote three ADRs, and ran a [two-week] spike collapsing the admin tool into one app. Some architects disagreed about the policy platform; we agreed a revisit trigger and I committed to the outcome. **R:** The admin tool's lead time dropped to [1 day], its hosting cost fell [~70%], and the standard was replaced by a decision guide used for the next [5] systems.

↩ Usually asked after

More in Application Architectures

Last updated 23 Nov 2026.

🌐 Sangam's Webring

⏪ Previous 🏠 Main Next ⏩
💬 Chat with me