A simple REST API for hotel bookings built with TypeScript, Express, and SQLite. This project serves as a sample for QA/release engineering interview hackathons.
- RESTful API for hotel bookings
- Local SQLite database
- No authentication required
- CRUD operations for hotels, users, rooms, and bookings
The database consists of the following tables:
- hotels: Store hotel information
- users: Store user information
- rooms: Store room information for hotels
- bookings: Store booking information
GET /api/hotels
: Get all hotelsGET /api/hotels/:id
: Get hotel by IDPOST /api/hotels
: Create a new hotelPUT /api/hotels/:id
: Update a hotelDELETE /api/hotels/:id
: Delete a hotel
GET /api/users
: Get all usersGET /api/users/:id
: Get user by IDPOST /api/users
: Create a new userPUT /api/users/:id
: Update a userDELETE /api/users/:id
: Delete a user
GET /api/rooms
: Get all roomsGET /api/rooms/:id
: Get room by IDGET /api/rooms/hotel/:hotelId
: Get rooms by hotel IDGET /api/rooms/hotel/:hotelId/available
: Get available rooms by hotel IDPOST /api/rooms
: Create a new roomPUT /api/rooms/:id
: Update a roomPATCH /api/rooms/:id/availability
: Update room availabilityDELETE /api/rooms/:id
: Delete a room
GET /api/bookings
: Get all bookingsGET /api/bookings/:id
: Get booking by IDGET /api/bookings/user/:userId
: Get bookings by user IDPOST /api/bookings
: Create a new bookingPATCH /api/bookings/:id/status
: Update booking statusPATCH /api/bookings/:id/cancel
: Cancel a bookingDELETE /api/bookings/:id
: Delete a booking
- Node.js (v14 or higher)
- npm or yarn
-
Clone the repository:
git clone https://github.com/Odiggo/sullyai-qa-hackathon.git cd sullyai-qa-hackathon
-
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Seed the database with sample data:
npm run seed
npm run dev
: Start the development server with hot-reloadingnpm run build
: Build the project for productionnpm start
: Start the production servernpm run seed
: Seed the database with sample data
This project is designed for QA/release engineering interview hackathons. Candidates can:
- Add tests for the API endpoints
- Build a CI/CD pipeline for releases
- Implement automated testing strategies
The following resources are provided to help candidates complete the hackathon challenge:
An OpenAPI/Swagger specification is available in the api-docs
folder. This provides a detailed description of all API endpoints, request/response models, and examples.
To view the API documentation in an interactive format, you can:
- Open Swagger Editor
- Copy the contents of
api-docs/openapi.yaml
into the editor
Example request and response payloads can be found in the data/samples
directory. These examples demonstrate the expected format for API interactions and can be used as a reference when writing tests.
A Postman collection is available in the postman
directory to help you get started with API testing.
To use it:
- Open Postman
- Import the collection from
postman/hotel-booking-api.postman_collection.json
- Set the environment variable
baseUrl
tohttp://localhost:3000/api
when testing locally
For details about the hackathon challenge, including tasks, deliverables, and evaluation criteria, please refer to the HACKATHON.md file.