ShipStack
Back to blog
TutorialsFebruary 14, 20257 min read

How to Build a Marketplace Backend Without a Team

Marketplaces need complex backends: dual auth flows, product CRUD, image storage, and data isolation. Here's how to build it all with a unified API.

The marketplace backend challenge

Marketplaces are among the most complex web apps to build. Unlike a simple SaaS with one user type, a marketplace has buyers and sellers with different auth flows, data access patterns, and features.

A typical marketplace backend needs dual registration flows, product listings with complex filtering, image management with thumbnails and CDN delivery, reviews and ratings, search and discovery, and transaction management.

Building all of this from scratch typically takes a team of 2-3 engineers several months. With a BaaS approach, a solo developer can have the foundation running in a weekend.

Setting up dual auth flows

Marketplaces need role-based authentication. With ShipStack, handle this through user metadata:

Register a buyer: POST /api/auth/register with metadata { role: 'buyer', name: 'Alice' }. Register a seller: POST /api/auth/register with metadata { role: 'seller', business_name: "Alice's Shop", verified: false }.

After login, check the user's role metadata to determine which dashboard to show. Enforce role-based access in your frontend: only sellers can create listings, only buyers can leave reviews.

Building the product catalog

Create a products table with columns: id, seller_id, title, description, price, category, status, images (JSON array of URLs), created_at.

Seller creates a listing: POST /api/db/products with the product data. Buyer browses with filters: GET /api/db/products?status=active&category=home&price_lte=50&order=created_at.desc&limit=20.

The API handles filtering, pagination, and ordering. Your frontend constructs the query string based on user selections. No custom backend routes needed.

Managing product images

Product images are critical for marketplace conversion:

1. Seller selects photos in the listing form. 2. Frontend uploads each photo: POST /api/storage/products with the file. 3. ShipStack returns a signed URL for each uploaded image. 4. Frontend includes the image URLs in the product creation request. 5. Buyers see images loaded from CDN-backed URLs.

For thumbnails, use client-side compression (browser-image-compression) before upload, or configure your storage provider's image transformation features.

Scaling to multiple marketplaces

If you're building a marketplace platform, you need each marketplace to be a separate tenant with isolated data.

ShipStack's multi-tenant model handles this perfectly: create a new tenant for each marketplace, each with its own users, products, and transactions. Usage tracking is per-marketplace for billing. Different marketplaces can even use different database providers.

Your frontend reads the tenant slug from the URL (marketplace-a.yourapp.com) and includes it in the X-Tenant-Slug header. This architecture scales from one marketplace to hundreds without backend code changes.

marketplacebackendtutorialmulti-tenantShipStack

Ready to ship your backend?

Free to start. No credit card required. Connect your first provider in under 5 minutes.

Get Started Free