Marketplace Database Schema (SQL + ERD + Prisma)

Output

SQL schema sample

CREATE TABLE users (id UUID PRIMARY KEY, email TEXT UNIQUE NOT NULL);
CREATE TABLE listings (id UUID PRIMARY KEY, seller_id UUID REFERENCES users(id), title TEXT NOT NULL, price_cents INT NOT NULL);
CREATE TABLE orders (id UUID PRIMARY KEY, listing_id UUID REFERENCES listings(id), buyer_id UUID REFERENCES users(id), status TEXT NOT NULL);
CREATE TABLE payouts (id UUID PRIMARY KEY, order_id UUID REFERENCES orders(id), seller_id UUID REFERENCES users(id), amount_cents INT NOT NULL);

Diagram

users 1---* listings
listings 1---* orders
users 1---* orders (buyer)
orders 1---1 payouts

This structure supports listing lifecycle, purchase flow, and seller payout reconciliation.

Generate your own schema

Generate your own schema