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
mainfor 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
maininto 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
mainso 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