Guide
What Are Microservices? A Practical Guide With an Example
Understand microservices by following a booking confirmation from a single application to a separately deployed notification service.
By the Space Office team · Published · Updated · 16 min read
Microservices are independently deployable parts of an application, each responsible for a specific business capability. They communicate through explicit contracts such as APIs or events, and each service controls the data it owns. A useful first step is to decide whether one capability needs its own deployment and can fail independently. At Space Office, Lithium can sketch that boundary from a scoped code sample, Tungsten can draft rollout and rollback steps, and Hydrogen reviews the evidence for the human release owner.

Key takeaways
- Start with a business outcome and an owner for each service. A folder, repository, or running container alone tells you little about independence.
- A modular monolith can enforce clear boundaries while keeping one deployment and simpler transactions.
- For an extraction, identify the authoritative writer, the event or API contract, and the behavior during failure before changing traffic.
- The fictional example moves notification delivery while reservation and payment remain with the booking application.
- Decide how to prevent duplicate effects and recover outstanding work before exposing real traffic to the new service.
How do microservices work?
Think of a workshop booking system with reservations, payments, and notifications. Reservation decides which seat belongs to whom. Payment records whether a charge succeeded. Notification sends a message that reflects the booking state. These are business responsibilities. Their code can live in one application today, and only a responsibility that benefits from a separate release and has a defensible boundary needs to become a service.
An independently deployable service has a contract that callers can continue using while its implementation changes. A team might update a notification provider adapter without releasing reservations again. The reservation application supplies a confirmed booking reference, and the notification service records its own delivery state. If changing a private notification table requires coordinated changes in several applications, you have found coupling that makes independent deployment hard. AWS overview of microservices
Service ownership also covers operation. Someone needs to decide who responds to a delayed queue, how to pause delivery, and what counts as recovery. A service may share physical database infrastructure with another service, but grant each application access only to the data it owns. Treat cross-service table writes as an ownership issue to resolve. Publish a contract for any fact another service needs. Microsoft Azure microservices architecture style
Synchronous communication is useful when a caller needs an immediate answer, such as whether a reservation succeeded. Asynchronous communication is useful when follow-up work can finish later, such as an email receipt. For a synchronous dependency, specify a timeout and the response to failure. For an asynchronous one, specify what the user sees during a delay and how the team can find work that still needs attention.
When does a modular monolith fit better?
A modular monolith groups related work into explicit modules inside one deployable application. A booking module can expose functions that other modules call, and its tests can protect its business rules. One release can be a good fit when the same team owns the whole application and a database transaction must keep related writes consistent. You can document the boundaries today and use them later if a change in load, ownership, or release cadence justifies an extraction.
Scroll horizontally to view all columns.
| Decision factor | Keep one deployment when | Consider separating one service when |
|---|---|---|
| Release cadence | The same team releases modules together with little delay. | One capability changes often and its releases block unrelated work. |
| Data consistency | A single transaction protects a core business rule. | The new service can own its state and accept delay in downstream views. |
| Load | The application fits one scaling profile. | One workload has a distinct, measured capacity problem. |
| Failure and support | One team can diagnose issues from one set of logs. | The team can own a separate alert, rollout, and recovery path. |
| Contract | The behavior still changes with core business rules. | The required inputs and outcomes are stable enough to test at the boundary. |
A split can make releases smaller while adding network delays, more secrets and deployment pipelines, and more places to look for a failure. Those costs show up even during quiet weeks. If a report job competes with interactive traffic, test a separate worker or better scheduling before adding a new data owner. If changes are difficult because modules share internal data freely, improve the boundaries inside the application and measure whether that addresses the bottleneck.
A distributed monolith has separate running processes that still have to change together. Look for a release checklist that always deploys two services in lockstep, a schema migration that silently breaks another service, or a chain of synchronous calls where one unavailable dependency makes every screen fail. The meaningful test is whether the team can change a service in isolation and whether users retain an acceptable experience when it slows down.

A worked example of extracting notifications
Imagine a small pottery studio that accepts online reservations. An external email provider sometimes responds slowly. The original application tries to send a confirmation while handling a booking. A participant sees an error and may retry even though the seat was already saved. The maintainers want the website to show the confirmed seat promptly and deliver a confirmation when the provider recovers. This is a fictional scenario for planning and testing.
The first change is inside the existing application. Commit the confirmed booking and an outbox entry in one database transaction. The outbox entry records that a confirmation should be sent. A relay reads the committed entry and publishes an event. If the transaction fails, neither the booking nor its event is committed. If the relay is temporarily unavailable, the outstanding entry remains available for another attempt. Chris Richardson’s transactional outbox pattern
Keep the booking page and support tools authoritative for the reservation. The email is a copy of an outcome that already occurred. After the commit, show the reservation reference and say that the email may take a few minutes. A cancellation or schedule change can occur before a queued confirmation is sent. Define whether a stale event is suppressed or the message is rendered against current approved status, and test that policy explicitly.
The first separate deployment owns delivery attempts, provider response references, and the state of each notification. It consumes an event with a version, event ID, booking reference, event time, and approved delivery fields. Send only the contact information needed for that action through restricted infrastructure, or use a scoped lookup if your operating requirements support it. In either case, define retention and avoid logging raw addresses. Keep the payment state and seat count in the original application.


What to test before changing traffic
- 1Confirm the baseline. Trace a single booking across the browser response, database, and provider. Record how many bookings leave confirmation work outstanding, how long the queue waits during a slowdown, and how the team matches a message to a reservation.
- 2Give each notification a stable operation key. A confirmation might use the reservation ID, notification kind, and booking version. A retry of the same event keeps that key. A later cancellation is a different operation. Add a database uniqueness rule for the key and check concurrent deliveries in staging.
- 3Exercise crash recovery around the provider call. If the provider accepts a send and the worker crashes before recording it, a database uniqueness rule alone cannot prove delivery. Use provider idempotency or status lookup where supported. When the status cannot be established, route the ambiguous attempt to manual reconciliation.
- 4Test compatibility by running the current consumer against the new event version and the new consumer against an existing event. Add optional fields first when possible. When a breaking change needs migration, record how long both versions must be accepted and what the rollback path can still read.
- 5Test an unavailable provider, repeated events, out-of-order cancellation, revoked credentials, and a backlog that outlives the worker deployment. Make the expected user state and the permitted operator action explicit for each case.
A test should state which record proves success. For duplicate delivery, count provider requests and accepted sends for the same operation key. For a delayed confirmation, check whether the website still shows the seat, whether pending work is visible, and whether the oldest queued message returns to the normal age once the provider recovers. Trace IDs can help find the same operation in several systems. Keep message content and sensitive customer fields out of that trace.
For a concrete drill, commit one test reservation while the provider is unavailable. Deliver the same event twice and then restore the provider. The expected records are one reservation, one notification operation, and one accepted send. Repeat the drill with a simulated crash immediately after provider acceptance. Record whether the worker can retrieve that outcome and what the operator sees if it cannot.
Roll out a single boundary and rehearse rollback
Use a limited routing rule to let the old application and the new service coexist. For example, exercise the new service with staff test bookings in staging, then direct an explicitly approved slice of live confirmations to it. Reserve one writer for each operation key. A shadow run can generate a preview or validate event parsing while sending is disabled. Side-by-side sending risks duplicate messages even when each system deduplicates internally. Martin Fowler’s strangler fig pattern
A release owner might choose a 5 percent pilot of new reservations and pause after any confirmed duplicate or when the oldest pending confirmation stays above ten minutes for two checks. Those numbers are illustrative. Choose thresholds based on typical volume, the time participants need to receive a message, and how much evidence a small slice provides. At low volume, wait for enough representative bookings and evaluate both the error count and the denominator.

Plan rollback for traffic and for state. Switch new reservations to the previous path, pause the new consumer, and record the cutoff. List events already delivered, still pending, or ambiguous. Reconcile those records before replaying anything. If the old sender cannot recognize a message sent by the new one, require operator review for that set. A routing switch by itself leaves external effects and outstanding events where they are.


A retirement checklist should also have an owner. Keep the previous sender available for the agreed rollback period and record when it may be removed. If the old path has no safe way to process events already accepted by the new service, the owner may choose to pause and repair the new path. Remove obsolete credentials, schedules, and routes only after the recovery window and the agreed data-retention checks.
Prepare the pilot with Space Office
Start with the microservices extraction worksheet and a short sanitized trace of one completed booking. Include the existing module map, event example, baseline, incident owner, and an explicit definition of what a successful pilot would prove. A useful initial brief asks for a proposed boundary and a staging review packet with a single writer, a stop rule, and a reconciliation checklist.
In a Space Office workflow, Hydrogen routes the brief to Lithium and Tungsten. Lithium, the Full Stack Developer, can map the booking code and draft the event contract or a scoped branch change. Tungsten, the DevOps and Site Reliability Specialist, can prepare the rollout, monitoring, and rollback plan. Where needed, Carbon, the Senior QA Engineer and Test Strategist, can exercise the contract and failure cases in an approved test environment.
Supply sanitized records and access only to the repositories and staging resources you explicitly scope. Hydrogen reviews the specialist drafts together, checks that the monitoring and rollback assumptions match the contract, and flags missing test evidence. The human owner approves the boundary, verifies the recovery drill, and separately authorizes any production traffic. Account access and rollout authorization come from that owner. The specialist roster describes the available roles.
When to start with one service
Start with one boundary if it addresses a measured problem, has an identifiable owner, and leaves the core user task working during a failure. In the pottery example, keeping the booking authority intact is more important than where the email code runs. If a worker inside the existing deployment clears the observed bottleneck, keep that simpler arrangement and revisit the boundary when there is evidence to do so. Microservices become worth operating when a testable benefit survives the cost of contracts, on-call work, and recovery. For the wider design decision, use the software architecture guide.
Sources and review notes
Reviewed against the linked primary sources on the checked dates. Search features and citations are selected by their respective platforms; no placement is guaranteed.
- AWS overview of microservices — checked
- Microsoft Azure microservices architecture style — checked
- Martin Fowler’s strangler fig pattern — checked
- Chris Richardson’s transactional outbox pattern — checked
Frequently asked questions
What are microservices?
Microservices are separately deployable components of a software system that each own a defined business capability. They expose a stable contract to other components and control changes to the data they own. A service may run in one process or several replicas. Independent deployment and ownership describe its relationship to the rest of the system.
Are microservices and APIs the same thing?
An API is a contract for interacting with software. A microservice may expose a synchronous API, consume events, or do both. A single application can expose multiple APIs while remaining one deployment. Look at which component owns the outcome and whether it can change independently.
Do microservices require Docker or Kubernetes?
Microservices can run on virtual machines, managed application platforms, containers, or serverless compute. Docker can package a service and Kubernetes can orchestrate containers. Decide how to deploy and monitor the service based on its workload and the tools the team can support.
Can microservices share a database?
They can share physical infrastructure with clear data boundaries and access controls. Sharing writable tables couples schema changes and makes responsibility harder to trace. Begin by identifying the authoritative writer for each record and give other services a documented way to read the facts they need.
Which capability should be extracted first?
Pick a responsibility with a concrete problem, a stable interface, and an acceptable failure mode. Notification delivery is a good candidate in the worked example because a late email leaves the saved booking intact. Measure the existing behavior, demonstrate recovery in staging, and let the human release owner decide whether a pilot is justified.