This project has a simple setup with an api, hooked up to MongoDB and a frontend piece initiated with vite.
From the project root:
npm install
Once install has finished, you can use the following to run both the API and UI:
npm run start
To run the API separately, navigate to the ./packages/api
folder
$ cd packages/api
And run the api
server with
$ npm run dev
The API should start at http://localhost:3001
To run the client
server separately, navigate to the ./packages/client
folder
$ cd ./packages/client
And run the client
with
$ npm run start
The UI should start at http://localhost:3000
By default, the code is set up to start and seed a MongoDB in-memory server, which should be sufficient for the test. The database URL will be logged on startup, and the seed data can be found at ./packages/api/db/seeds.
If this setup does not work for you or if you prefer to use your own MongoDB server, you can create a .env file. In the ./packages/api folder, create a .env file (or rename the existing .env.sample) and fill in the environment variables.
When the project is up and running, you should see a search-bar on the screen. This one is currently hooked up to the /hotels
endpoint.
When you type in a partial string that is part of the name of the hotel, it should appear on the screen.
Ie. type in resort
and you should see some Hotels where the word resort
is present.
You will also see 2 headings called "Countries" and "Cities".
The assignment is to build a performant way to search for Hotels, Cities or Countries.
Partial searches will be fine. Hotels will need to filterable by location as well.
Ie. The search uni
should render
- Hotels that are located in the United States, United Kingdom or have the word
uni
in the hotel name. - Countries that have
uni
in their name Ie. United States, United Kingdom - No Cities as there is no match
Clicking the close button within the search field should clear out the field and results.
When clicking on one of the Hotels
, Cities
or Countries
links, the application should redirect to the relevant page and render the selected Hotel
, City
or Country
as a heading.
Given the time constraints, we do not expect a fully production-ready solution. We're primarily interested in the approach and the overall quality of the solution. Feel free to modify the current codebase as needed, including adding or removing dependencies. For larger or more time-intensive changes, you're welcome to outline your ideas in the write-up section below and discuss them further during the call.
When all the behaviour is implemented, feel free to add some observations or conclusions you like to share in the section
[
{
"chain_name": "Samed Resorts Group",
"hotel_name": "Sai Kaew Beach Resort",
"addressline1": "8/1 Moo 4 Tumbon Phe Muang",
"addressline2": "",
"zipcode": "21160",
"city": "Koh Samet",
"state": "Rayong",
"country": "Thailand",
"countryisocode": "TH",
"star_rating": 4
},
{
/* ... */
}
]
[
{ "name": "Auckland" },
{
/* ... */
}
]
[
{
"country": "Belgium",
"countryisocode": "BE"
},
{
/* ... */
}
]