E-commerce marketplace monorepo: a TanStack Start storefront (frontend) and an Express API (backend) backed by MongoDB. Production deployments target a VPS via GitHub Actions and PM2 (see workflow and ecosystem.config.js).
| Directory | Role |
|---|---|
frontend |
TanStack Router + TanStack Start, React 19, Vite, Tailwind CSS, Radix UI |
backend |
REST API (/api/v1), Mongoose, JWT auth, optional Cloudinary for seller uploads |
- Node.js — use 22.12+ for the frontend (see
frontend/package.jsonengines). The backend declares>=20; matching the frontend version avoids surprises. - MongoDB — connection string required for the API.
- Optional: PM2 for process management on a server (
ecosystem.config.jsdefinesnexus-backendandnexus-frontend).
cd backend
cp .env.example .env # edit values — see Backend environment variables below
npm install
npm run devDefault API URL: http://localhost:4000 (see PORT).
cd frontend
npm install
npm run devPoint the UI at your API with VITE_API_BASE_URL (defaults to http://localhost:4000/api/v1). Example:
# frontend/.env.local (or shell)
VITE_API_BASE_URL=http://localhost:4000/api/v1Useful scripts: npm run build, npm start (runs the Nitro server output), npm run lint, npm run format.
Defined and validated in backend/src/config/env.ts:
| Variable | Notes |
|---|---|
MONGODB_URI |
Required |
JWT_ACCESS_SECRET, JWT_REFRESH_SECRET |
Min 16 characters each |
PORT |
Default 4000 |
CORS_ORIGIN |
Default http://localhost:8080 |
JWT_ACCESS_EXPIRES, JWT_REFRESH_EXPIRES |
Defaults 15m / 7d |
REFRESH_COOKIE_NAME |
Default refresh |
DEV_SEED_PASSWORD |
Optional; used by npm run seed |
CLOUDINARY_* |
Optional trio for seller image uploads |
In backend, integration-style smoke scripts include npm run test:auth, test:catalog, test:buyer, test:checkout, test:seller, test:admin. Seed the database with npm run seed when DEV_SEED_PASSWORD is set.
More API detail lives in backend/BACKEND_SPEC.md.
- CI/CD:
.github/workflows/deploy.yml— on push tomain, SSH deploys to a VPS (/var/www/nexus), runsnpm install/npm run buildinbackendandfrontend, then restarts PM2 processesnexus-backendandnexus-frontend. - Secrets:
VPS_HOST,VPS_USER,VPS_SSH_KEYin GitHub Actions. - Example reverse proxy:
deploy/nginx-nexus-frontend.conf.example.
Production ports in workflow fallbacks match ecosystem.config.js: backend 4000, frontend 8080.