Just-Office is a full-stack web application built with React.js frontend and Node.js/Express backend for managing office spaces and bookings.
Before setting up the project, ensure you have the following installed on your system:
-
Node.js and npm
- Windows: Download and install from Node.js official website
- macOS:
brew install node
- Linux:
sudo apt update sudo apt install nodejs npm
-
MongoDB
- Windows: Download and install MongoDB Community Server
- macOS:
brew tap mongodb/brew brew install mongodb-community
- Linux:
sudo apt update sudo apt install mongodb sudo systemctl start mongodb
git clone <repository-url>
cd just-office- Install frontend dependencies:
npm install- Create a
.envfile in the root directory:
REACT_APP_API_URL=http://localhost:5000- Navigate to the backend directory and install dependencies:
cd backend
npm install- Create a
.envfile in the backend directory:
PORT=5000
MONGO_URI=mongodb://localhost:27017/just-office
JWT_SECRET=your_jwt_secret_here
NODE_ENV=developmentNote: Replace your_jwt_secret_here with a secure random string for production use.
-
Ensure MongoDB is running:
- Windows: MongoDB should be running as a service
- macOS:
brew services start mongodb-community - Linux:
sudo systemctl start mongodb
-
The database will be automatically created when you start the backend server.
In the backend directory:
# Development mode with auto-reload
npm run dev
# OR Production mode
npm startThe backend server will start on http://localhost:5000
In the root directory:
npm startThe frontend development server will start on http://localhost:3000
In the project directory, you can run:
npm start: Runs the frontend in development modenpm test: Launches the test runnernpm run build: Builds the frontend for productionnpm run eject: Ejects from create-react-app
In the backend directory:
npm run dev: Runs the backend with nodemon for developmentnpm start: Runs the backend in production mode
just-office/
├── backend/ # Backend server files
│ ├── config/ # Configuration files
│ ├── models/ # Database models
│ ├── routes/ # API routes
│ └── server.js # Server entry point
├── public/ # Static files
├── src/ # Frontend source files
│ ├── components/ # React components
│ ├── data/ # Static data files
│ └── images/ # Image assets
└── package.json # Project dependencies
-
MongoDB Connection Issues
- Ensure MongoDB is running on your system
- Check if the MONGO_URI in backend/.env is correct
- Verify MongoDB port is not blocked by firewall
-
Port Conflicts
- If port 3000 or 5000 is in use, modify the respective port in:
- Frontend: Create a
.envfile withPORT=3001 - Backend: Modify
PORTin backend/.env
- Frontend: Create a
- If port 3000 or 5000 is in use, modify the respective port in:
-
Node Module Issues
- Try removing node_modules and package-lock.json:
rm -rf node_modules package-lock.json npm install
- Try removing node_modules and package-lock.json:
For production deployment:
- Build the frontend:
npm run build-
Set environment variables in production:
- Set NODE_ENV=production
- Use secure MONGO_URI
- Use strong JWT_SECRET
- Configure CORS settings in backend
-
Serve the static build files using the backend server or a CDN
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request