Design a multi-tenant course purchase and delivery system
Company: MathWorks
Role: Software Engineer
Category: System Design
Difficulty: medium
Interview Round: Take-home Project
Design a **multi-tenant online course purchasing and delivery system** with the following requirements.
## Domain model / requirements
- There are multiple **Companies** (tenants).
- Each company has multiple **Organizations**.
- Each organization has multiple **Members**.
- The platform hosts multiple **Courses**.
- Each course can have **prerequisites** (other courses) that must be completed/owned before access.
- **Pricing differs by company** depending on the company’s purchased plan/contract (same course may have different prices for different companies).
- A company can buy courses **on behalf of members inside an organization** (e.g., assign seats/licenses).
- New companies, organizations, and members may be created at any time.
- Every member must have a **system-wide unique Member ID**.
- You are given (or can assume existence of) a **class definition** object for a course and a function to query a course’s prerequisites.
## What to design
1. Core APIs (creating companies/orgs/members, browsing courses, purchasing, assigning entitlements, checking access).
2. Data model (multi-tenancy, membership, purchases/entitlements, prerequisite representation).
3. High-level architecture and key services.
4. How course access is enforced (including prerequisite checks).
5. Scalability, consistency, and operational concerns (auditing, retries, idempotency).
Assume typical enterprise needs: high read volume for catalog/access checks, strict correctness for purchases, and reasonable latency for prerequisite queries.
Quick Answer: This question evaluates a candidate's skills in designing scalable multi-tenant architectures, covering data modeling for tenants, organizations, and unique member identities, API design for purchasing and entitlements, access control and prerequisite enforcement, and trade-offs around consistency and high-read performance.