Build a room booking interface using the provided API.
cd api
npm install
npm startOr with Docker:
cd api
docker build -t booking-api .
docker run -p 3000:3000 booking-apiAPI runs at http://localhost:3000
cd frontend
npm install
npm run devFrontend runs at http://localhost:5173
Build a room booking interface. Time: ~60-90 minutes.
- Display rooms from the API
- Allow selecting check-in and check-out dates
- Show which rooms are available for selected dates
- Allow booking an available room
- Loading states while fetching
- Error handling (user-friendly messages)
- Form validation (dates, required fields)
- Visual feedback for availability status
- API client -
src/api/client.tshas all fetch functions ready - TypeScript types -
src/types/index.tsdefines Room, Booking, etc. - TailwindCSS - Configured and ready to use
- App shell - Basic layout in
App.tsx
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/rooms | Get all rooms |
| GET | /api/rooms?isAvailable=true&checkIn=...&checkOut=... | Get available rooms for date range |
| GET | /api/rooms/{id} | Get room by ID |
| GET | /api/rooms/{id}/availability?checkIn=...&checkOut=... | Check room availability |
| POST | /api/bookings | Create a booking |
{
"roomId": 1,
"customerName": "John Doe",
"customerEmail": "john@example.com",
"checkIn": "2026-03-01",
"checkOut": "2026-03-05"
}200- Success201- Booking created400- Invalid input404- Room not found409- Room not available (conflict)