This project is configured to work seamlessly in GitHub Codespaces or with VS Code Dev Containers.
- Click "Code" → "Codespaces" → "Create codespace on main" from the GitHub repo
- The devcontainer will automatically:
- Spin up a MongoDB instance (Atlas Local)
- Install all dependencies
- Seed sample data
- Install the Dev Containers extension in VS Code
- Open the repo locally and run:
Ctrl+Shift+P→ "Dev Containers: Reopen in Container" - VS Code will build the environment and start MongoDB
Once the devcontainer is running:
| Service | URL | Purpose |
|---|---|---|
| React App | http://localhost:5173 | Frontend (Vite dev server) |
| Express API | http://localhost:5050 | Backend REST API |
| MongoDB | mongodb://localhost:27017 | Database (no browser UI) |
| MongoDB VS Code Extension | N/A | Query database directly in VS Code |
Once the devcontainer is fully loaded (wait for "Poststart" to complete):
# Terminal 1: Start the Express server
cd mern/server
npm start
# Terminal 2: Start the React dev server
cd mern/client
npm run devThen open http://localhost:5173 in your browser.
- Host:
mongodb(inside container) orlocalhost:27017(from host) - Username:
admin - Password:
mongodb - Database:
employees
The devcontainer automatically seeds sample data on startup. To manually reseed:
cd mern/server
node seed.jsThe devcontainer includes these extensions:
- MongoDB for VS Code — Query your MongoDB directly from VS Code
- TypeScript — TypeScript language support
- Prettier — Code formatter
# Check if MongoDB is running
mongosh -u admin -p mongodb --eval "db.adminCommand('ping')"If ports 5050, 5173, or 27017 are already in use:
- Codespaces: Automatic port forwarding handles this
- Local Dev Container: Modify
docker-compose.ymlto use different ports
# VS Code: Ctrl+Shift+P → "Dev Containers: Rebuild Container"
# CLI: devcontainer build --workspace-folder .