A modern Single Page Application (SPA) designed to manage shared corporate workspaces, schedule meetings, and optimize office resources without scheduling conflicts.
This application simulates a real-world workspace reservation system where users can authenticate, navigate through protected routes, and manage booking data consumed from a simulated REST API.
- SPA Architecture: Building dynamic interfaces without page reloads.
- Authentication & Session Persistence: Managing secure user states via LocalStorage.
- Role-Based Access Control (RBAC): Restricting features based on user permissions.
- API Consumption: Simulating live database operations with a mock REST server.
- Modular Codebase: Structuring scalable, organized JavaScript files.
A company provides multiple shared environments such as Meeting Rooms, Private Offices, Coworking Spaces, and Auditoriums. To prevent schedule overlapping and improve organizational efficiency, this platform divides users into two distinct roles:
- View and manage all reservations across the company.
- Create, edit, and delete any workspace reservation.
- Approve or reject pending reservation requests.
- Manage corporate workspaces (add, update, or remove rooms).
- Access administrative dashboards and metrics.
- Browse available workspaces and schedules.
- Create new reservations.
- View and track their personal reservations only.
- Modify their own pending reservations.
- Cancel their own active reservations.
- Core: JavaScript (ES6+), HTML5, CSS3
- Bundler & Build Tool: Vite
- Styling Framework: TailwindCSS
- Mock Backend: JSON Server
- Process Manager: Concurrently
src
├── assets
├── components
│ └── Sidebar.js # Shared navigation sidebar component
├── controllers
│ └── login.controller.js # Login business logic and event handlers
├── router
│ └── router.js # Client-side router and route guards
├── views
│ ├── loginView.js # Authentication interface
├── usersView.js # Users List interface
│ ├── homeView.js # Main landing dashboard
│ └── notFound.js # 404 Error page
├── utils.js # LocalStorage helpers and session state management
├── main.js # Application entry point
└── style.css # Global styles and Tailwind directives- Components: Reusable UI elements. The
Sidebar.jscentralizes app navigation and dynamically updates depending on the user role. - Controllers: Handles application logic, captures DOM events, validates forms, and interacts with the API layer.
- Views: Functional templates that return raw HTML strings injected dynamically into the main layout wrapper.
- Router: Intercepts navigation, updates URL states, evaluates route security guards, and renders the appropriate view or 404 screen.
- Utils: Core helper functions dedicated to saving, retrieving, and clearing session tokens.
Ensure you have Node.js installed on your machine.
Clone the repository and install the development dependencies:
npm installLaunch both the Vite development server and the JSON Server database simultaneously using:
npm run devThe project uses concurrently to orchestrate both front-end and back-end processes under a single terminal window.
"scripts": {
"client": "vite",
"server": "json-server --watch db.json --port 3000",
"dev": "concurrently \"npm run client\" \"npm run server\""
}You can use the following mock accounts pre-configured in db.json to test role features:
| Role | Password | |
|---|---|---|
| Admin | admin@test.com |
123456 |
| User | user@test.com |
123456 |
- Fully functional login interface.
- REST API integration via JSON Server.
- Session persistence using LocalStorage.
- Global logout state management.
- Client-side SPA Router.
- Basic Route Guards (protecting private pages from unauthenticated guests).
- Pre-configured TailwindCSS layout.
Developers must build upon this foundation to deliver the following modules:
- Full CRUD capabilities for Reservations.
- Full CRUD capabilities for Workspaces.
- Advanced Route Guards and role validation triggers.
- Administrative Dashboard with data filters and search bars.
- Visual booking statistics and calendars.
- Real-time notifications or toast alerts for status updates.
- Strict corporate business rule validations (e.g., preventing double-booking).