Product architecture
How MarketSquare is put together
Three consoles, one commerce core. Rules and eligibility flow through a shared engine, so what a buyer, seller, and admin see always reflects the same source of truth.
System map
Buyer console
Discovery, wishlist, cart, checkout, order tracking, reviews, direct messaging, maker discovery map.
Seller console
Storefront management, product CRUD, order fulfillment, analytics, subscription tier, buyer messaging.
Admin console
User & seller verification, categories, disputes, reports, moderation, subscription oversight.
Checkout flow
Add to cart
Address & pay
Rules engine
Fulfillment
Notification
Review
Every step emits an event consumed by the rules engine — eligibility, holds, and messaging are decided here.
Rules engine
Order eligibility
if (seller.verified && product.stock >= qty && !buyer.flagged) {
allow_checkout();
} else if (!seller.verified) {
hold_for_review("SELLER_UNVERIFIED");
} else if (product.stock < qty) {
reject("OUT_OF_STOCK");
}Dispute routing
match dispute.reason:
"damaged" -> open() -> seller_respond(48h)
"not_received" -> auto_refund_hold(72h)
"wrong_item" -> escalate_if_no_response(24h)
default -> route_to_admin()Data model (core)
users
id, name, email, role, verified, status
products
id, sellerId, title, price, stock, status
orders
id, buyerId, sellerId, items[], total, status
threads
id, buyerId, sellerId, subject
messages
id, threadId, fromId, toId, text, at
disputes
id, orderId, reason, status
reviews
id, productId, author, rating, text
categories
id, name, slug, products
subscriptions
sellerId, plan, renews