You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+70-30
Original file line number
Diff line number
Diff line change
@@ -1,14 +1,10 @@
1
-
# YSM Backend
2
-
3
-

1
+
# Your Story Matters (YSM)
4
2
5
3
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.
6
4
7
-
**Currently in active development.**
8
-
9
5
## Get Involved
10
6
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!
A [NestJS](https://nestjs.com/) API server with [Jest](https://jestjs.io/) testing.
23
+

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! ⭐
29
36
30
37
## Development
31
38
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.**
33
40
34
41
### Prerequisites
35
42
36
-
- NodeJS v12+
43
+
- NodeJS v14+
37
44
- Yarn v1.21+
38
45
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
-[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
+
39
56
### Set up local env config
40
57
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:
42
59
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.
44
61
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}
47
68
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=
49
71
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}
51
74
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` modeor if `ROLLBAR_TOKEN` is set.
76
+
ROLLBAR_ENV=local-dev
54
77
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
57
94
```
58
95
59
-
#### Env config for tests
96
+
###Set up local env config for tests
60
97
61
98
Tests will use a separate `.env.test` file which should already be present.
62
99
@@ -72,12 +109,6 @@ FIREBASE_SERVICE_ACCOUNT={value} # Same as in .env.development - the service ac
72
109
FIREBASE_WEB_API_KEY={value} # Special API key just for use in e2e tests - found in the settings page for the Firebase project
73
110
```
74
111
75
-
### Install dependencies
76
-
77
-
```bash
78
-
yarn
79
-
```
80
-
81
112
### Run locally
82
113
83
114
```bash
@@ -140,16 +171,17 @@ DEBUG=axios yarn start:dev
140
171
141
172
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.
142
173
143
-
##Running as a Docker container locally
174
+
# Running as a Docker Container Locally
144
175
145
176
You may want to run the backend service in a Docker container if:
146
177
147
178
1. You don't intend to do any development work on it and just need a running service for the frontend to access.
148
179
1. You want to test that the Docker image works as expected, e.g. if you've made any changes to the `Dockerfile`.
149
180
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:**
151
182
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.
0 commit comments