Design a service for collaboratively planning trips, with bookings and changes.
Asked at
AI answer
I would divide the system into services for trips, participants and access permissions, bookings, notifications, and supplier integrations. A trip stores the itinerary, dates, and participants; each change is a versioned event or record with its author and timestamp, so we can view the history and resolve conflicts. For concurrent editing, I would use optimistic locking based on the version: the client sends the expected version, and in case of a conflict receives the latest data and is offered the option to merge the changes.
A booking is a separate entity with states such as pending, confirmed, cancelled, and failed. Creation and modification are handled as a durable process: we record the request, call the supplier with an idempotency key, save the result, and handle retries. An external booking cannot be considered part of a single database transaction; timeouts, compensating actions, and status reconciliation are needed. I would publish notification events through a transactional outbox so they are not lost in case of a failure.
For DevOps: containerization, infrastructure as code, CI/CD with tests and migrations, gradual rollout, and the ability to roll back. Metrics and alerts should cover integration errors, latency, failed bookings, and queues; logs and traces should be correlated using an end-to-end correlation ID. Secrets should be stored in a secrets manager, and personal and payment data should be minimized and protected. Initially, a modular application and a queue are sufficient; services should be split out as load and team size grow.
Also asked at Альфа-Банк
- Which company did you work for and what projects did you handle?
- Tell us about your experience deploying and operating Kubernetes clusters.
- Tell us about your professional experience: what have you done and how have you grown professionally?
- Do you have any questions for the company or about the process?
- What programming languages are you familiar with and do you use them for scripting?
Similar questions
- Design a system for collaboratively planning travel itineraries, where changes made by one participant do not disrupt other participants’ bookings.
- Design a service for collaboratively planning family events, with guests, a budget, and changes.
- Design a service for collaboratively planning a wedding, with a budget, guests, vendors, and changes after confirmation.
- Design a service for collaboratively creating and reviewing business plans, with versioning, comments, and roles.
- Design a service for collaboratively planning renovations with contractors, estimates, and changes.