Local-first MERN + Bootstrap project scaffold.
- Frontend: React (Vite) + Bootstrap
- Backend: Node.js + Express
- Database: MongoDB + Mongoose
- Backend binds to
127.0.0.1by default. - Frontend Vite dev server binds to
127.0.0.1. - CORS is restricted to local origins defined in
server/.env(CLIENT_ORIGIN).
- Node.js 20+ recommended
- npm 10+
- Optional for persistent storage: local MongoDB instance on
127.0.0.1:27017
Server env file: server/.env
Default values:
PORT=5000
HOST=127.0.0.1
MONGO_URI=mongodb://127.0.0.1:27017/mdtechactive
MONGO_TIMEOUT_MS=5000
CLIENT_ORIGIN=http://127.0.0.1:5173If MongoDB is unavailable, the server gracefully falls back to in-memory mode for game room flows.
cd server
npm install
cd ../client
npm installUse two terminals.
Terminal 1 (API):
cd server
npm run devTerminal 2 (Client):
cd client
npm run devLocal URLs:
- Frontend:
http://127.0.0.1:5173 - Backend:
http://127.0.0.1:5000 - Health endpoint:
http://127.0.0.1:5000/api/health
- Bootstrap CSS/JS imported in
client/src/main.jsx - Base layout includes navbar, footer, cards, and buttons
- API utility at
client/src/services/api.js - Home page calls
/api/health - Loading and error states handled in
client/src/pages/HomePage.jsx
- DB connector:
server/src/config/db.js - Startup connection attempt:
server/server.js - Sample model:
server/src/models/SampleItem.js - Sample CRUD controller:
server/src/controllers/sampleItemController.js - Sample CRUD route:
server/src/routes/sampleItemRoutes.js
Sample CRUD endpoints:
GET /api/sample-itemsGET /api/sample-items/:idPOST /api/sample-itemsPATCH /api/sample-items/:idDELETE /api/sample-items/:id
- Host/join flow available via frontend routes:
/host/host/:roomCode/join/:roomCode
Guidance from the provided Brave link was applied for:
- Installing Bootstrap in the React client
- Importing Bootstrap assets at the entry point
- Using Bootstrap utility/component classes for layout
Where guidance conflicts, this project follows official docs conventions for React, Bootstrap, Express, and MongoDB/Mongoose.