Appearance
Marketplace Architecture β
A marketplace platform is not one application β it's a system of interconnected services that independently manage supply, demand, matching, transactions, and trust across two sides of a market.
Why This Matters β
- π’ Owner: Architecture decisions made in the first year determine how fast you can iterate, how reliably you handle peak load, and how expensive it is to operate. Bad architecture becomes visible when it starts costing you money and speed.
- π» Dev: You need to build systems where supply-side changes (new listings, availability updates) and demand-side actions (searches, bookings, purchases) can evolve independently. The architecture must handle the unique complexity of coordinating two-sided transactions.
- π PM: Understanding architectural boundaries helps you plan features that span multiple services, estimate timelines accurately, and avoid scope creep from hidden dependencies.
- π¨ Designer: Architecture defines what data is available on each screen and how fast it loads. The constraints your engineers face directly shape what UX you can design for both buyers and sellers.
The Concept (Simple) β
Think of a marketplace like a busy farmers market in a town square.
You don't build one giant building to handle everything. Instead, you have separate areas: a section where farmers set up stalls (supply service), an area where shoppers browse and buy (demand service), a central information board that helps shoppers find what they need (search and matching), a cashier station where money changes hands (payment service), and a security office that handles disputes and safety (trust service).
Each area operates independently. If the cashier line gets long, you add more cashiers β you don't rebuild the entire market. If you want to add a new type of stall, you modify the supply area without touching the cashier station.
In one sentence: Marketplace architecture separates the platform into independent services for supply, demand, matching, payments, and trust so each can evolve and scale on its own.
How It Works (Detailed) β
High-Level Marketplace Architecture β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β MARKETPLACE PLATFORM ARCHITECTURE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β BUYER APP β β SELLER APP β β ADMIN β β
β β (Web/Mobile) β β (Web/Mobile) β β DASHBOARD β β
β ββββββββ¬ββββββββ ββββββββ¬ββββββββ ββββββββ¬ββββββββ β
β β β β β
β ββββββββͺββββββββββββββββββββͺββββββββββββββββββββͺββββββββββββ β
β β API GATEWAY β β
β ββββββββͺββββββββββββββββββββͺββββββββββββββββββββͺββββββββββββ β
β β β β β
β ββββββββ΄ββββββββ ββββββββ΄ββββββββ ββββββββ΄ββββββββ β
β β SEARCH & β β LISTING β β USER β β
β β DISCOVERY β β SERVICE β β SERVICE β β
β β β β β β β β
β β β’ Query β β β’ CRUD β β β’ Auth β β
β β β’ Ranking β β β’ Media β β β’ Profiles β β
β β β’ Filters β β β’ Categories β β β’ Verify β β
β β β’ Recommend β β β’ Inventory β β β’ Roles β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β TRANSACTION β β PAYMENT β β MESSAGING β β
β β SERVICE β β SERVICE β β SERVICE β β
β β β β β β β β
β β β’ Orders β β β’ Checkout β β β’ Inbox β β
β β β’ Bookings β β β’ Escrow β β β’ Threads β β
β β β’ State β β β’ Payouts β β β’ Notifs β β
β β β’ Fulfillmentβ β β’ Refunds β β β’ Templates β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β REVIEW β β TRUST & β β ANALYTICS β β
β β SERVICE β β SAFETY β β SERVICE β β
β β β β β β β β
β β β’ Ratings β β β’ Fraud β β β’ Events β β
β β β’ Reviews β β β’ Moderation β β β’ Metrics β β
β β β’ Responses β β β’ Disputes β β β’ Reports β β
β β β’ Scores β β β’ Compliance β β β’ Dashboards β β
β ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββMonolith vs Microservices: What to Start With β
Most marketplaces should start monolith, extract services as needed:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ARCHITECTURE EVOLUTION β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β STAGE 1: Monolith (Day 0 - ~$1M GMV) β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β Single application β β
β β Single database β β
β β Fast to build, easy to deploy β β
β β All features in one codebase β β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β STAGE 2: Modular Monolith (~$1M - $10M GMV) β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β Single deployment, but internal β β
β β modules with clear boundaries β β
β β Extract payments & search first β β
β β Shared database with schema separation β β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β β
β βΌ β
β STAGE 3: Services (~$10M+ GMV) β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β Extract services along domain lines β β
β β Independent deployment and scaling β β
β β Event-driven communication β β
β β Service-specific databases β β
β βββββββββββββββββββββββββββββββββββββββββββ β
β β
β Rule: Don't extract a service until you feel the pain β
β of it being coupled. β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββCore Domain Services β
1. Listing Service β
Manages everything sellers create and maintain:
| Responsibility | Details |
|---|---|
| CRUD operations | Create, read, update, delete listings |
| Media management | Photo/video upload, processing, CDN delivery |
| Categorization | Taxonomy, tagging, attribute schemas per category |
| Inventory | Stock levels, availability calendars, booking windows |
| Pricing | Fixed pricing, dynamic pricing, promotional pricing |
| Versioning | Draft vs published, edit history, moderation queue |
2. Search and Discovery Service β
The matching engine between supply and demand:
| Responsibility | Details |
|---|---|
| Indexing | Real-time index of all active listings |
| Query processing | Parse, expand, spell-correct, intent detection |
| Ranking | Multi-factor scoring (relevance, quality, personalization) |
| Filtering | Faceted search, geo-filtering, availability filtering |
| Recommendations | "Similar to", "You might like", "Popular near you" |
Tech choices: Elasticsearch or Algolia for search, Redis for caching, ML models for personalization.
3. Transaction Service β
Orchestrates the lifecycle of orders and bookings:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TRANSACTION STATE MACHINE β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β CREATED βββββΆβ PENDING βββββΆβ CONFIRMEDβ β
β ββββββββββββ ββββββββββββ ββββββ¬ββββββ β
β β β β β
β βΌ βΌ βΌ β
β ββββββββββββ ββββββββββββ ββββββββββββ β
β β EXPIRED β β REJECTED β β IN β β
β ββββββββββββ ββββββββββββ β PROGRESS β β
β ββββββ¬ββββββ β
β β β
β ββββββββββββββΌβββββββββββββ β
β βΌ βΌ βΌ β
β ββββββββββββ ββββββββββββ βββββββββ
β βCOMPLETED β β DISPUTED β βCANCELββ
β ββββββ¬ββββββ ββββββ¬ββββββ ββββ¬βββββ
β β β β β
β βΌ βΌ βΌ β
β ββββββββββββ ββββββββββββ βββββββββ
β β REVIEWED β β RESOLVED β βREFUNDββ
β ββββββββββββ ββββββββββββ βββββββββ
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ4. Payment Service β
Handles money flow between all parties (see Chapter 21 for deep dive):
| Responsibility | Details |
|---|---|
| Checkout | Payment capture, payment method management |
| Escrow | Hold funds between payment and fulfillment |
| Split payments | Divide payment between seller and platform |
| Payouts | Disburse funds to sellers on schedule |
| Refunds | Full/partial refund processing |
| Compliance | Tax calculation, 1099 generation, KYC |
Event-Driven Architecture β
Marketplace services communicate through events, not direct calls. This keeps services decoupled:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β EVENT-DRIVEN COMMUNICATION β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β Listing Service β
β β β
β β publishes: "listing.created" β
β βΌ β
β ββββββββββββββββββββββββββββββββββββββββ β
β β EVENT BUS / QUEUE β β
β β (Kafka, RabbitMQ, SQS, etc) β β
β ββββ¬βββββββββββ¬βββββββββββ¬βββββββββββββ β
β β β β β
β βΌ βΌ βΌ β
β Search Analytics Notification β
β Service Service Service β
β (reindex) (track) (alert seller) β
β β
β Benefits: β
β β’ Services don't know about each other β
β β’ Adding a new consumer doesn't change the publisher β
β β’ Events can be replayed for debugging β
β β’ Services can fail independently β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββAPI Design for Two-Sided Platforms β
Marketplaces need separate API surfaces for each audience:
| API Surface | Consumers | Key Endpoints |
|---|---|---|
| Buyer API | Buyer web/mobile apps | Search, listing detail, booking, checkout, reviews |
| Seller API | Seller web/mobile apps | Listing management, orders, analytics, payouts |
| Admin API | Internal tools | Moderation, disputes, user management, reporting |
| Public API | Third-party integrations | Listing syndication, booking widgets, data feeds |
| Webhook API | External systems | Event notifications for partners and integrations |
Database Strategy β
| Service | Database Type | Why |
|---|---|---|
| Users/Listings | PostgreSQL (relational) | Structured data, complex queries, ACID transactions |
| Search | Elasticsearch | Full-text search, geo-queries, faceted filtering |
| Messaging | MongoDB or Cassandra | High write volume, flexible schema, time-series |
| Sessions/Cache | Redis | Low latency, ephemeral data, real-time counters |
| Media | S3 + CDN | Blob storage, global distribution, cost-effective |
| Analytics | ClickHouse or BigQuery | Columnar storage, fast aggregations, large datasets |
| Events | Kafka | Ordered event log, replay capability, high throughput |
In Practice β
What Good Looks Like: Airbnb's Architecture Evolution β
- 2008-2012: Monolith β Ruby on Rails monolith, single MySQL database. Fast to build, got them to product-market fit.
- 2012-2016: SOA transition β extracted search, payments, messaging into separate services. Enabled team autonomy.
- 2016-present: Microservices β hundreds of services, event-driven communication, dedicated search infrastructure. Supports billions in GMV.
Key lesson: They didn't start with microservices. They earned the right to add complexity by growing into it.
What Good Looks Like: Uber's Real-Time Architecture β
- Dispatch service β matches riders with drivers in real-time using geo-spatial indexing
- Surge pricing service β dynamically adjusts pricing based on supply/demand ratio per zone
- ETA service β calculates arrival times using real-time traffic and driver location data
- Trip service β manages the state machine of a trip from request to completion to payment
Common Anti-Patterns β
- Premature microservices β splitting into 20 services before you have 20 engineers. Start monolith, extract when it hurts.
- Shared database β multiple services reading/writing the same database tables creates invisible coupling and deployment nightmares.
- Synchronous everything β making service A call service B call service C in a chain. One slow service brings everything down. Use events.
- Ignoring the two-sided nature β building one unified data model when buyers and sellers have fundamentally different needs and access patterns.
- No API versioning β breaking mobile apps with backend changes because you didn't version your APIs from the start.
- Skipping the event bus β directly connecting services instead of using an event system, creating a tangled web of dependencies.
Technology Stack Recommendations β
| Layer | Early Stage | Growth Stage | At Scale |
|---|---|---|---|
| Backend | Rails, Django, Next.js | Node.js, Go, Java | Polyglot per service |
| Database | PostgreSQL | PostgreSQL + Redis + Elasticsearch | Per-service databases |
| Search | PostgreSQL full-text | Elasticsearch | Elasticsearch + ML ranking |
| Queue | Redis/Sidekiq | RabbitMQ or SQS | Kafka |
| Storage | S3 | S3 + CDN | S3 + multi-region CDN |
| Hosting | Heroku, Railway | AWS/GCP with containers | Kubernetes |
| Payments | Stripe Connect | Stripe Connect | Custom + Stripe/Adyen |
Key Takeaways β
- Start with a monolith and extract services only when you feel the pain of coupling β premature microservices add complexity without value
- The core marketplace services are: listings, search, transactions, payments, messaging, reviews, trust, and analytics
- Use event-driven architecture to keep services decoupled β publish events, let consumers decide what to do with them
- Design separate API surfaces for buyers, sellers, and admins β they have fundamentally different data needs
- The transaction service is the heart of the marketplace β model it as a state machine with clear transitions and failure handling
- Choose your database per service based on access patterns, not one-size-fits-all
- Payments should be extracted early β it's complex, regulated, and needs to be rock-solid
- Plan for separate scaling of each side β buyer traffic patterns differ from seller patterns
Action Items β
- β π’ Owner: Align on architecture stage (monolith vs modular vs services) based on current team size and GMV
- β π’ Owner: Budget for search infrastructure β it's the highest-leverage technical investment for marketplace conversion
- β π» Dev: Define clear domain boundaries for your core services (listings, search, transactions, payments, messaging)
- β π» Dev: Implement an event bus from day one, even in a monolith β it makes future extraction dramatically easier
- β π PM: Map features to services so you understand cross-service dependencies when planning sprints
- β π PM: Create an API contract between buyer-facing and seller-facing teams to prevent blocking
- β π¨ Designer: Understand data availability per service β know what loads fast (cached) vs slow (computed) so you can design loading states accordingly
- β π¨ Designer: Design for both sides independently β buyer and seller experiences should feel like purpose-built apps, not one app with a role toggle