Skip to content
Sellzy

REST API

The Express 5 + TypeScript API on MongoDB, in apps/api.

apps/api serves every app: storefront, admin, seller panel and mobile. It’s Express 5 with TypeScript and Mongoose on MongoDB.

pnpm dev:api      # http://localhost:8000

Interactive docs (Swagger) are at http://localhost:8000/api/docs.

Folders

apps/api/
├── server.ts        app setup, security middleware, routes
├── config/          database and service clients
├── routes/          one router per resource
├── controllers/     request handlers
├── models/          Mongoose schemas
├── middleware/      auth, roles, errors, uploads
├── services/        payments, email, uploads
├── utils/           helpers
├── data/seed/       demo data used by pnpm seed
└── scripts/         seed and maintenance scripts

Resources

About 56 resources, grouped:

  • Auth and users: sign up, sign in, social sign-in, password reset codes, profile, addresses, roles
  • Catalog: products and variants, categories, brands, badges, colors, sizes, weights, reviews, search
  • Buying: cart, wishlist, orders, invoices, coupons, payments (Stripe, cash on delivery, SSLCommerz endpoints)
  • Vendors: applications, vendor products, earnings, withdrawals, analytics
  • CMS: banners, menus, pages, blog, careers, team, FAQs, notifications, website settings, currencies
  • Operations: purchases, suppliers, employees, salaries, system metrics

Security

  • Helmet headers, rate limiting, hpp and mongo-sanitize on every request.
  • JWT sessions with role checks on every protected route.
  • Order totals are priced on the server from the database. The client’s prices are ignored.
  • Stripe webhooks are signature-checked and matched to the order amount.
  • In production, CORS allows only your storefront and admin addresses.

Scripts

Command What it does
pnpm --filter @sellzy/api dev Run with reload
pnpm --filter @sellzy/api build Compile to dist/
pnpm --filter @sellzy/api start Run dist/server.js
pnpm --filter @sellzy/api webhook Forward Stripe webhooks locally

Stuck? Run pnpm check:setup, check Troubleshooting, or contact support.