How zihadm654/multi-ecommerce works
ShopStack is a multi-tenant marketplace starter combining a customer storefront, vendor workspace, and admin console. Customers browse products, manage a cart, check out, and track orders; vendors operate shops and inventory, while admins oversee tenants and global catalogs. The architecture separates routed UI, domain-facing hooks and server functions, and shared persistence/authentication. README capabilities fill in branches whose implementation was not sampled; specific internal call paths are shown only where the provided excerpts or index support them.
Main entry points: router.tsx App router · functions Server functions · (store) Store routes · (vendor) Vendor routes
Components 25
Application entry
- App router
src/router.tsx - Store routes
src/routes/(store) - Vendor routes
src/routes/(vendor) - Admin routes
src/routes/(admin)
Customer storefront
- Browse catalog
src/components/templates/store - Product details
src/components/templates/store/product-details-template.tsx - Cart
src/components/templates/store/cart/cart-template.tsx - Checkout
src/components/templates/store/checkout/checkout-template.tsx - Customer accounts
src/components/templates/store/accounts - Order tracking
src/components/templates/store/order
Vendor workspace
- Shop operations
src/components/containers/vendors - Vendor catalog
src/components/containers/vendors/products
Admin console
- Platform oversight
src/components/templates/admin - Tenant management
src/components/templates/admin/tenants
Services and data
- Server functions
src/lib/functions - Review operations
src/lib/functions/store/review.ts - Review queries
src/lib/helper/review-query-helpers.ts - Neon Postgres
src/lib/db/index.ts - Authentication
src/lib/auth.ts - Payment webhook
src/routes/api/webhooks/stripe.ts - Email delivery
src/lib/email.ts
Other components
- Customer
- Vendor user
- Admin user
- Stripe
Connections 28
- Customer → App router: opens app
- App router → Store routes: routes requests
src/router.tsx - Store routes → Browse catalog: renders storefront
src/routes/(store)/_layout/my-reviews.tsx - Browse catalog → Product details: opens products
- Product details → Cart: adds to cart
- Cart → Checkout: starts checkout
- Checkout → Stripe: submits payment
- Checkout → Order tracking: confirms order
- Customer → Customer accounts: manages account
- Vendor user → App router: opens workspace
- App router → Vendor routes: routes requests
- Vendor routes → Shop operations: renders workspace
- Shop operations → Vendor catalog: manages inventory
- Admin user → App router: opens console
- App router → Admin routes: routes requests
- Admin routes → Platform oversight: renders console
- Platform oversight → Tenant management: manages tenants
- Store routes → Server functions: calls server logic
- Vendor routes → Server functions: calls server logic
- Admin routes → Server functions: calls server logic
- Server functions → Neon Postgres: reads and writes
src/lib/functions/store/review.ts - Product details → Review operations: loads reviews
- Review operations → Review queries: uses queries
src/lib/functions/store/review.ts - Review queries → Neon Postgres: queries reviews
src/lib/helper/review-query-helpers.ts - Review operations → Neon Postgres: updates reviews
src/lib/functions/store/review.ts - Server functions → Authentication: uses authentication
- Stripe → Payment webhook: sends events
- Server functions → Email delivery: sends notifications