Markdown Editor

Microservice Specification Template (Service Canvas)

Service canvas: bounded context, owner, APIs and events, data owned, dependencies, SLOs, scaling, config, deploy, observability

ArchitectureStandardMicroservice Canvas (Richardson); OpenAPI 3.2.1; AsyncAPI 3.1.0; RFC 9745, RFC 8594microservicespecmath

How to use: Use for each microservice, kept in its repository and linked from the service catalogue. Fill purpose, bounded context and data owned before building; link detailed API, event and runbook documents instead of copying them. Main pitfall: unlisted dependencies and shared databases that make the service boundary fictional.

Preview

Microservice Specification: [service-name]

One-page-per-service canvas that records what a microservice is for, who owns it, what it exposes and consumes, which data it owns, how it runs, scales, is observed and secured, and how it is versioned. Based on the Microservice Canvas published by Chris Richardson on microservices.io and on common service catalogue practice. Contracts are linked, not copied: OpenAPI Specification 3.2.1 for REST APIs and AsyncAPI 3.1.0 for events (the latest versions listed in October 2026). Replace every [bracketed] value and every row marked Example. Worked examples use the inventory reservation service of Marrowby Home, a fictional homeware retailer.

Document control

FieldValue
Document ID[SVC-INV-RES-001]
Service name[inventory-reservation]
Document version[0.1]
Status[Proposed / In development / Production / Deprecated]
Owning team[@team-inventory]
Technical owner[@tech-lead]
Approvers / reviewers[@domain-architect], [@sre-lead], [@security-champion]
On-call rotation[inventory-oncall]
Repository[git URL]
Service tier[Tier 1 / Tier 2 / Tier 3]
Classification[Internal]
Last updatedYYYY-MM-DD
Next reviewYYYY-MM-DD (and when ownership, dependencies or SLOs change)

Approvals

RoleNameDecisionDate
Domain architect (sections 1, 5 and 6)[@name][Approved / Changes requested]YYYY-MM-DD
SRE lead (sections 7, 8 and 11)[@name][Decision]YYYY-MM-DD
Security champion (section 12)[@name][Decision]YYYY-MM-DD

Revision history

VersionDateAuthorChange summary
0.1YYYY-MM-DD[@name]First canvas before build
0.2YYYY-MM-DD[@name]Example: SLOs agreed with SRE; AvailabilityChanged event added
1.0YYYY-MM-DD[@name]Example: Approved at production readiness review

Contents

1. Purpose and bounded context

1.1 Purpose

[One paragraph. Example: "Reserves stock for items in a checkout so that two customers cannot buy the last unit, and releases reservations that are not confirmed within 15 minutes."]

1.2 Bounded context

ItemValue
Domain / subdomainExample: Inventory / Availability (core subdomain)
Key domain termsExample: Reservation, stock keeping unit (SKU), available-to-promise, hold expiry
ResponsibilitiesCreate, confirm, release and expire reservations; publish availability changes
Not responsible forStock counts at warehouses (Warehouse service), prices (Pricing service), orders (Orders service)
Upstream contextsWarehouse (stock levels), Catalogue (SKU validity)
Downstream contextsCheckout, Orders, Storefront search

2. Ownership and lifecycle

RoleName / channel
Owning team[@team-inventory]
Product owner[@product-owner]
On-call escalation[Paging service], then [@engineering-manager]
Support channel[#inventory-help]
Lifecycle stage[Production since YYYY-MM-DD]
Planned changes[Example: Multi-warehouse reservations in Q2]

3. Interfaces

3.1 Exposed APIs

APIStyleContractConsumersAuth
POST /v1/reservationsREST[openapi.yaml#createReservation] (OpenAPI 3.2.1)CheckoutOAuth 2.0 client credentials, scope inventory:reserve
POST /v1/reservations/{id}/confirmREST[openapi.yaml]OrdersSame, scope inventory:confirm
DELETE /v1/reservations/{id}REST[openapi.yaml]CheckoutSame
GET /v1/availability?sku=REST[openapi.yaml]Storefront, SearchScope inventory:read
[API][REST / gRPC / GraphQL][Link][Consumers][Auth]

3.2 Consumed APIs

APIProviderPurposeTimeoutFallback if unavailable
GET /v2/skus/{sku}Catalogue serviceValidate SKU on reservation300 msUse cached SKU list (refreshed every 5 min)
[API][Provider][Purpose][Timeout][Fallback]

4. Events

4.1 Published events

EventChannelSchemaTriggerKey
ReservationCreatedinventory.reservation.v1[registry subject]Reservation storedsku
ReservationExpiredinventory.reservation.v1[subject]Hold timer elapsedsku
AvailabilityChangedinventory.availability.v1[subject]Available quantity crosses a thresholdsku
[Event][Channel][Schema][Trigger][Key]

4.2 Consumed events

EventChannelProducerHandlingIdempotency
StockAdjustedwarehouse.stock.v1Warehouse serviceUpdate on-hand quantityEvent ID stored for 7 days
OrderCancelledorders.order.v1Orders serviceRelease confirmed reservationReservation state check
[Event][Channel][Producer][Handling][Method]

5. Data owned

DataStoreClassificationRetentionShared how
ReservationsExample: PostgreSQL inventory_reservationInternal90 days after expiry or confirmationAPI and events only
Available-to-promise per SKURedis (derived, rebuildable)InternalLiveGET /availability
[Data][Store][Class][Retention][Mechanism]

No other service reads these stores directly. Reporting uses the published events.

6. Dependencies

DependencyTypeCriticalityFailure behaviour
PostgreSQLData storeHardReservations fail with 503; checkout shows "try again"
RedisCacheSoftAvailability served from database at higher latency
Message brokerMessagingSoftEvents buffered in outbox up to [6 hours]
Catalogue serviceAPISoftCached SKU list
[Dependency][Type][Hard / Soft][Behaviour]

7. Service level objectives

SLISLOWindowMeasured at
Availability of POST /reservations99.95% non-5xx28 days rollingGateway
Latency of POST /reservations99% under 150 ms28 days rollingGateway
Expiry accuracy99.9% of holds released within 60 s of expiry28 daysService metric
[SLI][SLO][Window][Point]

Error budget for availability in a 28-day window:

B=(1−0.9995)×28×24×60≈20 minutesB = (1 - 0.9995) \times 28 \times 24 \times 60 \approx 20\ \text{minutes}

8. Scaling and capacity

ItemValue
Expected loadExample: 120 reservations/s average, 900/s at sale start
Scaling modelHorizontal; stateless pods; HPA on CPU 60% and request rate
ReplicasMin 3 (one per zone), max 30
Known limitSingle hot SKU above 2,000 reservations/s contends on one row; mitigated with sharded counters
Load testLast run YYYY-MM-DD at 1,500 reservations/s

9. Configuration

KeyPurposeDefaultSource
HOLD_TTL_SECONDSReservation hold time900Environment
MAX_QTY_PER_RESERVATIONAbuse limit per request20Feature flag service
DB_URLDatabase connectionnoneSecrets manager inventory/db
CATALOGUE_BASE_URLCatalogue APIper environmentEnvironment
[KEY][Purpose][Default][Source]

10. Deployment

ItemValue
RuntimeExample: Container on Kubernetes, namespace inventory
Pipeline[CI system] build, test, scan, sign, deploy to staging, canary 10% for 15 min, full rollout
Environmentsdev, staging, production (two regions)
RollbackAutomatic on canary error rate above 1%; manual via [deploy tool] rollback
Database migrationsExpand and contract; run as a pre-deploy job
Release frequencyDaily

11. Observability

SignalWhereKey items
Metrics[Dashboard link]Request rate, error rate, p99 latency, active holds, expiry lag
Logs[Log query link]Structured JSON; fields reservation_id, sku, trace_id
Traces[Tracing link]Spans for database, cache, catalogue calls
Alerts[Alert rules link]SLO burn rate (fast and slow), expiry lag above 120 s, outbox age above 5 min
Runbook[Runbook link]One section per alert

12. Security

TopicControl
Inbound authenticationOAuth 2.0 tokens validated at gateway and service; mTLS in mesh
AuthorisationScope per endpoint (3.1); reservations can only be confirmed by Orders
Outbound identityWorkload identity; no static credentials
DataNo personal data stored; reservation references checkout session ID only
AbusePer-session limit of [5] active reservations; quantity cap
DependenciesImage and dependency scanning in CI; critical fixes within [7] days

13. Versioning and compatibility

ContractVersioningCompatibility promiseDeprecation notice
REST APIMajor version in path (/v1)Additive changes only within a major version[6 months], Deprecation header (RFC 9745, March 2025) and Sunset header (RFC 8594, May 2019)
EventsMajor version in channel nameRegistry enforces backward-compatible schemas[6 months] dual publishing
Service releaseSemantic versioning of the buildn/aRelease notes in [link]

Example headers on a deprecated /v1 response. RFC 9745 carries a structured-field date (seconds since the epoch, prefixed with @), while Sunset uses the HTTP date format:

Deprecation: @1798761599
Sunset: Thu, 30 Jun 2027 23:59:59 GMT
Link: <https://developer.example.com/inventory/v2-migration>; rel="deprecation"; type="text/html"

14. Related documents

DocumentLinkTemplate in this library
REST API specification[link]architecture/rest-api-specification
gRPC service specification (if any)[link]architecture/grpc-service-spec
Event API specification[link]architecture/event-api-specification
Event sourcing design (if used)[link]architecture/event-sourcing-cqrs
Bounded context canvas[link]architecture/bounded-context-canvas
Team API[link]architecture/team-api
Architecture decision records[link]architecture/adr-full
SLO document[link]dev/slo-doc
Runbook[link]dev/runbook
Threat model[link]security/threat-model

15. References

IDReferenceVersion or dateLink
R-01Chris Richardson, Documenting a service using the microservice canvas (microservices.io)February 2019; checked October 2026https://microservices.io/post/microservices/general/2019/02/27/microservice-canvas.html
R-02OpenAPI Specification3.2.1, 10 September 2026https://spec.openapis.org/oas/v3.2.1.html
R-03AsyncAPI Specification3.1.0https://www.asyncapi.com/docs/reference/specification/v3.1.0
R-04RFC 9745, The Deprecation HTTP Response Header FieldMarch 2025https://www.rfc-editor.org/rfc/rfc9745.html
R-05RFC 8594, The Sunset HTTP Header FieldMay 2019https://www.rfc-editor.org/rfc/rfc8594.html
R-06Google, The Site Reliability Workbook, Alerting on SLOs (error budget burn rate)Checked October 2026https://sre.google/workbook/alerting-on-slos/

Standard and licence note

Based on the Microservice Canvas described by Chris Richardson on microservices.io (R-01), summarised in original words, and on common service catalogue practice. Contract formats are cited by version (OpenAPI 3.2.1, AsyncAPI 3.1.0, RFC 9745, RFC 8594, as listed in October 2026); check the current versions on spec.openapis.org, asyncapi.com and rfc-editor.org before use. Original text written for this collection; Marrowby Home and all example values are fictional. Template licence: MIT.

Related templates