Evolving a Modular Monolith with Architecture Fitness Functions

Make one booking system's architecture measurable and enforced: quality scenarios a probe checks, module boundaries and data ownership verified by fitness functions, a pricing service extracted behind a tested contract, and a failure drill that revises a decision record.

Software Architect. Advanced.

What you will build and explain

  • Write quality attribute scenarios with a stimulus, response and measure, and run the probe that checks them.
  • Declare module boundaries and enforce public-API-only imports, declared dependencies, no cycles and no drift.
  • Own data per module with PostgreSQL schemas and roles, and prove a cross-schema query is denied at runtime.
  • Verify a consumer-driven contract against an in-process and a remote provider, then extract pricing behind a port.
  • Measure bookings under a pricing outage, choose between refusing and degrading, and record the decision with its triggers.

Before you begin

  • Python with packages, type hints, classes and tests; reading a stack trace to the failing line.
  • HTTP/JSON APIs and OpenAPI documents; SQL with tables, keys, joins and transactions.
  • Docker Compose basics: starting services, reading logs, a shell in a container, named volumes; Git branches and diffs.
  • Docker Engine 24+ or Docker Desktop with Compose v2, Git, about 4 GB of memory and 3 GB of disk for Docker; no cloud account.

Curriculum

Learning topics (14)
  1. Understand the brief and prepare a local lab

    The objective of this first reading is to know what Wrenfield Workshops is asking for, what you already need to be able to do, what this project will teach you, and what the lab needs from your machine. Nothing runs yet.

  2. Understand the architecture and its boundaries

    Wrenfield's system is one Python process, one PostgreSQL database and, after extraction, one more process for pricing. What makes it an architecture rather than a pile of code is the set of boundaries drawn above and the fact that each of them is checked: by a fitness function, by a database role, by a contract or by a measured scenario. This page walks the complete picture as one connected story; the technology lessons take each boundary in depth.

  3. Turn quality goals into measurable scenarios

    The objective is to replace "the booking system should be fast and resilient" with statements a script can check, and to see what happens when a measurement disagrees with the design. You know how to call an HTTP API; this lesson introduces the quality attribute scenario and the probe that exercises one.

  4. Structure the monolith into modules with public APIs

    The objective is to understand what makes Wrenfield a modular monolith: five modules that each expose one public API, a shared kernel that knows none of them, a composition root that knows all of them, and events that let a module react to another without importing it. You know Python packages and imports; this lesson introduces the vocabulary of boundaries before the next lesson shows how they are enforced.

  5. Enforce structural rules with fitness functions

    The objective is to turn the previous lesson's rules into checks that run on every change and fail with the offending file named. You know what a public API and a declared dependency are; this lesson shows how a program reads the import graph, compares it with architecture.yaml and refuses drift in both directions.

  6. Give each module its own schema and database role

    The objective is to make data ownership something the database enforces, not something a reviewer remembers. You know SQL and transactions; this lesson introduces PostgreSQL schemas as namespaces, roles as the unit of privilege, and SET LOCAL ROLE as the switch that narrows every transaction to one module.

  7. Define and test the contract between consumer and provider

    The objective is to make the dependency between scheduling and pricing explicit enough to survive a process boundary: a written contract, owned by the consumer, executed against the provider on both sides. You know HTTP/JSON APIs and OpenAPI documents; this lesson introduces consumer-driven contracts and shows the small verifier this project uses instead of a broker.

  8. Extract pricing into a service behind a port

    The objective is to move pricing into its own deployable without changing a line of scheduling's rules, and to know how to prove the move did not change behaviour. You know what a module public API is and what the contract promises; this lesson introduces ports and adapters and the strangler step that uses them.

  9. Decide and measure behaviour when pricing is unavailable

    The objective is to replace "pricing might be down" with a decided, measured behaviour: what a booking request does while the pricing service is unreachable, how the system notices recovery, and how the measurement changed the decision. You know the port and the remote adapter; this lesson introduces timeouts, circuit breaker states, fallbacks and the drill.

  10. Record decisions with the triggers that reopen them

    The objective is to leave the next architect something better than chat history: a numbered record for each decision that says why it was made, what it costs and what observation would reopen it, checked by a lint so the set stays consistent. You know what the drill measured; this lesson shows how that measurement became ADR 0005.

  11. Run the lab from preparation to a revised decision

    This is the single ordered procedure. Every command runs from the directory that holds compose.yaml (the pack root) and, unless it says otherwise, inside the project image through docker compose run, so the host needs no Python. The Step-by-Step Guide shows these sections inline, one milestone at a time; cleanup is in its own procedure and is reachable after any step.

  12. Diagnose structural and runtime failures from evidence

    The objective of this lesson is to approach the eight troubleshooting scenarios the way an interviewer expects: state what you would check first and why, name the competing explanations, and choose the check that tells them apart. Each scenario opens with a symptom and the observations available; the diagnosis stays closed until you have answered.

  13. Explain architecture decisions in an interview

    The objective is to be able to explain this project's decisions aloud, with their costs and the observations that would reopen them, in the way an architecture interview probes them. The twenty-four questions are grouped into three topics; each has a model answer grounded in this implementation, talking points and a follow-up that changes a constraint.

  14. Remove the lab and confirm nothing remains

    The lab owns one Compose project: up to three containers, one network, one named volume and one built image tag. Nothing else on your machine belongs to it. Cleanup removes exactly those, in an order that works from any state, including a half-finished setup or a drill interrupted while pricing was stopped.

Practical build steps (6)
  1. Prepare the pack, inputs and images

    Finish with a built image, a private .env with no placeholders, passing unit tests and a green static fitness report, and nothing running yet.

  2. Start the monolith and exercise one booking

    Finish with the database and monolith healthy, seeded data, one confirmed booking with an in-process quote, one refused overlap, one stored notification and utilisation that shows the booked hours.

  3. Measure the baseline scenario and runtime ownership

    Finish with a QAS-1 report that records measured p95 latency and error rate against the thresholds, and an ownership report showing every cross-schema statement denied for every module role.

  4. Extract pricing and verify the contract

    Finish with the pricing service running, the monolith in remote mode with a closed breaker, the consumer contract verified against the running provider, and a remote quote equal to the in-process quote for the same inputs.

  5. Run the failure drill and revise the decision

    Finish with two drill reports: one under PRICING_FALLBACK=fail that fails the availability measure, and one under degrade that passes it, plus repriced bookings and a reading of ADR 0005.

  6. Remove the lab and confirm nothing remains

    Finish with no containers, network, volume or built images of the Compose project left on your machine, and the reports you want kept copied elsewhere.

Access

Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.

Cloud costs and boundaries

The lab runs on your own machine: local CPU, memory, disk and about forty megabytes of downloads for the pinned PostgreSQL and Python images and packages. No cloud account, domain, certificate or paid service is used. Remove the Compose project, its volume and images with the cleanup procedure when you finish. This is a learning reference, not a hosted lab or a production-readiness guarantee.

Licence and completion

Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Third-party components retain their own licences. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.

Questions about projects

Do I need a cloud account?

You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.

Can I read the code with Learning Access?

Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.

Are cloud charges included?

No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.

Does the project include troubleshooting and interview preparation?

The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.

How long can I use the project?

The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.

Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy