An elevator control system simulator with real-time updates via WebSockets.
Live demo: https://elevator-sim.arkus.space/ API Docs: https://elevator-sim-api.arkus.space/swagger
- backend/ - NestJS backend API with WebSocket support
- frontend/ - React frontend with Vite
- Docker
- Docker Compose
-
Clone the repository
-
Copy environment files and adjust if needed (backend):
cd backend cp .env.example .env -
Start the application:
docker-compose up -d
-
Access the application:
- Frontend: http://localhost:3005
- Backend API: http://localhost:3000
- API Documentation: http://localhost:3000/swagger
-
Stop the application:
docker-compose down
Edit the docker-compose.yml file to customize backend settings:
PORT- Server port (default: 3000)ELEVATOR_COUNT- Number of elevators (default: 2)UNDERGROUND_FLOORS- Number of underground floors (default: 0)ABOVE_GROUND_FLOORS- Number of above ground floors (default: 5)FLOOR_TRAVEL_TIME_MS- Time to travel between floors in milliseconds (default: 2000)DOOR_OPEN_CLOSE_TIME_MS- Time to open/close doors in milliseconds (default: 300)DOOR_HOLD_TIME_MS- Time doors stay open in milliseconds (default: 1000)ERROR_RATE- Error rate for elevators (default: 0.1)MAINTENANCE_FIX_TIME_MS- Time to fix maintenance in milliseconds (default: 5000)
For production deployment, update the build args in docker-compose.yml:
args:
- VITE_API_URL=https://your-api-domain.com
- VITE_WS_URL=wss://your-api-domain.comIf you want to run the services individually for development:
cd backend
npm install
npm run start:devcd frontend
npm install
npm run devOnce the backend is running, visit http://localhost:3000/swagger for interactive API documentation.
The application uses WebSocket for real-time elevator state updates:
elevator.motion.moving- Elevator started movingelevator.motion.stopped- Elevator stoppedelevator.motion.idle- Elevator is idleelevator.motion.floor-reached- Elevator reached a floorelevator.door.opening- Door is openingelevator.door.opened- Door is openelevator.door.closing- Door is closingelevator.door.closed- Door is closedelevator.destination.scheduled- New destination addedelevator.destination.reached- Destination reached
View logs for all services:
docker-compose logs -fView logs for specific service:
docker-compose logs -f backend
docker-compose logs -f frontend- Ensure the backend is running and healthy
- Check that VITE_WS_URL matches your backend URL
- For HTTPS deployments, use
wss://protocol - Check CORS settings if connecting from different origin
- Clear Docker build cache:
docker-compose build --no-cache - Remove volumes:
docker-compose down -v - Check logs:
docker-compose logs