Architecture Builder

Build a software architecture step by step by choosing components, layers, and connections based on the system's requirements.

Objective

In this lab you will design a software architecture from scratch. Starting from a set of business and technical requirements, you will choose the components, layers, and connections that best solve the problem at hand.

The goal is not to arrive at β€œthe right answer” β€” it is to practice the process of making architectural decisions with sound judgment.

Scenario: E-commerce platform

Imagine you are asked to design the architecture for an e-commerce platform with the following requirements:

  • Concurrent users: up to 10,000 simultaneously
  • Catalog: 50,000 products with search and filters
  • Payments: integration with at least 2 external providers
  • Notifications: real-time email and push
  • Availability: 99.9% uptime

Step 1 β€” Choose the architectural style

Before thinking about technologies, define the overall style:

StyleAdvantagesDisadvantagesWhen to choose it?
Modular monolithSimple to deploy, easy to debugLimited scaling, internal couplingSmall teams, MVP
MicroservicesIndependent scaling, autonomous deploymentOperational complexity, network latencyLarge teams, clear domains
HybridBalance between simplicity and scalabilityRequires discipline around boundariesGradual growth

Exercise

Given the scenario, which style would you choose? Consider:

  1. The size of the available team
  2. The need to scale components independently (catalog vs payments)
  3. The operational complexity you can take on

Step 2 β€” Define the system layers

Once you have chosen the style, define the main layers:

Presentation layer

  • SPA, SSR, or a static site?
  • Do you need a BFF (Backend for Frontend)?
  • How do you handle authentication on the frontend?

Application layer

  • How many services do you need?
  • How do they communicate with each other (sync vs async)?
  • Where does the critical business logic live?

Data layer

  • One database or several?
  • SQL, NoSQL, or both?
  • Do you need a cache? Where?

Infrastructure layer

  • Cloud, on-premise, or hybrid?
  • Containers, serverless, or VMs?
  • How do you handle secrets and configuration?

Step 3 β€” Connect the components

Define how the pieces communicate:

[Frontend SPA]
    β”‚
    β–Ό
[API Gateway / BFF]
    β”‚
    β”œβ”€β”€β–Ί [Catalog Service] ──► [PostgreSQL + Redis Cache]
    β”‚
    β”œβ”€β”€β–Ί [Orders Service] ──► [PostgreSQL]
    β”‚         β”‚
    β”‚         β–Ό
    β”‚    [Event Bus]
    β”‚         β”‚
    β”‚         β”œβ”€β”€β–Ί [Payments Service] ──► [External Provider]
    β”‚         └──► [Notifications Service] ──► [Email/Push]
    β”‚
    └──► [Auth Service] ──► [Redis Sessions]

Key questions

  • What happens if the payments service does not respond?
  • How do you guarantee that an order is not processed twice?
  • Where do you implement circuit breakers?
  • How do you handle eventual consistency between services?

Step 4 β€” Evaluate trade-offs

Every architectural decision has trade-offs. Document yours:

DecisionAccepted trade-offMitigation
Microservices for catalog and paymentsGreater operational complexityKubernetes + automated CI/CD
Event bus for async communicationEventual consistencyIdempotency + retry with backoff
Redis as a catalog cachePotentially stale data5-minute TTL + event-based invalidation
PostgreSQL for transactional dataLimited vertical scalingRead replicas + partitioning

Step 5 β€” Validate against requirements

Check that your architecture meets each original requirement:

  • Does it support 10,000 concurrent users? Where is the bottleneck?
  • Is catalog search fast? Do you use indexes or a search engine?
  • Are payments resilient to provider failures?
  • Do notifications arrive in real time?
  • Can you reach 99.9% uptime with this architecture?

Reflection

When you finish, ask yourself:

  1. Which decision was the hardest? Why?
  2. What would you change if the team were 3 people instead of 15?
  3. What would you change if the availability requirement were 99.99%?
  4. Is there any component you could remove without losing critical functionality?

The perfect architecture does not exist β€” but a well-reasoned and well-documented architecture is invaluable.