Design a platform for handling complaints about product quality, including photos, returns, and disputes between sellers and buyers.
Asked at
AI answer
Architecture
I would divide the platform into client applications (buyer, seller, operators) and a backend API. For the first version, I’d use a modular monolith with clearly defined domain boundaries; as the load grows, the most heavily loaded parts can be split out into services.
Main modules:
- Complaints: create a case, product, order, defect description, deadlines, and statuses.
- Media: upload and store photos, validate format and size, and generate thumbnails.
- Returns: check return eligibility, create a request, and integrate with payment and logistics systems.
- Disputes: exchange arguments and evidence, reach a seller decision or escalate to an operator, and maintain an activity log.
- Notifications: email, push, or SMS notifications about status changes and new messages.
Processing flow
- The buyer creates a complaint and attaches photos.
- The backend checks the order and return rules, saves the case, and issues a temporary file upload link.
- Files are stored in object storage; an asynchronous task checks the file type, size, and malicious content, then creates safe previews.
- The seller is notified and responds or offers a return/refund.
- If the parties cannot reach an agreement, the case is escalated to an operator. The decision is recorded along with its author, timestamp, and rationale.
- The return is processed through external systems using an idempotent request; integration failures are retried or sent to a manual processing queue.
Data and reliability
A relational database is suitable for orders, complaints, messages, statuses, and audit records: transactions and relationships are needed. Photos are better stored in object storage, with the key, size, type, and checksum kept in the database. Status-change events and requests to external systems are processed through a queue; a transactional outbox can be used to maintain consistency between the database and the queue. Return and complaint-creation operations must be idempotent.
Define an explicit state machine, for example: New → Awaiting seller → Awaiting buyer → Under review → Resolved/Closed. Transitions are validated on the server. Long-running processes need timeouts, reminders, and escalation.
Security and operations
- Check access permissions at the case level: buyers can see their own complaints, sellers can see only those related to their orders, and operators can access cases within their assigned permissions.
- Use TLS, storage encryption, time-limited links to photos, and antivirus scanning. Do not trust the MIME type provided by the client; limit the size and number of files.
- Maintain an immutable audit trail of decisions and actions involving personal data; establish retention and deletion periods.
- Metrics: seller response time, escalation rate, return duration, upload errors, and integration errors. Add centralized logs, tracing, and alerts.
- Deploy through CI/CD with tests, database migrations, staging, and gradual releases; maintain backups and tested recovery procedures.
At the start, correct statuses, auditing, secure handling of photos, and reliable return integrations matter more than prematurely splitting the system into many microservices.
Also asked at Andersen
- Which company did you work for and what projects did you handle?
- How do you work with Linux at the system administration level?
- What databases do you have experience working with?
- How is a container built and run from a Dockerfile?
- How did you deploy the Kubernetes cluster and how did you manage it? What tools did you use for rollout?
Similar questions
- Design a platform for processing content complaints, with appeals and prioritization, that ensures no complaint is lost in the event of a failure.
- Design a platform for exchanging and selling event tickets with protection against scalping and fraud.
- Design a system for analyzing customer reviews in 50 languages, with moderation, topic categorization, and prevention of rating manipulation.
- Design a platform for sharing and selling photographs with watermarks, licenses, and protection against unauthorized use.
- Design a food delivery platform with estimated delivery times, dynamically assigned couriers, and compensation for late deliveries.