Skip to main content

Backend Pre-Reqs

General Software Needed

Docker

NPM

Yarn

We use Yarn for this wiki. Run this after you have set up npm. You may have to re-run this if you switch NodeJS versions with NVM as listed below.

NVM / NodeJS

AWS

  • AWS Stuff - Do each step below in order. AWS CLI, SAM CLI can be installed but can’t set up credentials until OSU IT sets up your account.

    • Disclaimer: Some of the below instructions may no longer be 100% accurate in the future (last updated May 2024), as AWS is known to update their policies and web console UI periodically

    • Login here

      • If you haven't gotten your AWS account set up yet, contact a current Sustainability Office Software Intern about this, or else reach out directly to OSU IT at leanne@engr.oregonstate.edu
    • IAM (set up authorized user account): https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/users

      • Click “Add User” to begin
      • On Step 1, enter a name for your new IAM user with the format "myname-cli" (substituting your actual name for "myname"). Check the checkboxes for "Provide user access to the AWS Management Console" and then set up your IAM user's password
        • Screenshot of this step
      • On Step 2, select “Copy permissions” > copy from an existing user whose name ends with "-cli", e.g. "samantha-cli"
        • Screenshot of this step
      • On Step 3, review and then click "Create User" button
      • On Step 4, view your password if you haven't already, and then click "Return to users list"
    • IAM (get access key ID)

      • Back to the Users List page, click on the user you just created ("yourname.cli"), then click on "Create access key"
        • Screenshot of this step 1
        • Screenshot of this step 2
      • On Step 1 (next page), click "Other", then next
        • Screenshot of this step
      • On Step 2, enter a name for your access key if you want (optional), then "Create access key" button
      • On Step 3, you will see the login details of your user. Click “Show” on Secret Access key.
      caution

      Make sure to save both your Access Key ID and Secret Access Key in txt file etc. locally, you will not be able to see the Secret Access key again.

      • Screenshot of this step
    • AWS CLI (for verifying AWS credentials):

    • AWS SAM CLI (CLI for serverless backend):

IDE

  • IDE: Use any you like, VSCode is a personal favorite of mine.
    • For VSCode install appropriate extensions for Vue, Javascript, etc

MySQL Workbench

  • MySQL Workbench (for debugging database. Probably won’t need this right now tbh but good to set up.)
    • Installation: https://www.mysql.com/products/workbench/
    • New Connection (Click Plus Sign): Screenshot
    • For MySQL credentials, see here
      • Need to be paid employee of OSU Sustainability office to see above link
    • Once set up:
      • Open connection, select “energy_data” from schemas in left
      • Limit to 50,000 rows to avoid it taking too long.
      • Run test query, e.g. select * from data order by time DESC;
      • Click the lightning symbol to run query.
      • sql example

General Documentation

Get Project Running Locally

Start up the Docker Desktop (backend won’t work locally otherwise).

Open two terminal instances (or split one terminal into two panes), navigate to project directory in each.

In terminal one:

cd backend

npm install (first time only)

sam local start-api

In terminal two:

npm install (first time only)

npm run serve

Backend is locally hosted at http://localhost:3000

Frontend is locally hosted at http://localhost:8080

NOTE: Need both backend and frontend running for it to work.

Current Issues

Check shared google drive: