Engineering

Software Design Specification: What to Include, With a Worked Example

Write a software design specification with a refund workflow, interface contract, failure cases, traceability matrix and a practical engineering review checklist.

Share

A software design specification explains how a system will meet its requirements: its components, data, interfaces, decisions, failure handling and verification. A useful specification lets another engineer implement or challenge the design without guessing what happens when requests are duplicated, permissions change or a dependency stops responding.

Start with the riskiest workflow rather than a long list of headings. The worked example here is a fictional merchant refund service. Its design decisions are illustrative, not a claim about an existing payment provider. You can reuse the structure for a booking system, customer portal or internal approval workflow.

Separate requirements from the software design specification

DocumentQuestion it answersRefund example
RequirementsWhat must be true?A refund must never exceed the remaining refundable amount.
Design specificationHow will the system make it true?Reserve the amount atomically before requesting the provider operation.
Acceptance evidenceHow will we verify it?Run concurrent partial-refund requests and inspect the ledger.
A design decision should link back to a requirement and forward to a verification method.

The NASA Software Engineering Handbook describes design documentation covering architectural relationships, interfaces, execution, traceability and decision rationale. Those categories are useful outside aerospace, but the amount of detail should match the system’s risk and the team’s needs. Copying a large organisation’s template does not establish compliance with its standards.

Keep the commercial agreement separate. The software development contract guide covers scope, acceptance, ownership and handover. Your design can reference agreed requirements without silently expanding contractual scope. A new feature discovered during design belongs in a recorded change decision.

Use a compact outline with named decisions

SectionWhat to writeReview question
Scope and constraintsGoals, exclusions, assumptions and dependenciesWhat is intentionally outside this release?
ArchitectureComponents, ownership and trust boundariesWhere is each decision enforced?
Data and stateEntities, invariants and allowed transitionsWhat prevents an impossible state?
InterfacesInputs, outputs, errors and compatibilityCan another team integrate without guessing?
Failure and recoveryTimeouts, retries, reconciliation and rollbackHow does the system recover safely?
Verification and operationsTests, telemetry, rollout and ownershipWhat evidence proves it is ready?
A starting outline. Add detail where an unresolved choice could cause expensive rework or operational harm.

Give the document an owner, version, status and review date. Mark decisions as proposed, accepted or superseded. Place unresolved questions in one register with a responsible person and a deadline. An unanswered question is useful evidence; a polished diagram that hides it is not.

Write explicit exclusions. In this example, the service handles refunds against already settled payments; it does not determine a customer’s legal entitlement, calculate exchange rates or settle chargebacks. Those boundaries prevent engineers from inventing business policy while implementing an endpoint.

One requirement, three pieces of evidence. REQ-04 Business invariant Total completed and reserved refunds cannot exceed the captured amount. DES-07 Design decision Atomic reservation with a per-payment concurrency boundary. TEST-12 Verification Two competing requests cannot reserve the same remaining balance.
Illustrative refund-service design. Keep the reasoning connected.

Describe the refund workflow and its boundaries

The example has four components: an authenticated merchant interface, a refund API, a worker that calls the payment provider, and a reconciliation process that checks uncertain results. The application’s ledger records requests and reserved amounts. The provider remains the source of truth for whether money moved. Specify that distinction before drawing arrows.

The API validates the caller’s tenant, role, payment ownership, currency and requested amount. It creates a refund request and reserves the amount in the same atomic operation. A worker later submits the request to the provider. The browser does not call the provider directly or decide whether a payment belongs to the current merchant.

For this design, every amount is an integer in the currency’s minor unit, with the currency code stored alongside it. Do not assume every currency has two decimal places. Validate positive amounts and supported currencies at the boundary. Define how historical records are interpreted if supported currency rules change.

StateMeaningAllowed next state
RequestedValidated request and amount reservation existSubmitting or Cancelled before submission
SubmittingProvider operation may be in progressSucceeded, Failed or Needs reconciliation
Needs reconciliationOutcome cannot yet be confirmedSucceeded or Failed after evidence
SucceededProvider success is confirmedTerminal for this request
FailedFailure is confirmed; reservation releasedTerminal; any new attempt is a new governed action
Illustrative state machine. A timeout is uncertainty, not proof that the refund failed.

Define cancellation carefully. Once a provider call may have executed, an interface cannot safely promise that cancelling the local job reverses the payment operation. In this example, only a request that has not been submitted can enter Cancelled. Later customer changes require a separate business process.

Specify the interface, including duplicate requests

A useful interface contract states the method, route, authentication, schema, response states and errors. In this example, POST /refunds accepts payment_id, amount_minor, currency and reason_code, plus an idempotency key. The server derives the tenant from authenticated context rather than trusting a merchant identifier supplied by the browser.

Contract caseExample behaviourEvidence to preserve
New valid requestReturn request ID and Requested stateValidated request and reserved amount
Same key and same payloadReturn the same logical requestOriginal request ID
Same key and different payloadReject as a conflictConflict reason without exposing another tenant
Amount exceeds remaining balanceReject before provider submissionCurrent rule and validation result
Provider timeoutKeep uncertain state for reconciliationProvider correlation ID and last attempt
Illustrative API contract. Actual status codes and retention periods must be specified for your implementation.

Scope the idempotency key to the tenant and operation, record a fingerprint of the relevant payload and define retention. A key that expires too soon can allow an old client retry to create another operation. A key reused across unrelated merchants can leak information or block legitimate work. Document the expected retry window and align it with the provider’s actual guarantees.

Concurrent requests need more than idempotency. Two different keys can request two partial refunds against the same balance. The invariant must cover completed refunds plus active reservations, using an appropriate transaction or equivalent consistency mechanism. State what happens when a transaction conflicts and which operations may retry.

Include compatibility rules. Adding an optional response field may be safe for tolerant clients; renaming a state or changing its meaning can break operational logic. Record versioning, deprecation notice and how older clients behave when they encounter a state they do not recognise.

Trace one competing request through the design

Use a concrete trace to make the invariant reviewable. In this fictional USD example, a payment has 10,000 captured cents and 2,000 cents of completed refunds. Request A asks for 6,000 cents while request B asks for 4,000. Both use different idempotency keys. Assume A obtains the reservation first.

StepCompleted / reserved / available, centsExpected decision
Before either request2,000 / 0 / 8,000Both callers must still pass tenant and permission checks
A reserves 6,0002,000 / 6,000 / 2,000Commit request and reservation atomically
B attempts 4,0002,000 / 6,000 / 2,000Reject insufficient refundable balance
A provider request times out2,000 / 6,000 / 2,000Keep reservation; reconcile the uncertain outcome
Provider confirms A succeeded8,000 / 0 / 2,000Move reserved to completed exactly once
Illustrative acceptance trace. If B wins the reservation first, A cannot reserve its full requested amount. No provider call is executed here.

Add the recovery counterexample: if the provider confirms a permanent failure for A, completed refunds remain 2,000 cents, its 6,000-cent reservation is released, and 8,000 cents becomes available. That does not automatically authorise retrying B. Preserve the rejected request and require a deliberate new action under the agreed business rules.

A real provider contract can differ by API generation. For example, Stripe’s idempotent-request documentation says API v1 retries replay the saved response, including a 500 response, after endpoint execution begins. It also describes key pruning after at least 24 hours and different v2 retry behaviour. Record the exact API version and guarantees you integrate with; do not infer permanent duplicate protection from the word “idempotent”.

Make failure handling a first-class part of the design

Consider a worker that sends a refund, then loses its connection before receiving the response. Blindly issuing a fresh refund can duplicate the payment movement. Mark the result uncertain, retain the stable provider reference and reconcile through the provider’s supported lookup or event mechanism. Do not release the reserved amount until the outcome is known under the design’s rules.

A timeout leaves an unanswered question. 1 Record uncertainty Keep the request and amount reservation. 2 Check authoritative state Use the provider’s supported reference and reconciliation path. 3 Apply one transition Confirm success or failure and update the ledger consistently.
Schematic. This is a recovery design, not a provider-specific API promise.

Write down retry eligibility, maximum attempts, backoff, ownership and the manual escalation path. Distinguish a transient network problem from a permanent validation error. A worker that retries forever can hide a broken integration and build an unmanageable queue.

For callbacks, define authenticity checks, duplicate handling, event ordering and how stale events are rejected. Treat callback payloads as untrusted until verified using the provider’s documented method. A delayed event should not move a terminal request backwards. A forged event must not create a successful refund record.

A rollback plan also needs a data view. Reverting application code does not reverse provider payments or automatically undo a schema change. Specify which previous application version can read new records, how queued work is paused, and who approves recovery actions. The production security guide provides adjacent operational checks.

Connect each design claim to a reviewable test

Design claimVerification scenarioPass evidence
Tenant isolationMerchant B requests a refund for Merchant A’s paymentDenied without exposing A’s payment details
Balance invariantConcurrent partial requests exceed the remaining totalOnly allowable reservations commit
Idempotent submissionClient repeats the same request after a timeoutOne logical refund request exists
Recovery correctnessProvider succeeds but response is lostReconciliation reaches Succeeded without a second refund
Operational visibilityReconciliation remains stuckAn owned alert exposes age and request reference
Illustrative test matrix. Tests verify the chosen design; they do not replace review of the provider contract.

Specify performance requirements with a workload, environment and percentile. “Fast” cannot be tested. A proposed API acknowledgement target should name whether it includes provider processing or only local acceptance. Keep unmeasured targets labelled as requirements until a representative test produces results.

Define observability using request IDs, state transitions, queue age, reconciliation age and error categories. Keep secrets, payment credentials and unnecessary personal information out of logs. An alert needs an owner and a runbook; a dashboard alone does not tell an on-call engineer what action is safe.

For a small project, the specification may be short, but it still needs these decisions. Review it with engineering, operations and the person who owns the business rules. Ask each reviewer to trace one normal flow, one rejected request and one uncertain outcome from input to final evidence. Any step that depends on “the developer will figure it out” is a place to improve the document.

Use the software design review worksheet to record the inputs, decisions and checks described here.

What is a software design specification?

It describes how software will meet its requirements through architecture, data, interfaces, behaviour and operational decisions. It should connect important requirements to design choices and verification evidence.

How is it different from an SRS?

A software requirements specification describes required behaviour and constraints. A design specification explains the implementation approach chosen to satisfy them.

How long should a design specification be?

Use enough detail for another engineer to implement and review the risky decisions. Length depends on complexity, interfaces and consequences of failure, not a universal page count.

Should it include code?

Small schemas, interface examples or pseudocode can clarify a decision. Avoid duplicating entire implementations that will quickly drift from the running code.

When should the design be updated?

Update it when accepted decisions, interfaces, invariants or operational assumptions change. Preserve the rationale for superseded decisions so future maintainers understand the history.

Need help building this?

Let our team build it for you.

Dude Lemon builds production-grade web apps, APIs, and cloud infrastructure. Get a free consultation and project proposal within 48 hours.

Start a project