A full-stack collaborative knowledge mapping app with:
- Frontend: React + Vite + React Router
- Backend: Node.js + Express + MongoDB + JWT auth
- E2E testing: Cypress
- Production containerization: Docker + Docker Compose
frontend/- React client appbackend/- Express API serverdocker-compose.prod.yml- production-oriented multi-service compose file
- Node.js 18+
- npm 9+
- MongoDB (local install) OR Docker Desktop
Run backend and frontend in separate terminals.
cd backend
npm installCreate a .env file in backend/:
PORT=5000
MONGO_URI=mongodb://127.0.0.1:27017/knowledgemesh
JWT_SECRET=replace-with-a-strong-secret
JWT_EXPIRES_IN=7d
CLIENT_ORIGIN=http://localhost:5173Then start backend:
npm run devBackend API will be available at http://localhost:5000.
cd frontend
npm install
npm run devFrontend runs at http://localhost:5173.
By default, Vite proxies /api requests to http://localhost:5000.
Optional frontend env vars (in frontend/.env):
VITE_API_BASE_URL=
VITE_API_TIMEOUT_MS=10000
VITE_API_PROXY_TARGET=http://localhost:5000Use the provided compose file:
docker compose -f docker-compose.prod.yml up --build -dServices started:
mongo(MongoDB 7)backend(Express API)frontend(served on port80)
Open app at http://localhost.
Stop services:
docker compose -f docker-compose.prod.yml downnpm run dev- start Vite dev servernpm run build- create production buildnpm run preview- preview production buildnpm run lint- run ESLintnpm run cy:open- open Cypress UInpm run cy:run- run Cypress headless with local dev servernpm run test:e2e- run Cypress tests in Electron
npm run dev- start backend with nodemonnpm start- start backend in production mode
From frontend/:
npm run cy:open
# or
npm run cy:runRecommended: keep backend running during tests.
Backend health endpoint:
GET /api/health
- Always use a strong
JWT_SECRETin production. - Never commit real secrets to source control.
- Set
NODE_ENV=productionfor deployed environments.