Accommodation Listings
The Project lists all the accommodations we our contracted with Airbnb. As our teams need to travel regularly to global locations and reserve accommodations on these available listings.
The Project is build on MERN stack is a JavaScript-based software stack used to build web applications. MERN stands for MongoDB, Express, React, and Node.js, which are the four technologies that make up the stack.
When used together, these technologies provide a complete framework for building scalable and responsive web applications. Node.js and Express are used for the server-side and back-end programming, while React is used for the client-side and front-end programming. MongoDB is used to store and manage data.
This stack is widely used because it is relatively simple to learn, uses a common programming language (JavaScript), and can be used to build complex and robust web applications.
The Project is broken down into two main parts:
-
Backend: Which has been build on NodeJS, ExpressJS and MongoDB, and the source code is available in the backend folder. Following are the important part of backend:
- The Project follows the standard ExpressJS folder structure
- Mongodb's Airbnb sample dataset json is located at /mongodb-dataset/sample_airbnb.json & Schema is located at airbnb-schema.json
- Config - Contains all the ExpressJS global variables and mongodb db connection details
- Models - Sets up the connectivity to MongoDB with Pagination and also contains the Schemas
- Routes - Exposes the routes and paths with different HTTP verbs
- Controllers - Implementation for the different routes and logic for each Endpoints / APIs
- Backend endpoints which are exposed are:
- Endpoints / APIs exposed to Frontend:
- GET
/api/model
- Returns all the listings - GET
/api/model/${id}
- Returns the specific listing
- GET
- Endpoints / APIs hidden and unexposed to Frontend:
- GET
/api/model/${id}?search=${search}
- Search a listing using the query string. - PUT
/api/model/${id}
- Returns the specific listing & specify only the specific fields to be updated - DELETE
/api/model/${id}
- Returns the specific listing
- GET
- Endpoints / APIs exposed to Frontend:
-
Frontend: Which has been build on ReactJS basic setup, to display the listings, and the source code is available in the frontend folder. Following are the important part of frontend:
- The Project follows the standard React Web App folder structure
- http-common.js - Uses Axios to hit the backend endpoint
- listing.component.js - Uses React and Mui tables to display the listing
- listing.service.js - Makes the API call to the appropriate backend paths and with query strings & headers
- React paths available in the frontend:
/
or/listings/
- Displays all the listings/listings/${id}
- Displays the specific listing
flowchart LR
subgraph Frontend
http-common---components
components---services
end
subgraph Backend
subgraph MongoDB
data
end
models
routes
controllers
config
end
Frontend -- "GET /api/model" --> Backend
Frontend -- "GET /api/model/${id}" --> Backend
Unexposed[Unexposed/Hidden Endpoints] -- "PUT /api/model/${id}" --> Backend
Unexposed[Unexposed/Hidden Endpoints] -- "DELETE /api/model/${id}" --> Backend
Unexposed[Unexposed/Hidden Endpoints] -- "GET /api/model/${id}?search=${search}" --> Backend
Following are the steps to install the project:
- Install Node.js verion >= 18, and npm >= 9
- Install MongoDB >= 3.6
- MongoDB Command Line Database Tools
- mongoimport the Mongodb's Airbnb sample dataset and collection
listingsAndReviews
to the local mongodb - Install the Frontend by running
npm install
inside./frontend
- Install the Backend by running
npm install
inside./backend
Run the following steps to run each part:
- Backend
- run
npm start
inside the./backend
folder
- run
- Frontend
- run
npm start
inside the./frontend
folder
- run
Thank you for considering contributing to our project! Please follow these guidelines before submitting a pull request:
- Fork the repository and make your changes on the development branch.
- Make sure your code is properly formatted and adheres to our coding standards.
- Write clear and concise commit messages and include documentation with your changes.
- Push your changes to your fork and submit a pull request to the development branch of the original repository.
- Please allow time for our team to review your changes and provide feedback.
- Once your pull request is approved, we will merge your changes into the master branch.
By contributing to this project, you agree to follow the code of conduct outlined in the project's repository. Please report any inappropriate behavior to project maintainers.
We appreciate your time and effort in contributing to this project!
We like to thank the following projects and sources which have helped us build this project:
To ensure the best experience during this workshop, please follow the steps in this instruction to get your environment up
GitHub Codepsaces is a development environment that's hosted in the cloud. It supports customisation by configuring dev container for your repository, to define a choice of different development environments that are appropriate for the work people will do in your repo.
Inside your personal workshop repo(NOT the repo template your create this repo from), find Code
, Select Codespaces Tab
, then click the +
to create a new Codespace instance. A new Tab will prompt and you should start seeing progress in Codespace preparation.
ℹ️ It generally takes a few minutes to get your Codespace ready for use
ℹ️ Although GitHub Codespaces supports a variety of IDE enginee, we will be using Visual Studio Code in this workshop(which is also the default choice)
ℹ️ Every Codespaces instance comes with a name randomly selected by GitHub during creation
If you closed the Codespace tab in your browser, you can always resume it. On your repo main page, locate recent Codespace instance via Code
-> Codespace Tab
, click the instance name will pop up the Codespace environment.
Your Codespace instance should look like below once it is ready
📣 Note - Please close all the Open terminals inside your codespaces on starting it. You can start a new code space by hitting the short cut Ctrl + Shift + `, OR by using the GUI option seen below:
Notice the side bar from left-hand, there is a icon, click you will enter Copilot Chat in IDE. We will learn how Copilot Chat helps us during the workshop.
Just like local VS Code, Codespaces also comes with terminal for command inputs. In this repository we already installed Copilot in the CLI. Try type something starting with ??
, for example, ?? list file
. Copilot in the CLI will return command suggestion. Feel free to accept or cancel using your keyboard arrows.
Welcome to the team. You are the new team member to this business project. You have been in the Company for few years, but have just shifted to this project. You understand the MERN stack, and have worked few production projects in the past.
We have a low / non-critical severity fix come in from one of the Business Owners of the project, and it is being tracked on our Project Board. As you know we are low on staff due to vacations in the team, and we need you to pick up this requirement and start working on it. This being a non-critical fix, and it will help you get familiar with the project and the code base.
One of our listers in New York city, has rebranded his Listing, and has requested us to update the Listing Name on our website. This Old Name is `UWS Brownstone Near Central Park` and the new name needs to updated to `UWS Brownstone Prime`.Hi, It is exciting to be working again with you on this new requirements. This is High Severity requirement, and we need to get this done in this Quarter. This requirement can improve the client experience and help them to see their listings in their geographical location.
Our Sales employees log in from different locations across the globe. They have clients, partners, vendors and franchise owners visiting their locations quite often. Today they access the Accomodation page and need to manually find different listings specific to their location. We would like you and your team to build a solution which displays only their listings based on their Geo Location. We have partnered with a Geo Location service in the past, and would request you to use the same location to build a working prototype. Our website is protected by the leading Content Delivery Network(CDN) and you could use their features for building your solution.Our Sister Company is using IP2LOCATION and for this prototype we would like you to use the same service.
-
Test Case 1 - Check the Listing based on the ID, and check if it's name has been correctly changed to
UWS Brownstone Prime
. -
Test Case 2 - Check if Geo Location logic implementation is working as desired