Design car rental schema and APIs
RetoolSoftware Engineer · Technical ScreenLast updated
This question evaluates data modeling, transactional integrity, concurrency control, REST API and workflow design, and system scalability within the car rental domain in the System Design category.
Design a car rental platform focusing on core entities, relational database schema, and API interfaces. Define key entities and relationships (e.g., customer, vehicle, vehicle_type, branch/location, inventory/unit, reservation, rental/contract, payment, pricing rule, promotion, insurance, availability/hold, staff, damage report). Propose table definitions with primary/foreign keys, unique constraints, and essential indexes (e.g., availability lookups by location and date). Describe workflows and consistency requirements for: search availability by location and date/time windows; create/modify/cancel reservation with holds to prevent double-booking; pick-up (vehicle assignment, contracts, inspection) and return (mileage, fuel, damage, late fees); pricing (base rate, mileage, insurance add-ons, taxes, promotions); payments (authorization, capture, refunds). Provide 3–5 representative REST endpoints with request/response fields (e.g., POST /search, POST /reservations, PATCH /reservations/{id}, POST /rentals/{id}/return). Discuss idempotency, pagination, authentication/authorization, concurrency control (row locks or optimistic versioning), and a plan to scale (read replicas, partitioning by branch/region, caching hot availability queries).
Solution walkthrough is for members
Get the full walkthrough with reference code and complexity analysis, plus Kitty Coach at 300 messages a day. Hints, the code runner and community answers stay free.