onLift is a web application built as a learning exercise to simulate the operation of an elevator system, inspired by observations of a hostel lift. It goes beyond a simple visual representation, incorporating distinct user roles (Admin and User), complex state management, and manual operational logic. The project served as a deep dive into backend development concepts, full-stack integration, and simulating real-world, state-dependent interactions.
The application is built using the MEEN stack (MongoDB, Express.js, EJS, Node.js), with initial UI concepts designed in Figma.
- Manual Lift Operation:
GO: Manually dispatches the lift to the next floor in the user request queue.
- Monitoring & Control:
CAMERA: Allows the admin to view the profile pictures of users currently inside the elevator cabin.ORDER: Toggles the lift's operational status between "In Service" (Green Light) and "Out of Order" (Red Light).
- Emergency Protocol:
RESCUE: This button only appears if the lift is marked "Out of Order" while users are still inside. Clicking it simulates an emergency evacuation, clearing the lift occupants.
- Authentication:
Signup: Users can register with a Username, Weight (in KGs), Password, and upload a Profile Picture.Login: Secure login for registered users.- Personalized welcome message and profile picture display upon login.
- Elevator Interaction:
ENTER: Button appears when the lift is not on the user's current floor. Clicking it adds the user to the destination queue.WAITING: Status indication after clickingENTERwhile the lift is en route.ENTER NOW: Button appears only when the lift arrives at the user's floor, is operational (Green Light), and has sufficient weight capacity remaining.- Weight Limit: The system prevents users from entering if their weight exceeds the lift's remaining capacity (based on signup data and current occupants).
- Floor Selection: Once inside the lift (after clicking
ENTER NOW), users are presented with floor buttons to choose their destination.
- State Management: Tracks lift's current floor, direction, operational status, user queue, current occupants (and their total weight).
- Dynamic UI: Interface elements (buttons, status lights, occupant view) change based on the lift's state and the user's role/location.
- Alerts: Uses browser alerts for system messages (e.g., "Lift out of order", "No users inside", potentially "Lift is full").
- Data Persistence: User credentials, profile pictures, and potentially lift state are stored in MongoDB.
- Backend: Node.js, Express.js
- Frontend Templating: EJS (Embedded JavaScript templates)
- Database: MongoDB (potentially with Mongoose ODM)
- Design: Figma (for initial UI/UX concepts)
- Environment Variables: dotenv
-
Clone the repository:
git clone https://github.com/your-username/onlift.git cd onlift -
Install dependencies:
npm install
-
Create Environment Variables: Create a
.envfile in the root directory and add the following variables. Replace the placeholder values with your actual configuration.# .env file MONGODB_URI=your_mongodb_connection_string # e.g., mongodb://localhost:27017/onlift or MongoDB Atlas URI
Note: Ensure you have a running MongoDB instance accessible via the
MONGODB_URI. -
Run the application:
- For development (if you have
nodemon):npm run dev
Or directly using node:
node app.js # Or your main server file name - For development (if you have
-
Access the application: Open your web browser and navigate to
http://localhost:PORT(e.g.,http://localhost:3000).
- Navigate to the application URL.
- Signup: Create a new user account, providing username, weight, password, and optionally a profile picture.
- Login: Log in using your credentials.
- If you log in with the username defined as
ADMIN_USERNAMEin your.envfile, you will access the Admin dashboard. - Otherwise, you will access the standard User dashboard.
- If you log in with the username defined as
- User Flow:
- See the lift status and your current floor.
- Click
ENTERto request the lift to your floor. Wait for it to arrive (WAITINGstate). - If conditions are met (lift arrives, operational, capacity available), click
ENTER NOW. - Once inside, select your destination floor.
- Admin Flow:
- View the overall lift status, current floor, and direction.
- Use
GOto move the lift to the next requested floor. - Use
CAMERAto see who is inside. - Use
ORDERto toggle the lift's operational status. - Use
RESCUEif the lift is Out of Order with users inside.
This project is primarily a learning exercise and a functional prototype demonstrating complex backend logic and state management. It was completed to practice and solidify full-stack development skills.
- Implement real-time updates using WebSockets (e.g., Socket.IO) for smoother UI updates.
- Add support for multiple elevators.
- Develop a more sophisticated lift scheduling algorithm instead of a simple queue.
- Implement actual image storage/retrieval (e.g., Cloudinary, S3) instead of just storing paths/placeholders.
- Add more detailed error handling and user feedback.
- Unit and integration tests.


