System Design Atlas

Rental and sharing system

10 / 10Worked example

Final design

What is clear and what remains to be examined?

The overall draft combines our decisions with their reasons and pending examinations. A first prototype makes the core assumptions verifiable; its results lead to the next design iteration.

Starting point From step 9: The operations plan and access checks guide incidents to a verified outcome; R-17 remains traceable via K-17 and provider references.

Assumptions for the example case

Example design: an operator, specifically assigned vehicles, planned periods and a region. Figures are illustrative design assumptions, not company data.

Decision card for R-17

Web / mobile appSearch, booking and rental status
Decision
Informative search, binding reservation.
Test case
Search peak of 46/s with grown data: p95 ≤ 1 s.
Return to an earlier step
Target misses → load profile (3) and diagnosis (8).
HTTPS · Requests and Status
Rental APIBooking rules, eligibility and status
Decision
Check permission and stable app job K-17.
Test case
Reject third-party booking; repetition delivers R-17.
Return to an earlier step
Unclear commitment → Requirements (2), Contract (4).
SQLHold + Order
SQL Relational DatabaseOccupation, use and outbox for subsequent orders
Decision
At most one occupancy; store R-17 and Outbox together.
Test case
Force contention; check failure before and after commit.
Return to an earlier step
Double Occupancy → Conditions and Transaction (5).
SQL · Read orders, save results
WorkerExecute, repeat and reconcile
Decision
Continue stored orders and reconcile the effects of the provider.
Test case
Crash after authorization of A-17: no second effect.
Return to an earlier step
Unclear output → sequence (7), operating plan (9).
HTTPSProvider commands
External providersVerification · Payment · Access · Notifications
Decision
Verify external effect; local deadline remains binding.
Test case
Late authorization: expired and a tracked cancellation.
Return to an earlier step
Contract insufficient → boundary (1), architecture (6).
HTTPS · Webhooks to the rental API
Own application Binding data Clients / External Services

Each test case combines a decision with its next demonstration. The complete expectations and open provider questions are in the deeper areas.

The checks remain outstanding. Their results can change requirements, load assumptions, contracts or conditions of an earlier step.

The architectural decisions and their justification

Further reading
TaskDecision on this draftWhy this choice fits
Processing search and booking requestsA rental API as a modular monolith with clear domain modules.The modules for booking, authorization, use and billing form a jointly operated application. The limited initial scope can thus be implemented with clear responsibilities.
Mandatory management of occupancyA relational SQL database with transactions and protection against competing occupancy.Occupation check, reservation and follow-up order can be jointly secured within a database. The maximum effective occupancy for one vehicle and one time window shall not exceed one occupancy.
Reliably execute follow-up ordersA permanently stored order table and a separate worker.Orders remain after a process failure. Job-claiming rules, stable command keys and status reconciliation allow for continuation after interruptions.
Connecting external providersEncrypted API calls, verified responses and reconciliation of pending commands.Payment, authorization check and vehicle access have their own states and response times. The rental application assigns its results to the correct booking and checks allowed status changes.
Extend the system as demand growsImprove queries and transactions first; check additional building blocks against measured limits.Step 8 specifies the occasions for cache, additional workers, read replicas or a division of the datastore. Every extension requires an expected benefit and an accepted additional effort.

Processing search and booking requests

Decision on this draft
A rental API as a modular monolith with clear domain modules.
Why this choice fits
The modules for booking, authorization, use and billing form a jointly operated application. The limited initial scope can thus be implemented with clear responsibilities.

Mandatory management of occupancy

Decision on this draft
A relational SQL database with transactions and protection against competing occupancy.
Why this choice fits
Occupation check, reservation and follow-up order can be jointly secured within a database. The maximum effective occupancy for one vehicle and one time window shall not exceed one occupancy.

Reliably execute follow-up orders

Decision on this draft
A permanently stored order table and a separate worker.
Why this choice fits
Orders remain after a process failure. Job-claiming rules, stable command keys and status reconciliation allow for continuation after interruptions.

Connecting external providers

Decision on this draft
Encrypted API calls, verified responses and reconciliation of pending commands.
Why this choice fits
Payment, authorization check and vehicle access have their own states and response times. The rental application assigns its results to the correct booking and checks allowed status changes.

Extend the system as demand grows

Decision on this draft
Improve queries and transactions first; check additional building blocks against measured limits.
Why this choice fits
Step 8 specifies the occasions for cache, additional workers, read replicas or a division of the datastore. Every extension requires an expected benefit and an accepted additional effort.

We select programming language, framework and specific database products based on these requirements, provider connections and the knowledge of the team.

With these results, we examine the draft

Further reading
What we are looking atHow we test itWhat results we expect
Protection against double occupancyPerform many reservation attempts for the same vehicle and time window at the same time.At most one effective occupancy is created. The other attempts are clearly rejected.
Continued after a crashInterrupt API or Worker after storage and after successful vendor call.The stored order is resumed. Already executed booking or payment effects are recognized and not triggered again.
Delayed and repeated feedbackSuccessful authorization after the reservation period has expired as well as duplicate or reversed feedback.The expired hold is not confirmed. An existing authorization is cancelled by a tracked order; repeated feedback does not produce additional effects.
Authorised and confirmed vehicle accessCheck a third-party booking, an expired authorization and a missing vehicle response.Unauthorized access is rejected. Without confirmed vehicle approval, the order remains in clarification and the rental is not run as active.
Response times and recoveryRun the load profile from step 3 and test a restore with subsequent provider reconciliation.The agreed response time and recovery goals are met. Open payments and access orders shall be reconciled before re-execution.

Protection against double occupancy

How we test it
Perform many reservation attempts for the same vehicle and time window at the same time.
What results we expect
At most one effective occupancy is created. The other attempts are clearly rejected.

Continued after a crash

How we test it
Interrupt API or Worker after storage and after successful vendor call.
What results we expect
The stored order is resumed. Already executed booking or payment effects are recognized and not triggered again.

Delayed and repeated feedback

How we test it
Successful authorization after the reservation period has expired as well as duplicate or reversed feedback.
What results we expect
The expired hold is not confirmed. An existing authorization is cancelled by a tracked order; repeated feedback does not produce additional effects.

Authorised and confirmed vehicle access

How we test it
Check a third-party booking, an expired authorization and a missing vehicle response.
What results we expect
Unauthorized access is rejected. Without confirmed vehicle approval, the order remains in clarification and the rental is not run as active.

Response times and recovery

How we test it
Run the load profile from step 3 and test a restore with subsequent provider reconciliation.
What results we expect
The agreed response time and recovery goals are met. Open payments and access orders shall be reconciled before re-execution.

These checks are the demonstration plan for later implementation. The design of the example has thus not yet been tested industrially. Limit values and acceptance criteria are specifically agreed before the tests.

We clarify these decisions before implementation

Further reading
Setting Providers and Their Rules
With the intended providers, we clarify the validity of a payment authorization, the handling of repeated calls, the delivery of feedback and the confirmation of a vehicle opening. This results in concrete contracts for the connections.
Agree on rental rules and behaviour in the event of missing connection
Together with the operator, we set rules for delayed returns, transfer buffers and tariff changes. We also clarify how customer service handles an unreachable vehicle and under which conditions manual approval is allowed.
Confirm operational objectives and responsibilities
Expected load, retention periods, tolerable downtime and tolerable data loss are agreed with the operator. For unexplained bookings and technical disruptions, we assign reachable owners and resolution deadlines.

Try it yourself

You can only implement one prototype test case first: the core rule against double occupancy. What input, result and return do you record if the test fails?

A hint for your attempt

Connect the commitment from step 2 to the transaction boundary from step 5. The test must force simultaneous writing attempts.

Compare with a possible solution
Test case
Many requests with different order keys simultaneously reserve the same free vehicle A for 9-12 o’clock.
Expected result
Exactly one effective occupancy is created. The remaining requests receive a clear conflict; repetitions do not generate another order.
Return to an earlier step
In the case of double occupancy, we check Invariant (2), state and lock or database rule (5) as well as the competing execution (7). Then we repeat the test.

Apply to your project

Transfer the decision card to your own project and record the first implementable part together with an open test result.

Implement the first sequence as a prototype and check the open assumptions. Subsequently, revise the relevant design steps.

Start your own design

Choose a small case from your project. The template collects the ten design tasks and leaves space for your sketches, decisions, and open assumptions. You can edit it in your text editor or note-taking app.

Download design template (.md)
Compare the ten tasks with the example case
  1. Purpose and boundary

    Apply the boundary decision to your own project and note which local fact must remain authoritative despite external responses.

    In the example: The application holds the binding booking and rental status. Physical unlocking requires a confirmed response from the access provider.

  2. Requirements

    Transfer the three levels to your own core process and mark which test case shows a domain rejection and which shows a technical failure.

    In the example: Occupancy commitments and vehicle release require authoritative checks. Search displays and notifications can tolerate bounded delay.

  3. Scale estimates

    Transfer the computational chain and the hotspot test to your own project and write about which measurement would later confirm or refute the assumption.

    In the example: We test targeted searches and a shared relational booking datastore using estimated peak load and accumulated data. A separate concurrency test protects the occupancy rule.

  4. Interfaces

    Apply the pattern to your own external call and note which status remains visible if the outcome is uncertain.

    In the example: 201 confirms the persisted hold; 202 confirms an accepted command. confirmed and active arise only after the respective domain checks.

  5. Data and states

    Transfer states, transition conditions, and transaction boundary to your own core item and record an earlier design step to revisit that could test an earlier assumption.

    In the example: For a vehicle and overlapping periods, at most one effective occupancy may exist in held or confirmed. Database constraints or coordinated locks enforce this rule under concurrent requests. Hold confirmation and expiry are coordinated as well; confirmation also checks the expiry time.

  6. Overall architecture

    Transfer the assignment to your own system and mark which module takes the next safe step in the event of a process failure.

    In the example: Additional API instances share the same rules and data. A process failure does not lose follow-up jobs already stored.

  7. Critical flow

    Transfer the error to your own process and note which effect a local rollback cannot take back.

    In the example: The database protects local states. Persisted commands, retryable execution and targeted compensation connect them to external services.

  8. Bottlenecks and trade-offs

    Transfer the chosen diagnostic path to your own architecture and formulate the reading that would trigger a later decision.

    In the example: The rental API, relational database and worker remain the starting point. Search latency, lock waits and job backlog determine which part to improve. Every change receives a reasoned trade-off assessment and fresh measurement.

  9. Operations and security

    Transfer the incident-response process to your own core operation and note which recovery test checks the acceptance before deployment.

    In the example: For every incident, the signal, response, responsible role and business completion criterion are defined. Before deployment, we rehearse alert timing, reachability and data recovery.

  10. Final design

    Transfer the decision card to your own project and record the first implementable part together with an open test result.

    In the example: Find a vehicle → place a time-limited hold → authorise payment → confirm the booking. This first flow connects the app, rental API, SQL database, worker and the selected payment provider's test environment. We use it to test concurrent reservations, process failures and delayed responses. We then add vehicle access, usage and return with their respective checks. The design thus develops step by step into a tested rental system.