Smart Hostel

Next.js 16TypeScriptTailwind CSSLucide React
Smart Hostel preview

overview.

Built Smart Hostel, a responsive single-page application for managing hostel room inventory and automating room allocation. Features a smart allocation algorithm, dark/light mode, localStorage persistence, and toast notifications.

about.

Smart Hostel automates the room allocation process with a preference-based matching algorithm. Students specify capacity, AC, and washroom preferences, and the system finds the optimal room. All data persists in localStorage with no backend required, making it a lightweight solution for hostel management.

technical implementation.

Allocation Algorithm

Built a preference-based matching algorithm that filters rooms by AC/washroom requirements, sorts by capacity (ascending), and returns the smallest suitable room. Supports optional student assignment after allocation.

Client-Side Architecture

Pure frontend application using Next.js 16 with TypeScript. All state management uses React hooks with localStorage for persistence. No backend dependencies make deployment trivial.

key features.

  • Smart room allocation algorithm with preference matching
  • Add, view, search, and filter rooms
  • Allocate and deallocate rooms with one click
  • Dark/light theme with system preference detection
  • localStorage persistence (no backend required)
  • Toast notifications for all actions

screenshots.

Smart Hostel room grid

Responsive card grid with room status indicators.

Room allocation form

Smart allocation algorithm finds the best matching room.

challenges & solutions.

Challenge: Finding optimal room matches based on multiple preferences

Solution: Implemented a multi-criteria filtering and sorting algorithm. Rooms are filtered by hard requirements (AC, washroom), then sorted by capacity to find the best fit with minimal waste.

Challenge: Maintaining state consistency without a backend

Solution: Used localStorage with JSON serialization for persistence. Implemented validation on read to handle corrupted data and provide fallback defaults.