Skip to content

Commit c10884c

Browse files
committed
Update README: listed required env var vs. optional
1 parent 76cfee3 commit c10884c

File tree

5 files changed

+74
-69
lines changed

5 files changed

+74
-69
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ lerna-debug.log*
2727
*.sublime-workspace
2828

2929
# IDE - VSCode
30-
.vscode/*
30+
/.vscode
3131
!.vscode/settings.json
3232
!.vscode/tasks.json
3333
!.vscode/launch.json
3434
!.vscode/extensions.json
3535

36+
# Local env files
3637
.env.local
37-
.env
3838
.env.development
3939
.env.development.local
4040
.env.test.local

.vscode/extensions.json

-8
This file was deleted.

.vscode/settings.json

-27
This file was deleted.

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# First stage: build server app
2-
FROM node:12 as builder
2+
FROM node:14 as builder
33
ENV NODE_ENV=development
44
WORKDIR /app
55
COPY . .
66
RUN yarn install --frozen-lockfile --non-interactive
77
RUN yarn build
88

99
# Second stage: leaner image to deploy and run the built app
10-
FROM node:12-alpine
10+
FROM node:14-alpine
1111
ENV NODE_ENV=production
1212
WORKDIR /app
1313
COPY --from=builder /app/package.json /app/yarn.lock ./

README.md

+70-30
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
# YSM Backend
2-
3-
![GitHub Actions CI workflow badge](https://github.com/chaynHQ/ysm-backend/workflows/YSM%20Backend%20CI%20pipeline/badge.svg)
1+
# Your Story Matters (YSM)
42

53
Your Story Matters (YSM) is a digital companion for survivors of sexual assault launched in 2019. Formerly called YANA (You Are Not Alone) and funded by Nesta and the UK Department of Digital, Culture, Media and Sport through the Tech to Connect Challenge, YSM has curated content including recovery, moving through trauma, accessing justice through the law, stories of resilience, and allows survivors the option to create an account and save their journey.
64

7-
**Currently in active development.**
8-
95
## Get Involved
106

11-
If you would like to help Chayn and receive special access to our organization and volunteer opportunities, please [visit our Getting Involved guide](https://chayn.notion.site/Get-involved-423c067536f3426a88005de68f0cab19). We'll get back to you to schedule an onboarding call. Other ways to get involved and support us are [donating](https://www.paypal.me/chaynhq), starring this repo and making an open-source contribution here on GitHub, and supporting us on social media!
7+
If you would like to help Chayn and receive special access to our organization and volunteer opportunities, please [visit our Getting Involved guide](https://chayn.notion.site/Get-involved-423c067536f3426a88005de68f0cab19). We'll get back to you to schedule an onboarding call. Other ways to get involved and support us are [donating](https://www.paypal.me/chaynhq), starring this repo and making an open-source contribution here on GitHub, and supporting us on social media!
128

139
Our social medias:
1410

@@ -22,41 +18,82 @@ Youtube - [Chayn Team](https://www.youtube.com/channel/UC5_1Ci2SWVjmbeH8_USm-Bg)
2218

2319
LinkedIn - [@chayn](https://www.linkedin.com/company/chayn)
2420

25-
2621
# YSM Backend
2722

28-
A [NestJS](https://nestjs.com/) API server with [Jest](https://jestjs.io/) testing.
23+
![GitHub Actions CI workflow badge](https://github.com/chaynHQ/ysm-backend/workflows/YSM%20Backend%20CI%20pipeline/badge.svg)
24+
25+
A NestJS API server with Jest testing.
26+
27+
This repo serves just the YSM backend, find YSM's frontend code here: https://github.com/chaynHQ/ysm
28+
29+
**Currently in active development.**
30+
31+
## How to Contribute:
32+
33+
Before making a contribution, please follow our Contributing Guidelines in [CONTRIBUTING.md](/CONTRIBUTING.md).
34+
35+
Happy coding! ⭐
2936

3037
## Development
3138

32-
Note: if you just want to run the backend service locally and not do any development work on it, you can instead skip to the section on how to run it in a Docker container.
39+
**RECOMMENDED: You may skip ahead to the [Running as a Docker Container Locally section below](#running-as-a-docker-container-locally) if you just want to run the backend service locally and not do any development work on it.**
3340

3441
### Prerequisites
3542

36-
- NodeJS v12+
43+
- NodeJS v14+
3744
- Yarn v1.21+
3845

46+
### Technologies Used:
47+
48+
- [NestJS](https://nestjs.com/) - Node.js web framework
49+
- [Jest](https://jestjs.io/) - JavaScript testing
50+
- [Firebase](https://firebase.google.com/) - user authentication and analytics
51+
- [Rollbar](https://rollbar.com/) - error reporting
52+
- [StoryBlok](https://www.storyblok.com/) - headless CMS for pages and courses content
53+
- [Heroku](https://www.heroku.com/) - build, deploy and operate staging and production apps
54+
- [GitHub Actions](https://github.com/features/actions) - CI pipeline
55+
3956
### Set up local env config
4057

41-
Certain config values are required to run the server.
58+
For local development, create a new **`.env.development`** file and add the following environment variables:
4259

43-
For local development, create a new **`.env.development`** file and add in the following:
60+
If you're an official Chayn volunteer, please get in touch with the team for access to the environment variables.
4461

45-
```shell
46-
STORYBLOK_TOKEN={value} # The API token from Storyblok (must have 'draft' access)
62+
```
63+
# The API token from Storyblok (must have 'draft' access)
64+
STORYBLOK_TOKEN=
65+
66+
# The service account JSON object serialised into a string and then base64 encoded
67+
FIREBASE_SERVICE_ACCOUNT={value}
4768
48-
FIREBASE_SERVICE_ACCOUNT={value} # The service account JSON object serialised into a string and then base64 encoded
69+
# OPTIONAL: comma separated list of email addresses for users allowed to access preview mode (for viewing draft content from Storyblok)
70+
CONTENT_EDITOR_EMAILS=
4971
50-
CONTENT_EDITOR_EMAILS={value} # Optional. A comma separated list of email addresses of the users that are allowed to access preview mode (for viewing draft content from Storyblok)
72+
# OPTIONAL: when running in `dev` mode. Either set this to the Rollbar server token, or to `false` to disable.
73+
ROLLBAR_TOKEN={value}
5174
52-
ROLLBAR_TOKEN={value} # Optional when running in `dev` mode. Either set this to the Rollbar server token, or to `false` to disable.
53-
ROLLBAR_ENV=local-dev # Required in `production` mode or if `ROLLBAR_TOKEN` is set.
75+
# OPTIONAL: required in `production` mode or if `ROLLBAR_TOKEN` is set.
76+
ROLLBAR_ENV=local-dev
5477
55-
RATE_LIMIT_WINDOW_MS={value} # Optional. The window of time (in milliseconds) for the rate limiting to apply.
56-
RATE_LIMIT_MAX=(value) # Optional. The max number of requests (per IP address) within the window of time (above).
78+
# OPTIONAL: The window of time (in milliseconds) for the rate limiting to apply.
79+
RATE_LIMIT_WINDOW_MS={value}
80+
81+
# OPTIONAL: The max number of requests (per IP address) within the window of time (above).
82+
RATE_LIMIT_MAX=(value)
83+
```
84+
85+
**If creating new environment variables:**
86+
87+
- Check if the new environment variable must be added the [ci.yml](.github/workflows/ci.yml) file.
88+
- Note that new environment variables must be added to Heroku before release to production. Please tag staff in your issue if creating new environment variables.
89+
90+
### Install dependencies
91+
92+
```bash
93+
yarn
5794
```
5895

59-
#### Env config for tests
96+
### Set up local env config for tests
6097

6198
Tests will use a separate `.env.test` file which should already be present.
6299

@@ -72,12 +109,6 @@ FIREBASE_SERVICE_ACCOUNT={value} # Same as in .env.development - the service ac
72109
FIREBASE_WEB_API_KEY={value} # Special API key just for use in e2e tests - found in the settings page for the Firebase project
73110
```
74111

75-
### Install dependencies
76-
77-
```bash
78-
yarn
79-
```
80-
81112
### Run locally
82113

83114
```bash
@@ -140,16 +171,17 @@ DEBUG=axios yarn start:dev
140171

141172
Note: the `axios-debug-log` library used to provide this logging has only been added as a dev dependency, so this will not work in production environments.
142173

143-
## Running as a Docker container locally
174+
# Running as a Docker Container Locally
144175

145176
You may want to run the backend service in a Docker container if:
146177

147178
1. You don't intend to do any development work on it and just need a running service for the frontend to access.
148179
1. You want to test that the Docker image works as expected, e.g. if you've made any changes to the `Dockerfile`.
149180

150-
First, ensure you have the Docker service installed and running on your machine. More info on how to do this: <https://docs.docker.com/get-docker/>.
181+
**Steps to run the docker container locally:**
151182

152-
Then, follow the section on setting up your local env config, above. Note that you don't need to follow any other instructions from the previous sections (like having the prerequisites, installing dependencies, etc.) as the Docker build process will do all this for you.
183+
1. Ensure you have the Docker service installed and running on your machine. More info on how to do this: <https://docs.docker.com/get-docker/>.
184+
2. Follow the directions above on [setting up your local env config](#set-up-local-env-config). Note that you don't need to follow any other instructions from the previous sections (like having the prerequisites, installing dependencies, etc.) as the Docker build process will do all this for you.
153185

154186
Then, build the image:
155187

@@ -170,3 +202,11 @@ curl -v http://localhost:3000/api/resources
170202
```
171203

172204
… or opening the URL <http://localhost:3000/api/resources> in your browser. It should show the JSON output of the `/resources` API.
205+
206+
# License
207+
208+
This project uses the [MIT License](/LICENSE).
209+
210+
YSM and all of Chayn's projects are open-source.
211+
212+
While the core tech stack included here is open-source, some external integrations used in this project may require subscriptions.

0 commit comments

Comments
 (0)