Architect Systems That Scale — From API Contracts to Non-Functional Requirements

By the end of this page, you will understand how Architects define system boundaries, API contracts, and constraints — and how to use AI to generate and validate architecture decisions.

Architecture & Design — The 2-Minute Overview

Chapter 6 Cartoon — The Mystery Box

Think about the last time you entered a large building — a hospital, an airport, a university campus. You didn't see the architectural decisions behind it — load-bearing walls, fire exits, ventilation systems, elevator shafts, emergency power. You just walked in and everything worked. But somebody had to decide where every wall goes, how much weight each floor can bear, and what happens when the power goes out — before a single brick was laid. Those decisions are Architecture. The diagram below is that map, zoomed out to its simplest form.

graph LR subgraph INPUT["Architecture Inputs"] I1["PRD & Requirements"] I2["Business Constraints"] I3["Technical Capabilities"] end subgraph ARCH["Architecture Decisions"] A1["System Boundaries — What talks to what"] A2["API Contracts — How they talk"] A3["Tech Stack — What we build with"] A4["NFRs — How well it must perform"] end subgraph OUTPUT["Architecture Outputs"] O1["Architecture Decision Records"] O2["API Contract Specs"] O3["Tech Stack Constraints"] end I1 --> A1 I2 --> A1 I3 --> A3 A1 --> A2 A2 --> A3 A3 --> A4 A4 --> O1 A4 --> O2 A4 --> O3 style INPUT fill:#16213e,stroke:#0f3460,color:#fff style ARCH fill:#1a1a2e,stroke:#e94560,color:#fff style OUTPUT fill:#006400,stroke:#00cc00,color:#fff

How to Read This Diagram

FlowMeaning
Left → CenterPRD, business constraints, and technical capabilities feed the architecture process
Center (top → bottom)Decisions flow: boundaries → contracts → tech stack → non-functional requirements
Center → RightArchitecture produces ADRs, API specs, and tech constraints for the team

You Already Know Architecture — You Just Don't Know It Yet

You've been doing architecture every time you planned a large dinner party at home. Let's prove it.

Imagine you're hosting 30 people for a holiday dinner. Watch what happens — and notice how every step maps to system architecture:


🍽️ The Dinner Party Analogy

graph TD subgraph BOUNDARIES["🏠 System Boundaries"] B1["Kitchen = Backend (where food is made)"] B2["Dining room = Frontend (where food is served)"] B3["Serving window = API (how food moves between)"] end subgraph CONTRACTS["📋 API Contracts"] C1["Menu is the contract: dishes, portions, timing"] C2["Kitchen promises delivery; dining room expects format"] end subgraph STACK["🔧 Tech Stack"] S1["Gas stove vs electric (infrastructure choice)"] S2["Catering trays vs home plates (scale decision)"] end subgraph NFR["📊 Non-Functional Requirements"] N1["Serve 30 people in 45 min (performance)"] N2["Backup plan if oven breaks (resilience)"] end B1 --> C1 B2 --> C1 B3 --> C2 C1 --> S1 C2 --> S2 S1 --> N1 S2 --> N2 style BOUNDARIES fill:#16213e,stroke:#0f3460,color:#fff style CONTRACTS fill:#533483,stroke:#e94560,color:#fff style STACK fill:#cc7700,stroke:#ffaa00,color:#fff style NFR fill:#006400,stroke:#00cc00,color:#fff

Step 1 — You define boundaries: kitchen (production), dining room (consumption), serving window (interface). The kitchen and dining room are separate systems. Food flows through a defined interface — the serving window. You don't let guests wander into the kitchen.

🔗 Architecture Layer: ① SYSTEM BOUNDARIES The Architect defines which services exist, what each owns, and how they communicate. Backend doesn't expose internal logic to frontend — it exposes an API. Without boundaries, guests are in the kitchen bumping into the cook — chaos.

Step 2 — You set the menu: what dishes, what portions, what time. The menu is a contract between the kitchen and the dining room. The kitchen promises specific dishes at specific times. The dining room expects them in a specific format (plated, not in pots).

🔗 Architecture Layer: ② API CONTRACTS The Architect defines API contracts — request/response formats, endpoints, error codes, versioning. Both sides agree on the contract before building anything. Without contracts, the frontend expects JSON and the backend sends XML. Integration fails on day one.

Step 3 — You choose equipment: gas stove vs. electric, catering trays vs. home plates. These are infrastructure decisions. Gas stove is faster but needs ventilation. Catering trays scale better than home plates. Every choice has trade-offs.

🔗 Architecture Layer: ③ TECH STACK The Architect selects technologies: PostgreSQL vs. MongoDB, REST vs. GraphQL, React vs. Vue. Each choice has trade-offs — performance, team expertise, ecosystem, cost. Without deliberate tech stack decisions, each developer picks their favorite — you end up with 4 databases and 3 frameworks.

Step 4 — You define performance: "Serve 30 people in 45 minutes. If the oven breaks, use the grill." These are non-functional requirements. They don't describe what you serve — they describe how well you serve it. Speed, resilience, capacity.

🔗 Architecture Layer: ④ NON-FUNCTIONAL REQUIREMENTS The Architect defines NFRs — performance targets (p99 latency <200ms), availability (99.9%), scalability (10x current load), and resilience (service degradation on failure). Without NFRs, the system works in demo but crashes at 100 users. Nobody defined what "handles load" means.

The Complete Mapping

Dinner PartySystem ArchitectureLayer
Kitchen (production) vs. Dining room (consumption)Backend vs. Frontend, microservices boundaries① System Boundaries
Menu: dishes, portions, timingAPI contracts: endpoints, formats, SLAs② API Contracts
Gas stove vs. electric; catering trays vs. platesPostgreSQL vs. MongoDB; REST vs. GraphQL③ Tech Stack
Serve 30 in 45 min; backup if oven breaksp99 <200ms; 99.9% uptime; graceful degradation④ NFRs

You just learned system architecture without drawing a single diagram.

The rest of this page gives you the framework and a working prompt. The mental model? You already have it.


The 6 Pillars of System Architecture

1. System Boundaries

If you can't draw a box around it, you can't build it. Boundaries define what exists and what talks to what.

A system boundary is a line around a service, module, or component that says: "This is one unit. It owns its data, its logic, and its interface." Boundaries prevent spaghetti architecture — where everything depends on everything else. The Architect decides: monolith or microservices? How many services? What does each own? How do they communicate (sync vs. async)?

ConceptWhat It MeansTrade-off
MonolithSingle deployable unit, shared databaseSimple to start, hard to scale independently
MicroservicesIndependent services, each with own dataScale independently, but distributed complexity
Bounded ContextEach service owns a domain concept exclusivelyClean ownership, but requires clear domain modeling
🍽️ Dinner analogy: Monolith = one giant kitchen doing everything. Microservices = separate stations for appetizers, mains, desserts — each with their own prep area.

2. API Contracts

An API contract is a promise. Break the promise, break the integration.

API contracts define the interface between services: endpoints, request/response formats, error codes, authentication, and versioning. Both sides develop against the contract independently. When the contract is stable, integration is smooth. When it changes without notice, everything breaks.

ConceptWhat It MeansTrade-off
RESTResource-oriented URLs, HTTP verbsSimple, well-understood, but over-fetching risk
GraphQLClient specifies exactly what data it needsFlexible queries, but complex server implementation
Contract-First DesignWrite the API spec (OpenAPI/Swagger) before codingTeams build in parallel, but requires upfront investment
🍽️ Dinner analogy: The menu (contract) says "Pasta Carbonara — serves 1 — ready in 20 min." The dining room expects exactly that. If the kitchen serves risotto instead, the waiter has no idea what to tell the guest.

3. Tech Stack Decisions

Every technology choice is a trade-off. The Architect's job is to choose deliberately, not defaultly.

Tech stack decisions include: programming language, framework, database, caching layer, message queue, hosting. Each choice cascades: choosing Python + FastAPI implies certain deployment patterns. Choosing PostgreSQL over MongoDB implies certain data modeling patterns. The Architect evaluates against team expertise, scalability needs, ecosystem maturity, and cost.

ConceptWhat It MeansTrade-off
Build vs. BuyCustom code vs. managed serviceControl vs. speed to market
SQL vs. NoSQLRelational data model vs. document/key-valueStrong consistency vs. flexible schema
Sync vs. AsyncRequest/response vs. event-drivenSimple flow vs. decoupled scalability
🍽️ Dinner analogy: Gas stove = more control over heat. Electric = easier to maintain. Catering service = outsource entirely. Each choice affects cost, quality, and flexibility.

4. Non-Functional Requirements (NFRs)

Functional requirements tell you what to build. Non-functional requirements tell you how well it must perform.

NFRs are the constraints that the system must satisfy beyond functionality: performance (response time, throughput), reliability (uptime, error rates), scalability (concurrent users, data growth), security (authentication, encryption, audit trails), and observability (logging, monitoring, alerting).

ConceptWhat It MeansTrade-off
Performancep50/p99 latency, throughput (requests/sec)Faster = more complexity in caching/optimization
ReliabilityUptime (99.9% = 8.7h downtime/year)Higher uptime = more redundancy = more cost
ScalabilityHandle 10x current loadHorizontal scaling = stateless services required
SecurityAuthentication, authorization, encryptionMore security = more friction for users
🍽️ Dinner analogy: Performance = serve 30 people in 45 min. Reliability = dinner happens even if one burner breaks. Security = only invited guests enter.

5. Architecture Decision Records (ADRs)

An undocumented decision is an invisible decision. ADRs make every choice visible, justified, and reversible.

An ADR captures: the context (why we faced this decision), the decision (what we chose), the alternatives (what we didn't choose), and the consequences (what we expect). ADRs prevent "why did we choose MongoDB?" conversations 6 months later — the answer is documented.

ConceptWhat It MeansTrade-off
ContextThe situation that forced a decisionBackground for future team members
DecisionWhat was chosen and whyClarity of reasoning
AlternativesWhat was considered and rejectedPrevents revisiting resolved debates
ConsequencesExpected positive and negative outcomesManages expectations
🍽️ Dinner analogy: ADR = "We chose catering trays (decision) because we're serving 30 (context). We considered home plates (alternative) but they'd require 3x more dishwashing time (consequence)."

6. PRD Validation Against Architecture

The Architect doesn't just design — they validate that what Product requested is technically achievable.

The Architect reviews the PRD and flags: impossible requirements (e.g., "real-time updates with SQLite at 10K users"), missing NFRs ("the PRD says nothing about latency"), and contradictions ("the PRD says 'offline-first' but the prototype uses server-side rendering"). This validation gate prevents building something that can't meet its own requirements.

ConceptWhat It MeansTrade-off
Feasibility CheckCan we build this with our constraints?Early course-correction vs. "discover during sprint 3"
Gap IdentificationWhat did the PRD miss?Better requirements vs. slower handoff
Constraint CommunicationTell Product what's impossible or expensiveAlignment vs. potential scope reduction
🍽️ Dinner analogy: The cook reviews the menu and says: "We can't make fresh pasta for 30 in 45 minutes — we need to switch to dried pasta or extend serving time." That's a feasibility check.

The Complete Mapping

#PillarWhat It AnswersKey Decision
System BoundariesWhat services exist and what do they own?Monolith vs. microservices
API ContractsHow do services communicate?REST vs. GraphQL, contract-first design
Tech StackWhat do we build with?Language, framework, database, hosting
NFRsHow well must it perform?Latency, uptime, scalability, security
ADRsWhy did we choose this?Context + decision + alternatives + consequences
PRD ValidationIs this buildable?Feasibility + gaps + constraints

That's it. Every system — from a startup MVP to a planet-scale platform — is shaped by these 6 pillars. Master the pillars, master architecture.

Now let's put this into a prompt you can use today.


Try It Yourself — A Starter Prompt for System Architecture

This prompt gives you a working starting point. It covers the core pillars of system architecture. For the complete prompt — with ADR templates, contract-first API specs, failure-mode analysis, and capacity planning — see the full course chapter →.
You are a Senior Software Architect with 15 years of experience in distributed systems.

I need a system architecture document for:

{{PASTE YOUR SYSTEM REQUIREMENTS OR PRD HERE}}

Cover these 6 areas:

1. SYSTEM BOUNDARIES — Define the services/components, what each owns, and how they communicate.
2. API CONTRACTS — For the 3 most critical interactions, define the endpoint, request/response format, and error codes.
3. TECH STACK — Choose the programming language, framework, database, and hosting. Justify each choice.
4. NON-FUNCTIONAL REQUIREMENTS — Define targets for performance (latency, throughput), reliability (uptime), and scalability.
5. ADRs — Write one Architecture Decision Record for the most significant choice (e.g., database selection).
6. PRD VALIDATION — List 3 things you'd flag as risks or gaps in the requirements.

For each area, provide: the decision and a brief justification.

Format as a structured document with tables where appropriate.

What This Prompt Covers vs. What It Misses

SkillLite Prompt (Free)Full Prompt (Course)Impact of Missing It
Lists all 6 architecture areas✅ Covered✅ Covered
Asks for decisions per area✅ Covered✅ Covered
Structured output format✅ Covered✅ Covered
Failure-mode analysis per service❌ Missing✅ "What happens when this service goes down?"Architecture looks solid — until the database is unreachable. No degradation strategy.
Capacity planning❌ Missing✅ "How many instances at current load? At 10x?"System scales by throwing hardware at it — no planned capacity model. Surprise cloud bill.
Security architecture⚠️ Surface-level✅ AuthN, AuthZ, encryption at rest/in transit, audit logging"We'll add security later." Sprint 8: pen test reveals 12 critical vulnerabilities.
Data flow diagrams❌ Missing✅ How data moves through services with latency per hopArchitect says "services communicate." Developer asks "sync or async?" — not specified.
Contract versioning strategy❌ Missing✅ "How do we evolve APIs without breaking consumers?"API v1 changes, mobile app breaks. No versioning plan = breaking change every deployment.
Cross-cutting concerns (logging, tracing, auth)❌ Missing✅ Shared middleware and observability strategyEach service implements logging differently. Debugging a cross-service issue takes 3 days instead of 30 minutes.

The Lite Prompt gets you to ~60% quality. Good enough to understand the shape of an architecture document. Not good enough to survive a design review with a principal engineer.

The course teaches the other 40% — which is where production-grade architecture decisions live.


Real-World Example: Architecture for a Social Media Feed

Why this example? Every reader has scrolled a social media feed. It's simple to describe ("post → feed → like") yet complex enough to reveal architecture gaps across all 6 pillars.

The Requirement

"Build a social media platform with user profiles, a content feed, likes/comments, and real-time notifications. Support 100K daily active users. Feed must load in under 2 seconds."

We fed this requirement into the Lite Prompt above. Here's what came out:


Lite Prompt Output — High-Level Architecture


① SYSTEM BOUNDARIES

Three services: User Service (profiles, auth), Content Service (posts, feed), Notification Service (alerts). Each service has its own database. Communication via REST.


② API CONTRACTS

POST /posts — create a post. GET /feed — return user's feed. POST /posts/{id}/like — like a post. JSON request/response.


③ TECH STACK

Python FastAPI, PostgreSQL, Redis for caching, AWS hosting. FastAPI for speed, PostgreSQL for relational data, Redis for feed caching.


④ NFRs

Feed latency: <2 seconds. Uptime: 99.9%. Support 100K DAU.


⑤ ADR

Decision: PostgreSQL over MongoDB. Context: Social data is relational (users → posts → comments). Alternative: MongoDB — flexible schema but complex joins.


⑥ PRD VALIDATION

Risk 1: "Real-time notifications" is undefined — websockets? Push notifications? Both? Risk 2: 100K DAU doesn't specify peak concurrent users. Risk 3: No content moderation requirement mentioned.


What a Principal Engineer Would Catch

PillarLite Output SaysWhat's MissingReal-World Consequence
① Boundaries"Three services, REST communication"No event-driven communication. Likes and notifications are async — REST is wrong here.User likes a post. REST call to Notification Service blocks for 500ms. Feed feels sluggish. Should be event-driven.
② Contracts"POST /posts, GET /feed, POST /like"No pagination for feed. No error codes. No rate limiting.Frontend calls GET /feed and gets 10,000 posts at once. Page crashes. No pagination strategy.
③ Tech Stack"FastAPI, PostgreSQL, Redis, AWS"No message queue for async events. No CDN for media. No search engine for content discovery.Images served from app server. Latency spikes. No search beyond basic SQL LIKE queries.
④ NFRs"Feed <2 seconds, 99.9% uptime"No p99 vs. p50 distinction. No degradation strategy. No concurrent user target.Average latency is 1.5s. p99 is 8s. 1% of users wait 8 seconds. "We met the target" — but only on average.
⑤ ADR"PostgreSQL over MongoDB"No consequence analysis. What's the trade-off of PostgreSQL for a write-heavy social platform?Write volume at 100K DAU overwhelms PostgreSQL without read replicas. Performance degrades at 50K DAU.
⑥ Validation"Notifications undefined, peak concurrency unknown"Good flags — but no proposed solutions. Just questions, no recommendations.Product reads "risks identified" but has no guidance on resolution. Same gaps exist after the review.
The pattern: The Lite Prompt asks "what are the architecture decisions?" The full course prompt asks "what's the decision, what's the alternative, and what breaks at scale?" That triple — decision + alternative + scale failure — is what separates a whiteboard sketch from a production blueprint.


What You Learned Today vs. What the Course Teaches

DimensionFree PageCourse Chapter
Theory & Mental Model✅ Complete✅ Complete + anti-patterns
Real-Life Analogy✅ Complete✅ Complete
Prompt⚠️ Lite — ~50% skill coverage✅ Full — failure modes, capacity planning, security
Example Output⚠️ High-level — passes glance test✅ Full — passes principal engineer review
Trade-off Reasoning❌ Not included✅ Every decision: choice + alternative + scale consequence
Edge Cases & Failures❌ Not included✅ Service failure cascades, data inconsistency scenarios
Assessment Quiz❌ Not included✅ 10 questions (scenario + trade-off + synthesis)
Coding Challenges❌ Not included✅ 3 levels with acceptance criteria
Skill Verification❌ Not included✅ Knowledge → Decision → Build → Synthesize

Ready to Architect Production-Grade Systems?

You now understand the 6 pillars of system architecture — boundaries, contracts, tech stack, NFRs, ADRs, and PRD validation. That mental model is real, and it's yours to keep.

But understanding architecture and producing a design that survives a principal engineer's review and scales to 100K users are two different things. The course gives you:

Enroll in the Fresh Graduate AI SDLC Course →

Go from "I understand architecture" to "I can design systems that scale."
← Chapter 5 Course Home Chapter 7 →