/edu-server

See this for updated changes https://github.com/codeforcauseorg/edu-server

Primary LanguageTypeScriptMIT LicenseMIT

Edu Server

Product focuses on 100% education as well as upskilling developing countries and rural areas.

App Version License chat

Description

Education platform is a product which will strive to enable 100% education and will help in upskilling developing countries and rural areas. Edu server is a backend application written using Nestjs, it provides api endpoints which are used by Edu Client mobile application.

Table of Contents

⚙️ Tech Stack

🔨 Setup and Run

Run in Postman

Setup local repo

Let's setup the backend server on your local machine.

0. Prerequisites

  • Install Node.js
  • Install Nest cli globally
    npm i @nestjs/cli -g     
    

1. Fork repo

Fork this repo to your GitHub account

2. Clone repo

Clone the forked repo to your local machine

git clone https://github.com/<YOUR-GITHUB-USERNAME>/edu-server.git

Navigate to project directory

cd edu-server

3. Install Dependencies

npm install

4. Setup firebase admin SDK for development

  • To use the Firebase Admin SDK in the project, create a new firebase project using firebase console.
  • After creating a project, go to project settings.
  • In project settings of your newly created project there will be tab called as "Service Accounts".
  • Click on it, then it will ask to create a service account, click to create a new service account.
  • After creating a service account, click on generate new private key it will automatically download a json file.
  • Copy the json file from your downloads folder and paste it into the project src/config folder and rename it to "service.json"

5. 📡 Setup remote

  1. You will have to set up remote repositories for getting latest changes from original repository
  2. Specify a new remote upstream repository that will be synced with the fork using follwoing command :
$ git remote add upstream https://github.com/codeforcauseorg/edu-server.git
  1. Verify the new upstream repository you've specified for your fork using git remote -v
origin  https://github.com/<your-user-name>/edu-server.git (fetch)
origin  https://github.com/<your-user-name>/edu-server.git (push)
upstream        https://github.com/codeforcauseorg/edu-server.git (fetch)
upstream        https://github.com/codeforcauseorg/edu-server.git (push)

Your application setup is successfully completed!

Running the app

# development
$ npm run start

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod

# fix linting
$ npm run lint:fix

Running Tests

# lint tests
$ npm run lint

# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov

6. 📡 Setup database

Install mongodb and nestjs/mongoose. MongoDB would be the Database for the project MongoDB is a source-available cross-platform document-oriented database program. Classified as a NoSQL database program, MongoDB uses JSON-like documents with optional schemas.

https://docs.mongodb.com/manual/tutorial/install-mongodb-on-windows/ The above Url contains the detailed steps to install it locally

1)Download the installer. 2)Run the Installer and continue with the steps 3)Intsall mongodb compass also

Instead of installing MongoDB , you can also setup a mongourl for yourself and work on the project .

7. 📡 Setup Docker

Docker is a set of platform as a service products that use OS-level virtualization to deliver software in packages called containers

1).Install Docker (a devops tool) in your system https://docs.docker.com/engine/install/

2).Setup the env variables and all and check if docker desktop is working correctly or not

3).Add a mongourl to your .env file by setting a mongocluster connection through mongoDB Atlas

4).Run the command docker-compose up
Thsi will build the image and container for the project and you can see it running on your console Now you can use this to run the server for development purposes as well

📖 API Documentation

API documentation of the server endpoints are available on /api endpoint, which are build using Swagger-UI.

  • Viewing Swagger docs locally :

    • Start the server using command nest start or npx nest start, To generate a full documented DTOs running nest cli is important see here, once the server start running, go to http://localhost:5000/api.
  • Viewing Swagger docs if the server is deployed/hosted :

    • Get the deployed URL, go to http://<INSERT_DEPLOYED_URL>/api.

Contributing

Please read our Code of Conduct and Reporting Guidelines for Bug Report and Feature Request

💬 Discord

Connect with us on Discord.

💻 Potential Maintainers

Anuj Garg
Ganga Chaturvedi
Kunal Kushwaha
Abhishek Kumar

✨ Contributors

This project exists thanks to all the people who contribute.

📜 Licence

This software is open source, licensed under the MIT License.