A Hostel Web Portal using MERN stack
The Dorm Den
is a Hostel Web Portal implemented in MERN stack
by Bikrant Bidari, Sudeep Kaucha, Sameer Shrestha and Arahanta Pokhrel. While creating the project, we learnt about Event Listeners in React
, React State
, Conditional Rendering in React
, React Hooks(useEffect,useState)
, React Routers
, Styled components
, etc. A user can search for hostels as per his/her requirement and a hostel owner can showcase his/her hostel. After creating the project, Frontend
was deployed to Netlify
and Backend
was deployed to Render
.
- Places autocomplete
- Geo encoding
- Filtering
- Sorting
- Encryption
###Clone the repository using Github CLI
git clone https://github.com/bikrantbdr/TheDormDen.git
###Go to the client folder
cd client
###Install Dependencies
npm install
###Start the developmet server(App will open in a new window)
npm start
###Go to the Backend folder
cd Backend
###Install Dependencies
npm install
###Create a .env file inside the Backend folder and add the following things inside that file:
MONGODB_URI =
SECRET =
PORT =
SMPT_SERVICE =
SMPT_EMAIL =
SMPT_PASSWORD =
COOKIE_EXPIRES_IN =
CLOUDINARY_NAME =
CLOUDINARY_API_KEY =
CLOUDINARY_API_SECRET =
#Fill in the blank contents of the .env file with your data
###Deploy backend server locally
npm run dev
- Initialize the project using
npx create-react-app thedormden
which will create a complete React App pre-configured and pre-installed with the dependencies. - Delete the Boiler plate.
- Create
components
,utils
,assets
andPages
folder inside thesrc
directory.
- Index.jsx renders the React components
- App.jsx routes to the different pages.
- Design basic layout of the pages
- [x]
- Install the packages to be used.
npm install 'npm-package-name'
-
Some of the packages used in our project are
- Used to write CSS code within the JSX components.
- To access customizable icons for use in React components
- Display and access location details.
- Handle request from the frontend and get respond from the backend
- Implement dynamic routing in the web app.
- Access cookies from all the routes.
- Decode the data from the cookie.
-
Add the API's used in the project.
-
Some of the used API's are
- predicts place in response to an HTTP response
- provide geocoding and reverse geoencoding of addresses
- Change Absolute units to Relative.
- Make App responsive for mobile by adding
media query
. 😊
- Delete unnecessary files from directory and format code with
Prettier
. - Test for Responsiveness and make changes if need be.
- Add links to
Live Preview
and screenshots in Readme file.
- Use official documentation of Netlify to deploy Frontend🎆🎆🎆
-
Create a new project and initialize it with the package manager i.e.npm init.
-
Install necessary packages and dependencies, such as bcrypt, cloudinary, cors, dotenv, jsonwebtoken, mongoose, nodemailer, uuid, etc.
-
Create folders to organize the code that are index,app, models, router, controllers, utils, etc.
-
Define the database schema and models using Mongoose.
-
Some of the files and their uses in the project
- Responsible for setting up the environment and starting the server
- Define the core functionality of the server, including middleware and route handling
- maps incoming request to the appropriate controller function
- handles database queries, data validation and other operations related to data
- provide resuable function which include token verification,query handling,logging and error handling
-
Define routes and controllers to handle HTTP requests and responses, e.g., GET, POST, PUT, DELETE, etc.
-
Implement authentication and authorization using JWTs and middleware functions.
-
Implement error handling and logging using middleware functions,that are errorHandler, logger, etc.
-
Implement file upload and management using Cloudinary and middleware functions.
-
Implement email sending and verification using Nodemailer and middleware functions.
-
Test the server functionality and endpoints using tools such as Postman, Jest, Mocha, etc.we used postman
-
Debug and fix any issues or errors.
-
Set environment variables and configurations for the server, such as PORT, MONGODB_URI, CLOUDINARY_URL, JWT_SECRET, etc
-
Add build scripts to package.json for production deployment.
-
Test the server locally and ensure it works correctly.
- Use official documentation of Render to deploy Backend.
- Improve SEO
- Add animations and provide a better User Experience
"If the code is working but it isn't supposed to work and you don't know the reason, kindly don't touch the code. In short, If it works, don't change it." - Every Frustrated Coder 💭✨💯