System Design Atlas

Rental and sharing system

06 / 10Worked example

The overall architecture

How do the building blocks work together on a booking?

We track a booking through the building blocks and then zoom into the rental API. The database maintains the binding state; a worker processes permanently stored follow-up orders in the background.

Starting point From Step 5: States, Transaction and Outbox keep R-17 locally consistent; external calls start only after commit.

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.

Track R-17 through architecture

Active location · Miet-API + SQLAPI rules and commit

The rental API checks K-17 and stores the hold for R-17 together with the payment order in SQL. Only the commit makes both entries binding.

Local transaction ends here
Web / mobile appSearch, booking and rental status
HTTPS · Requests and Status
Rental APIBooking rules, eligibility and status
SQLHold + Order
SQL Relational DatabaseOccupation, use and outbox for subsequent orders
SQL · Read orders, save results
WorkerExecute, repeat and reconcile
HTTPSProvider commands
External providersVerification · Payment · Access · Notifications
HTTPS · Webhooks to the rental API
Own application Binding data Clients / External Services

The emphasis follows the technical transitions: local data first becomes binding, then the worker continues to work, then the API reads the verified output.

The worker stores the provider’s result and confirmation together under condition and deadline review. The API reads the stored status.

Divide the rental API into technical components

Interior view · C4 components

Rental API

Modular monolith
Domain modules with joint release
HTTP input and order controlAccept app requests and webhooks · Check input · Call domain modules
Calls up the agreed interfaces of the domain modules
Availability and BookingSearch for vehicles · Secure occupancy · Confirm reservations
Eligibility and verification statusExamine person and valid evidence · Assign provider references
Use and vehicle accessTakeover and return control · Grant release orders
Payment and settlementDetermine costs · Assign payment orders and results
Booking and use Permission
Request the valid authorization via the module interface.
Utilisation Settlement
Passes confirmed usage times for completion.
SQL Access and Transaction ControlEach domain module manages its data. Corresponding changes and follow-up orders are stored together.
SQL · Read domain data · Store the change and outbox entry in one transaction

SQL Relational Database

Booking datastoreOccupation, use and order status
Transactional OutboxPermanently stored subsequent orders

A commit confirms the business change and its subsequent order together.

Read Outbox
Save results
Worker & Provider AdaptersRun after commit · Repeat safely · Reconcile results

The worker runs outside the rental API and calls providers for verification, payment, vehicle access and shipping. API and Worker are part of the backend; the domain modules use common rules and are published together.

The domain modules work behind the HTTP input. Their data access logic protects local changes; the worker takes care of external follow-up work.

Mapping domain responsibilities to runtime components

Further reading
Overview of the subsystemTechnical implementation
Availability and BookingSame-named domain module in the rental API; the SQL database stores the binding occupancy.
Identity verificationThe Eligibility & Verification Status module manages validity and proofs. The worker connects the testing provider via an adapter.
Payment and settlementSimilar domain module for costs and payment status; the worker executes payment orders via a provider adapter.
Vehicle accessThe Usage & Vehicle Access module checks the process and requests authorizations. The worker takes over the call of the access provider.
NotificationsDomain modules store notification jobs after state changes. The worker passes them to the notification adapter.

Availability and Booking

Technical implementation
Same-named domain module in the rental API; the SQL database stores the binding occupancy.

Identity verification

Technical implementation
The Eligibility & Verification Status module manages validity and proofs. The worker connects the testing provider via an adapter.

Payment and settlement

Technical implementation
Similar domain module for costs and payment status; the worker executes payment orders via a provider adapter.

Vehicle access

Technical implementation
The Usage & Vehicle Access module checks the process and requests authorizations. The worker takes over the call of the access provider.

Notifications

Technical implementation
Domain modules store notification jobs after state changes. The worker passes them to the notification adapter.

Each domain module is responsible for its rules and data. Other modules use its agreed interface. The HTTP input accepts requests and translates results into API responses; the domain decisions remain in the responsible modules.

Connect booking changes and follow-up orders reliably

Further reading
Run domain modules within a modular monolith
Booking, authorization, use and billing remain separate responsibilities within the same application. They are jointly developed and published. The module boundaries facilitate changes, while calls within the API do not require an additional network connection. The worker uses the same business rules for processing in the background.
Secure change and follow-up order in the transactional outbox
A new hold and the subsequent payment release order are stored in the same SQL transaction. This commonly stored order table is the transactional outbox. A commit confirms both entries; a rollback discards both. Thus, after a process failure, it remains visible which subsequent orders still have to be executed.
Execute stored orders outside of the API
The worker reads confirmed outbox entries and calls external providers via adapters. It stores results and performs a comparison in the case of unclear outputs. A failure after the provider call can lead to a repetition; stable order keys and idempotency therefore protect against dual effects. Webhooks reach the responsible modules via the HTTP input of the rental API.
Start with order table and worker
This design uses the outbox principle for permanently stored follow-up orders and executes them directly via a worker. An additional communications broker is checked if a corresponding load or distribution requirement is met. In the classic outbox pattern, a forwarding process takes over the transfer to such an intermediary.

Terms in this step

Modular monolith
A jointly published application with clearly defined domain modules. In the rental API, booking, authorization, use and billing each assume their own rules and data.
Transactional Outbox
A domain change and its follow-up job are stored in a database transaction. Here, a worker reads the confirmed orders; their execution must safely handle repetitions.

Try it yourself

Assign these tasks: check authorization, permanently store R-17 and follow-up order, call the payment provider. Who continues the process after an API crash?

A hint for your attempt

Differentiate request processing, binding datastore and background work.

Compare with a possible solution
Rental API
It checks requests, authorizations and business rules and initiates the local transaction.
SQL database
It stores R-17 and follow-up orders together and protects the occupancy rule for competitors.
Worker
The worker reads the committed follow-up job and calls the provider with A-17. So the work remains findable after an API crash.

Apply to your project

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

Step 7 shows the temporal reservation process between API and Worker and plays through an error case with delayed feedback.