Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

Concept Map System (KnowledgeMesh)

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

Project Structure

  • frontend/ - React client app
  • backend/ - Express API server
  • docker-compose.prod.yml - production-oriented multi-service compose file

Prerequisites

  • Node.js 18+
  • npm 9+
  • MongoDB (local install) OR Docker Desktop

Local Development

Run backend and frontend in separate terminals.

1) Start Backend

cd backend
npm install

Create 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:5173

Then start backend:

npm run dev

Backend API will be available at http://localhost:5000.

2) Start Frontend

cd frontend
npm install
npm run dev

Frontend 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:5000

Production (Docker)

Use the provided compose file:

docker compose -f docker-compose.prod.yml up --build -d

Services started:

  • mongo (MongoDB 7)
  • backend (Express API)
  • frontend (served on port 80)

Open app at http://localhost.

Stop services:

docker compose -f docker-compose.prod.yml down

Scripts

Frontend (frontend/package.json)

  • npm run dev - start Vite dev server
  • npm run build - create production build
  • npm run preview - preview production build
  • npm run lint - run ESLint
  • npm run cy:open - open Cypress UI
  • npm run cy:run - run Cypress headless with local dev server
  • npm run test:e2e - run Cypress tests in Electron

Backend (backend/package.json)

  • npm run dev - start backend with nodemon
  • npm start - start backend in production mode

E2E Tests

From frontend/:

npm run cy:open
# or
npm run cy:run

Recommended: keep backend running during tests.

Health Check

Backend health endpoint:

  • GET /api/health

Security Notes

  • Always use a strong JWT_SECRET in production.
  • Never commit real secrets to source control.
  • Set NODE_ENV=production for deployed environments.

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages