Skip to content

Namanl2001/MERN-Gurujii-dev

Repository files navigation

GURU JI

About Us

GitHub contributors Issues PRs Forks Stars

We have created this platform to help students find the best tuition teachers in their city quite easily. You just have to enter the pin code of your city and we will show you the best teachers in your locality along with their teaching styles and their qualification from which you can select the best teacher for yourself.

Technology Stack

Getting Started

Want to contribute? Follow the steps below to set it up locally.

# Clone this repository
$ git clone https://github.com/your-username/MERN-Gurujii-dev.git

# Go into the repository
$ cd MERN-Gurujii-dev

# Install dependencies
$ yarn dep0
$ yarn dep1

# Run website
$ yarn dev

This should launch the website on localhost:3000.

We have used proxy so all the requests made to the backend from the frontend will be served at localhost:5000 at which our backend is running.

Note

  • This project uses yarn to install the dependencies. Don't use npm install.

  • To run the app locally, if you do not want to use the database at all, comment out the lines that reference the backend/config.js file:

    • Lines 9, 40 of backend/server.js
    • Line 3 of backend/controllers/user.controller.js
  • There is a route that sends emails - Line 82 of backend/controllers/user.controller.js. Remember to replace the auth credentials with your own before testing the route.

  • Remember not to push any personal data like mongo uri or mail credentials.

Backend

Local Setup

You can run the backend of the app locally by following these steps

  • Install dependencies theough yarn by navigating to the backend folder.
  # Go into backend folder
  $ cd backend

  # Install dependencies
  $ yarn install

  • For security reasons, we have made the MongoDb URI secure, by not adding a hardcoded username and password. For development purposes, you can install, MongoDB locally or use the online version. Create a .env file same as the given env file (.env.example) in backend

    • MONGODB is for API calls
    • MONGODB_TEST_URI is for unit test cases

  • You have to start MongoDB server locally to establish a database connection.

  • Also create your own backend/config.js file with proper credentials, following the format given in backend.config.example/js.

  • The project uses nodemon as a devDependency for runnning backend in development mode.
  # run in development mode
  $ yarn dev

  • Once the server is up and running, you will see two messages in terminal :

    • Server is running on port: 5000
    • MongoDB database connection established successfully
    • Now your backend is running successfully in development mode.

Understanding Backend Flow

  • Go through the code and try to understand the code flow. On a high level, the flow goes like:-

    • An API is hit from the client-side.
    • The main route is matched with a route in various JS files in routes folder.
    • A router is selected based on the route given, and the request is passed on to a controller in controllers folder.
    • The controller receives the request and function accordingly. Finally, a response is sent in JSON format which is processed in the frontend-side.
    • Additionally, it contains middleware folder which currently contains admin authentication middleware.
    • Overall, the control sequence is client request -> server/routes.js -> server/api/controllers/{some controller}/router.js -> server/api/controllers/{some controller}/controller.js -> client response.

Frontend

Quick Setup

To start the frontend, you need to install dependencies in the `package.json` file in the root folder.
  # install dependencies
  $ yarn install

This will install dependencies required to start the React server.

  • Once the dependencies have been installed, you can run the server locally on your system on localhost:3000.
  # start react server
  $ yarn start

Contribution

Contributions are very welcome! See our CONTRIBUTING.md for more information.

Want to test your changes on mobile phone?

  • To view on mobile, your laptop and mobile phone should be on the same network.
  • Run ipconfig on the terminal, enter <ip4address>:3000 as URL on the mobile web browser.

Demo

Click Here to view the deployment!

Deploy

Great! Now you are good to go. Open/pick an issue, discuss your idea, make the changes in your feature branch and create your first pull request in this repo.

Interesting?? Star this Repo

Open Source Program

This Project is a part of the following Open Source Programs

  • GirlScript Summer of Code is a 3 month long Open Source program during summers conducted by the GirlScript Foundation which was started in 2018, with an aim to help beginners to get started with Open Source Development while encouraging diversity. Throughout the program, participants contribute to different projects under the guidance of experienced mentors. Top participants get exciting goodies and opportunities.

  • GirlScript Summer of Code 2020 witnessed overwhelming participation and the 2021 edition will carry the legacy forward while promising to be even more impactful and grand.

Girlscript Summer Of Code

Contributors:

Credits goes to these people:✨