Offical backend of CougarCS.
-
- Install dependencies:
yarn
- Start local server:
yarn server
- The local server will start on http://localhost:4000
- Install dependencies:
-
- If you want to test out the payment or the reCAPTCHA, create a
.env
file in the root project folder. - You must have a Stripe, Google's reCAPTCHA, and SendGrid accounts.
- NEW_RELIC_ENABLED must be disabled (
NEW_RELIC_ENABLED=false
) in development. - In the
.env
file include these:
PORT SENDGRID_API_KEY CALENDAR_ID CALENDAR_API_KEY SHEET_API RECAPTCHA_SECRET_KEY STRIPE_API_KEY SENTRY_URL SEND_EMAIL NOTION_TOKEN NOTION_TUTOR_DB YOUTUBE_API_KEY YOUTUBE_PLAYLIST_ID COUGARCS_CLOUD_URL COUGARCS_CLOUD_ACCESS_KEY COUGARCS_CLOUD_SECRET_KEY NEW_RELIC_LICENSE_KEY NEW_RELIC_APP_NAME SUPABASE_URL SUPABASE_KEY
- Reach out to the Webmaster([email protected]) for the env values
- If you want to test out the payment or the reCAPTCHA, create a
-
Development Docker:
- Build the image run
docker build -t <image-name> -f Dockerfile.dev .
- Create a container run
docker run -dp <docker-port>:<external-port> --env-file .env <image-name>
- Build the image run
-
Production Docker:
- Build the image run
docker build -t <image-name> .
- Create a container run
docker run -dp <docker-port>:<external-port> --env-file .env <image-name>
- Build the image run
-
- We use ESLint to fix styling and to enforce rules.
- Run
yarn run eslint-check
to check linting issues in the code. - Run
yarn run eslint-fix
to auto-lint the code.secrets - ESLint runs on Github Action. ESLint must pass before pushing or during a pull request.
-
- SonarCloud
- Add these to your Github secrets
SONAR_ORG SONAR_PROJ_KEY SONAR_TOKEN
- Coveralls
- Snyk
- SonarCloud
-
- We use Jest to do Unit testing.
- We use Supertest to do intergeration test.
- To run the tests locally:
- Run
yarn test
- Run
- To test the coverage of the code:
- Run
yarn test:coverage
- Run
- The tests are part of the CI/CD pipeline, if the test fails the CI/CD fails
- The test coverage has to be 90% or greater and the coverage cannot drop below 5% for a PR or a push.
- We use Coveralls to track the coverage.
-
server.js
is the starting point of the applicationsrc/api/routes/
has the routes of the applicationssrc/config/app.js
sets up the middlewaressrc/utils/api/calls.js
has the api logicsrc/utils/
has config for logger and cachingtest
has the unit and the intergeration tests