Welcome to the RHS platform repository!
Backend Language: TypeScript (Express.js on Node.js)
Backend API: GraphQL
Database: MongoDB
User Auth: Opt-in
File Storage: Opt-in
The frontend is a React application written in TypeScript.
- π Documentation
- π¨βπ» Getting Started
- π File STructure
- π³ Version Control Guide
This repository was setup using Blueprint's starter-code. To connect to all the services we use, we use .env
files that keep track of keys, urls, and more. Make sure you have a .env
file in the following locations:
./.env
(the main folder)./frontend/.env
./e2e-tests/.env
(optional)
Once you have these, build and run the system using:
docker-compose up --build
To run the linter, use the following commands while the docker containers are running:
- Mac
docker exec -it RHS-frontend /bin/bash -c "yarn fix"
docker exec -it RHS-backend /bin/bash -c "yarn fix"
- Windows
docker exec -it RHS-frontend bash -c "yarn fix"
docker exec -it RHS-backend bash -c "yarn fix"
Or, if you have yarn installed locally, running yarn fix
should work as well.
rowan-house
βββ .github/ # Config for issue/PR templates & GA workflows
βββ backend/ # Backend (Node/Apollo/Express?)
β βββ graphql/ # Main backend funcitonality
β β βββ resolvers/ # Defines Queries and Mutations (uses services)
β β βββ types/ # GraphQL Types (inside gql strings)
β β βββ index.ts # Entry point (called by server.ts)
β β # - Outlines all Queries and Mutations one can call on
β βββ middlewares/ # Defines functions that run before an API call is resolved (e.g ensures auth)
β β βββ validators/ # ?
β βββ models/ # Defines MongoDB schema and interfaces
β βββ services/ # Defines interaction with core serices (e.g. Mongo, Firebase)
β β βββ implementations/ # Service helpers definitions
β β βββ interfaces/ # Service helpers declarations
β βββ testUtils/ # ?
β βββ utilities/ # Helper functions for 3rd party utilities
β βββ server.ts # Entry point (where the 'code' starts)
β βββ types.ts # Defines backend types
βββ db-init/ # ?
βββ e2e-tests/ # Tests to confirm starter-code setup is working
βββ frontend/ # Frontend (React)
β βββ public/ # Everything in here is directly put at the url (e.g. index.html)
β βββ src/ # Source of frontend
β βββ APIClients/ # Helpers for interacting with the backend
β βββ components/ # Building blocks for the website (e.g. buttons, pages)
β βββ constants/ # Simple constants (e.g. routes)
β βββ contexts/ # Global frontend data (a.k.a React contexts)
β βββ reducers/ # ?
β βββ types/ # Frontend type definitions
β βββ utils/ # Helper functions for 3rd party utilities
β βββ App.tsx # "Main page" - Routing Definition
β βββ index.tsx # Entry point (called by index.html, uses App.tsx)
βββ hooks/ # Git hooks
- Branch off of
main
for all feature work and bug fixes, creating a "feature branch". Prefix the feature branch name with your name. The branch name should be in kebab case and it should be short and descriptive. E.g.sherry/readme-update
- To integrate changes on
main
into your feature branch, use rebase instead of merge
# currently working on feature branch, there are new commits on main
git pull origin main --rebase
# if there are conflicts, resolve them and then:
git add .
git rebase --continue
# force push to remote feature branch
git push -f
- Commits should be atomic (guideline: the commit is self-contained; a reviewer could make sense of it even if they viewed the commit diff in isolation)
- Trivial commits (e.g. fixing a typo in the previous commit, formatting changes) should be squashed or fixup'd into the last non-trivial commit
# last commit contained a typo, fixed now
git add .
git commit -m "Fix typo"
# fixup into previous commit through interactive rebase
# x in HEAD~x refers to the last x commits you want to view
git rebase -i HEAD~2
# text editor opens, follow instructions in there to fixup
# force push to remote feature branch
git push -f
- Commit messages and PR names are descriptive and written in imperative tense1. The first word should be capitalized. E.g. "Create user REST endpoints", not "Created user REST endpoints"
- PRs can contain multiple commits, they do not need to be squashed together before merging as long as each commit is atomic. Our repo is configured to only allow squash commits to
main
so the entire PR will appear as 1 commit onmain
, but the individual commits are preserved when viewing the PR.
1: From Git's own guidelines