Table of Contents
Table of Contents | ||||
---|---|---|---|---|
|
Purpose
The purpose of this document is to onboard developers to the FinishLine team. To learn more about the team itself, see the Software Solutions page. To get a better idea of the goals and roles on the team, you can read the Software Solutions Charter.
Environment Setup
Time to dive into the meat of onboarding: environment setup! Note: every time you install something, please restart your CLI to be able to use it (it will probably say that what you installed is not recognized otherwise).
Project Setup
Git: What is it and why?
Git is a version control system and GitHub is an internet hosting service using the version control that Git provides. If you are not familiar with Git, you can find a great presentation on what Git is here. Some other resources include common git commands, CLI commands, and what Git is (if you get the gist you do not need to read through all of it).
In order to set up Git on your computer please follow these steps (after creating a GitHub account if you do not already have one). Make sure to do the authentication step so that your computer is tied to your GitHub account.
FINISHLINE ONLY: Now that you have Git installed and have a GitHub account, clone the repository from here to your computer, potentially using
git clone
in your preferred CLI (i.e. Terminal/Powershell; please use Powershell over Command Prompt on Windows) to pull the project down to your computer.LAUNCHPAD ONLY: Go to this invite link and follow the GitHub classroom instructions to get the repo. clone the repository to your computer using
git clone
.
NodeJS: Version
141618 PleaseEnsure that you have Node.js v18 installed. Any iteration of version 18 will do as long as it is version 18! (Make sure to pick an installer that corresponds to your operating system) https://nodejs.org/en/blog/release/v18.17.1
Check the box to install any additional tools during installation to ensure functionality with VSCode while installing (don’t worry if there are a couple errors here - this tends to happen on new installs).
After installation, confirm that the version is some variant of 18 with the command
node -v
.
NPM & Yarn
Navigate to the folder of the cloned repository using your CLI (via the cd command).
If you’re on Windows: run
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
to prevent some future problems with yarnIn your CLI, run
npm install -g yarn
.Run
yarn install
to instruct npm to install all the necessary packages.
VSCode
Download VSCode for your OS https://code.visualstudio.com/download
Database
Docker is the new method to run the database. If you’re a returning developer and still have the old way, that’s ok, you can keep using it. This way is just easier to setup! (NOTE: If you have Windows and method 1 isn’t working, move on to method 2!!!)please migrate to docker, we will be unable to support using postgres now.
Method 1
Install Docker
Download Docker Desktop for your OS and install it following the default steps (there are a few weird steps for Windows so make sure to do those).
After installation, restart your computer if required.
Once Docker is setup go to the root directory of FinishLine/Launchpad and run
yarn database:setup
Go to your Docker desktop app and the container you just made should appear. If it says “running”, then everything is working!
Method 2 (for Windows users who can’t get Docker running)
Go to https://www.postgresql.org/download/ and download Postgres
Run the installer with all defaults except: uncheck “Stack Builder” on the list of things to install, and make your password “password” when prompted.
Once it’s done, press the windows button and search for “psql” and open the thing called something like “psql command line”
press enter for everything except password, where you should type “password” then press enter
run
CREATE DATABASE nerpm;
go back to powershell and cd to the main folder of the repo, then cd to
src/backend
[Windows] run
ni .env
thenSet-Content -Path .env 'DATABASE_URL="postgresql://postgres:password@localhost:5432/nerpm?schema=public"'
If using Windows follow two more steps because Docker for Windows runs on WSL (Windows Subsystem for Linux):Install WSL by running
wsl --install
Setup wsl by launching ubuntu from the start menu
Initial Database Migration
In order to run the database for the first time, you will need to execute the following command in the CLI (make sure you’ve navigated back to the base folder of the repo!). Run
yarn prisma:reset
.This combines three commands for you:
yarn prisma:migrate
which applies all the existing database migrations to the database,yarn prisma:generate
which builds the type files for typescript so you can code with it, andyarn prisma:seed
which populates the database with test data
Refer to Software Prisma FAQ for more information about these commands.
Run and Test
To test that things are working, run
yarn install
and thenyarn start
in the CLI (in the root directory) and go to an example API route. ExampleFor Launchpad you can go tolocalhost:4001/
FinishLine:localhost:3001/users
.Then go to
localhost:3000
(FinishLine) orlocalhost:4000
(Launchpad) to see the dashboard (if it does not launch automatically)! Feel free to take a look around! You may need to open an incognito tab.
IDE: VSCode
We use VSCode at NER. You can use something else, but we won’t be able to help you if you have problems. VSCode is pretty industry standard though, so it’s very good to know.
Click
File > Open Folder
then navigate to the repo and open itThere should be a popup in the bottom right asking you if you want to install the recommended extensions. Click install.
If for some reason this doesn’t show up, the following are the mandatory VSCode extensions. You can install them manually by clicking the extensions tab on the left (it looks like building blocks) and searching for them:
And the optional ones (for a better experience):
Babel (mgmcdermott.vscode-language-babel)
Material Icon Theme (pkief.material-icon-theme)
Congrats!
You now (theoretically) have a functioning environment! Congratulations! If not, please look at the FAQ page, and if that doesn’t help, look for further help in the #software_env-setup slack channel (more info down below). Once again, here is the link to the repo (and here is the link to the outdated repo which still holds a lot of useful information).
...