System Design Atlas

Digital lending with limited licences

06 / 10Worked example

The overall architecture

The index grants no permissions. Which conditions enforce this rule?

Search data is derived.

Starting point Release only after confirmed non-issuance or access revocation.

Assumptions for the example case

A fictional library with one licensed copy and reading devices that verify entitlements online. Every new read checks the current entitlement; offline use is outside the scope. All quantities, thresholds and operational targets in this design are illustrative assumptions.

Index alongside licence state

Index alongside licence state

Search interfaceForecast
Lending interfaceLoan + online reading
Lending APIAllocation + entitlement
Relational licence datastoreX-52 · A-52 · Inbox
Licensing workerIssuance + revocation
Indexing workerProjection
Search indexDerived
Licensing serviceExternal
Search interface → Search indexSearch titles
Lending interface → Lending APILoan / return / entitlement check
Lending API → Relational licence datastoreA-52 + X-52 + Inbox
Relational licence datastore → Licensing workerCommitted command
Licensing worker → Licensing serviceIssuance / revocation
Licensing service → Lending APIState for A-52
Relational licence datastore → Indexing workerTitle + availability
Indexing worker → Search indexProjection

The index estimates availability; the API and licence datastore decide allocation; online reads check entitlements through the same API.

Derived search index; authoritative API and datastore; licensing worker connected to the service; explicit online entitlement-check path.

Responsibilities within the application

Lending modules

Title searchNon-binding
Licence allocationAllocate atomically
Entitlement managementCheck online
ReturnReconcile revocation

Search estimates availability; allocation, entitlements and returns maintain licence state.

Internal modules: title search shows titles and non-binding availability; licence allocation atomically reserves an available copy; entitlement management connects loans with confirmed reading rights; returns reconcile revocation and renewed availability. The overall architecture assigns these responsibilities to processes and datastores.

Runtime components and authoritative data

Runtime boundary
Search interface → search index; lending interface → lending API → relational licence datastore. The licensing worker reads committed issuance/return commands → external licensing service; responses → API → the same datastore. Online reads check entitlements through the API. The indexing worker projects titles and availability without authority to allocate copies.
Module responsibilities
Title search: shows titles and non-binding availability. Licence allocation: atomically reserves an available copy. Entitlement management: connects loans with confirmed reading rights. Return: reconciles revocation and renewed availability.

The index does not grant permissions.

The index does not grant permissions.

Online access checks the authoritative entitlement.

Search data is derived.

Projects titles and estimated availability. Sends committed commands; the API checks current rights.

Alternative considered
Treating an old link as permission bypasses returns.
Trade-off
Every access requires verification.
Reassess
Offline mode requires a separate design.

Try it yourself

Assign responsibilities to the indexing and licensing workers.

A hint for your attempt

Search data is derived.

Compare with a possible solution
Indexing worker
Projects titles and estimated availability.
Licensing worker
Sends committed commands; the API checks current rights.

Apply to your project

What is the equivalent of an index that grants no permissions in your project?

Step 7: a return waits for access revocation. Which conditions enforce this rule?