Skip to content

raj1802/skill-tree-backend

 
 

Repository files navigation

Skill Tree Backend

Required Tools

Development Setup

Install Maven

macOS

  1. To install maven type the following command in your terminal:
    brew install maven
  2. Verify your installation using the following command:
    mvn -version
    If maven is installed correctly you should see the maven version in the terminal:
    Apache Maven 3.9.7

Windows

  1. To install Maven on Windows, we head over to the Apache Maven site to download the latest version and select the Maven zip file, for example, apache-maven-3.9.6-bin.zip.
  2. Adding Maven to the Environment Path We add both M2_HOME and MAVEN_HOME variables to the Windows environment using system properties and point them to our Maven folder.
  3. Verify the Maven installation by typing: mvn -version
  4. Then, we update the PATH variable by appending the Maven bin folder — %M2_HOME%\bin — so that we can run the Maven command everywhere.

Setup database and configure env

  • To setup the database & create a .env file run the following command in your terminal:
    make setup 
    • To edit your environment variables edit the .env file.

NOTE:

  • If you do not have make installed, run the docker-run and copy-env commands from the Makefile manually.

Install EnvFile Plugin in IntelliJ

  • To read the values from your .env you will need install the EnvFile plugin.
  • To Install the plugin to go settings > Plugins > Marketplace > EnvFile. img.png

Create a configuration in IntelliJ

  • Press the Edit configurations button on the top right of your screen img.png
  • Create a new application img.png
  • Select Java version 17, Skill tree and SkillTreeApplication img.png
  • Check EnvFile and Substitute Environment Variables img.png
  • Add path to the .env file you created above img.png
    • You should a new entry like so: img.png
    • Click on Apply and then Ok

Running your application

  • Press the Run button on the top right of your screen to run the application. img.png

Steps to authenticate a user during development

  • Run RDS backend on your local machine
  • Copy the public key from local.js (if not in local.js copy it from development.js) and add it in your .env file.
  • Run skill tree frontend, click on signin with github button
    • Once authenticated you will be redirected to localhost:4000 (skill tree frontend homepage) and a rds-session-v2-development cookie will be set in the browser which will be used for authentication when making API calls.
    • NOTE:
      • make sure that incompleteUserDetails is false for the user in firestore, else the redirect will not work as intended.

To Authenticate Yourself

Using Website - backend On Local - http://localhost:3000/auth/github/login?redirectURL=https://staging-skilltree.realdevsquad.com/tasks?v2=true This will create a cookie in your browser rds-session-v2-development

On Staging - https://staging-api.realdevsquad.com/auth/github/login?redirectURL=https://staging-skilltree.realdevsquad.com/tasks?v2=true This will create a cookie in your browser named rds-session-v2-staging

Contributing

Code Formatting

This repo uses https://github.com/diffplug/spotless/tree/main/plugin-maven#java for formatting files.

Please build using mvn compile in local or run mvn spotless:apply before pushing the code to fix any formatting errors. To check if the codebase is formatted, you can explicitly use mvn spotless:check

The Continuous Integration build for pushed commits may fail when a Pull Request is created if your code doesn't follow project's formatting guideline.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 98.9%
  • Other 1.1%