/Project-Allocation

This is a B.Tech Project Allocation app

Primary LanguageCSS

Project-Allocation Portal

Project Allocation Web Application for University using MEAN Stack. Projects can be floated by teachers and the students can give their preferences for these projects. In turn teachers also give their preference of students. The final allocation is done using the Gale-Shapley algorithm of stable marriages.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Pre-requisites

What things you need to install the software and how to install them

Docker setup

If you prefer to run the website using docker, install docker and docker-compose, then run docker-compose up from the root directory.

Installation

Install the following step by step in order to get a development environment up and running.

1. Node.js

Windows

Visit the nodejs website here (Install Node) and choose the windows installer option with the appropriate architecture of your computer.

Ubuntu

Refresh your local package index by typing :

$ sudo apt update

Adding the PPA of Node Source Repository :

$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

Installing Node js. This will also install npm long with node so there is no need to download npm separately.

$ sudo apt-get install nodejs

After installation verify and check the installed verison :

$ node -v

Also check the npm version :

$ npm -v

For more reference - installation instructions

CentOS 7 or Fedora

Please follow the link to install npm and node on CentOS or Fedora :

https://computingforgeeks.com/how-to-install-nodejs-on-centos-fedora/

2. MongoDB & MongoDB Compass

Windows

Please follow the instructions given in the documentation - Mongo Docs Windows

Ubuntu

MongoDB Community Edition : Please follow the instructions given in the documentation - Mongo Docs Ubuntu

MongoDB Compass : Please follow the instructions given in the documentation - MongoDB compass Ubuntu

CentOS

MongoDB Community Edition : Please follow the instructions given in the documentation - Mongo Docs CentOS

MongoDB Compass (Not required unless direct visualisation of database is needed) :

sudo yum install mongodb-compass-1.20.4.x86_64.rpm

3. Setup

Clone the repository.
SSH
git clone git@github.com:subhash011/Project-Allocation.git
HTTPS
git clone https://github.com/subhash011/Project-Allocation.git
GitHub CLI
gh repo clone subhash011/Project-Allocation
Install npx if not already installed - This can be used to run angular using the local version.
npm i -g npx

Go to the main directory of the project that is Project-Allocation Execute the following commands :

cd btp-frontend
npm ci
cd ..
cd backend
npm ci

All the dependencies will be installed which otherwise have to be installed with npm i --save packagename.

After the above steps are completed, in the backend folder, replace the 'environment.txt' file with a file named '.env' and add all the required parameters as mentioned in the environment.txt file.

Running the web app locally

Open two terminal windows and locate to Project-Allocation/btp-frontend and Project-Allocation/backend respectively one in each of the terminal.

In the terminal where you navigated to btp-frontend folder execute the following command :

npx ng serve

or

npm start

Angular will listen to the port 4200 by default and to change the port and run use npx ng serve --port PORT_NO

In the terminal where you navigated to backend folder execute the following command :

npm start

or

npx nodemon

or

node server.js

If nodemon is not installed then use npm i --save nodemon in the same terminal to install it.

Now open a web browser and go to the url http://localhost:4200 to use the web app.

Deployment

  1. Navigate to the environments folder under the src folder and open the environment.prod.ts file.

  2. apiUrl is the base URL to which angular application will be listening, GOOGLE_CLIENT_ID is the ID obtained from google developer console on registering the application

    To register the app on google's developer console follow the link given:

    https://medium.com/@pablo127/google-api-authentication-with-oauth-2-on-the-example-of-gmail-a103c897fd98
    

    when following this link choose the application type as Web Application not Others as mentioned in the link.

    Note : The GOOGLE_CLIENT_ID must be the same for the backend .env file and the btp-frontend environment.prod.ts file

  3. Define apiUrl and GOOGLE_CLIENT_ID in the environment.prod.ts file.

    Optional Steps to follow to maintain the code for various deployment stages like developement, testing, production etc.

    During the build the environment.ts file is replaced by environment.prod.ts file so we need not worry about the environment.ts file. To change the default behaviour head over to the angular.json file and under configurations, create a new configuration and define the file replacements in the file replacements array. This artice explains very well on how to use the file replacements array: https://medium.com/@balramchavan/configure-and-build-angular-application-for-different-environments-7e94a3c0af23

  4. To build the application after completing all the configuration steps, run ng build --prod.

    This is required only if the above optional steps are followed

    if you have made any file replacements run the build command accordingly. Remember to run the ng build command in the root directory of the project i.e btp-frontend.

  5. After running the build command the in step 4, the backend folder is ready to be deployed along with the necessary static files. The entire app is present in the backend folder now so it is enough to deploy this folder.

  6. For deployment instructions on centos 7 follow this link:

    https://www.terlici.com/2015/04/20/hosting-deploying-nodejs-centos.html
    

    In the given link skip the 'Little customization' part.

Built With

MEAN STACK

Authors

Acknowledgments

  • Albert Sunny