Skip to content

Commit 995303c

Browse files
authored
Merge branch 'develop' into develop
2 parents c819910 + 7b92a7a commit 995303c

104 files changed

Lines changed: 7357 additions & 3082 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.claude/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(yarn type-check)",
5+
"Bash(yarn test)"
6+
]
7+
}
8+
}

.claudeignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Dependencies and build output
2+
3+
node_modules/
4+
dist/
5+
coverage/
6+
7+
# Environment secrets
8+
9+
.env
10+
.env.\*
11+
!.env.example
12+
13+
# Logs
14+
15+
\*.log
16+
logs/
17+
18+
# Docker volumes / data
19+
20+
postgres-data/
21+
22+
# OS / editor noise
23+
24+
.DS*Store
25+
*.swp
26+
\_.swo
27+
28+
# Large lock files (yarn.lock is still useful for context)
29+
30+
package-lock.json
31+
yarn.lock

.github/workflows/.ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
build:
1515
runs-on: ubuntu-24.04
1616
env:
17+
FRONTEND_APP_URL: ${{ secrets.FRONTEND_APP_URL }}
1718
SIMPLYBOOK_CREDENTIALS: '{"login": "login"}'
1819
STORYBLOK_PUBLIC_TOKEN: ${{ secrets.STORYBLOK_PUBLIC_TOKEN }}
1920
STORYBLOK_WEBHOOK_SECRET: ${{ secrets.STORYBLOK_WEBHOOK_SECRET }}

.github/workflows/community-issue-comment.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
- name: Post assignee issue comment
3333
id: assigned-comment
34-
uses: actions/github-script@v8 # https://github.com/actions/github-script
34+
uses: actions/github-script@v9 # https://github.com/actions/github-script
3535
with:
3636
github-token: ${{secrets.GITHUB_TOKEN}}
3737
script: |
@@ -59,7 +59,7 @@ jobs:
5959
steps:
6060
- name: Post stale issue comment
6161
id: stale-label-comment
62-
uses: actions/github-script@v8 # https://github.com/actions/github-script
62+
uses: actions/github-script@v9 # https://github.com/actions/github-script
6363
with:
6464
github-token: ${{secrets.GITHUB_TOKEN}}
6565
script: |

.github/workflows/create-release-pr.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
runs-on: ubuntu-24.04
1515
steps:
1616
- name: Create Pull Request
17-
uses: actions/github-script@v8
17+
uses: actions/github-script@v9
1818
with:
1919
script: |
2020
const { repo, owner } = context.repo;

.github/workflows/scan-and-label-forks.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Label PR for Sensitive Files
2222
# https://github.com/actions/labeler
23-
uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b
23+
uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213
2424
with:
2525
repo-token: ${{ secrets.GITHUB_TOKEN }}
2626
configuration-path: .github/configs/labeler.yml

CLAUDE.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# Bloom Backend
2+
3+
NestJS/TypeScript REST API for a trauma-healing support platform. PostgreSQL via TypeORM, deployed on Render.
4+
5+
## Tech Stack
6+
7+
- **Runtime:** Node.js 22.x, TypeScript
8+
- **Framework:** NestJS
9+
- **Database:** PostgreSQL 17 + TypeORM 0.3.x
10+
- **Package manager:** Yarn 1.x
11+
- **Tests:** Jest (unit `*.spec.ts`, e2e in `test/`)
12+
13+
## Development
14+
15+
```bash
16+
# Start (Docker recommended)
17+
docker-compose up
18+
19+
# Or manually
20+
yarn
21+
yarn start:dev # hot reload on localhost:35001
22+
23+
# Lint / format
24+
yarn lint
25+
yarn format
26+
```
27+
28+
## Testing
29+
30+
```bash
31+
yarn test # unit tests
32+
yarn test:watch # watch mode
33+
yarn test:cov # with coverage
34+
yarn test:e2e # end-to-end
35+
36+
# Run a specific test file
37+
yarn jest src/path/to/file.spec.ts --no-coverage
38+
```
39+
40+
## Database / Migrations
41+
42+
```bash
43+
yarn migration:generate # generate migration from entity changes
44+
yarn migration:run # apply pending migrations
45+
yarn migration:revert # revert last migration
46+
yarn migration:show # show migration status
47+
```
48+
49+
Entities live in `src/entities/`. Migrations in `src/migrations/`.
50+
51+
## Project Structure
52+
53+
```
54+
src/
55+
auth/ authentication
56+
user/ user management
57+
partner/ partner orgs + access control
58+
course/ courses & user progress
59+
session/ therapy sessions & feedback
60+
resource/ learning resources
61+
subscription/ subscription management
62+
reporting/ analytics & Slack reporting
63+
webhooks/ inbound webhooks (Slack, Zapier, Mailchimp, SimplyBook)
64+
api/ outbound API clients (GA4, Mailchimp, SimplyBook, Slack, Zapier)
65+
event-logger/ event tracking
66+
firebase/ Firebase integration
67+
front-chat/ Front (chat) integration
68+
entities/ TypeORM entity definitions
69+
migrations/ TypeORM migration files
70+
utils/ shared utilities
71+
main.ts app entry point
72+
typeorm.config.ts DB connection config
73+
```
74+
75+
## Key Integrations
76+
77+
Firebase (auth), Storyblok (CMS), SimplyBook (appointments), Mailchimp (email), Slack, Front (chat/support), GA4, Rollbar (errors), New Relic (APM), Render (hosting)
78+
79+
## CI
80+
81+
GitHub Actions (`.github/workflows/.ci.yml`): Prettier → ESLint → Jest → build. Runs on PRs and pushes to `develop`.
82+
83+
## Branch Strategy
84+
85+
- `develop` — main integration branch; open PRs against this
86+
- `main` — production

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Technologies Used:
2929
- [Simplybook](https://simplybook.me/en/) - Appointment booking system used for therapy
3030
- [Slack](https://api.slack.com/messaging/webhooks) - Slack webhooks to send messages to the team
3131
- [Rollbar](https://rollbar.com/) - Error reporting
32-
- [Crisp](https://crisp.chat/en/) - User messaging
32+
- [Front](https://front.com) - User messaging
3333
- [Mailchimp](https://mailchimp.com/developer/marketing/) - Transactional email
3434
- [Docker](https://www.docker.com/) - Containers for api and db
3535
- [Render](https://render.com) - Build, deploy and operate staging and production apps

docs/configure-env.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,16 +35,18 @@ FIREBASE_MEASUREMENT_ID=
3535
# REQUIRED VARIABLES FOR TESTING
3636
#---------------------------------------------------------------
3737
# MOCK VALUES (can replace with real values or new mocks in same format)
38-
SIMPLYBOOK_CREDENTIALS='{"login":"testlogin","password":"testpassword","company":"testcompany"}'
38+
SIMPLYBOOK_CREDENTIALS='{"login":"testlogin","password":"api_user_key_customapikey","company":"testcompany"}'
3939
SIMPLYBOOK_COMPANY_NAME=testcompany
40+
SIMPLYBOOK_WEBHOOK_SECRET=generate-your-own-secret
41+
SIMPLYBOOK_TOTP_SECRET= # Required when 2FA is enabled on the Simplybook admin account
4042
4143
# OPTIONAL VARIABLES
4244
#---------------------------------------------------------------
4345
ROLLBAR_ENV=development # Rollbar logging
4446
ROLLBAR_TOKEN= # Rollbar logging
45-
ZAPIER_TOKEN= # Zapier automation
47+
ZAPIER_TOKEN= # Zapier automation (legacy - see SIMPLYBOOK_WEBHOOK_SECRET)
4648
SLACK_WEBHOOK_URL= # Slack messaging bots
47-
CRISP_TOKEN= # Crisp chat
49+
FRONT_SUPPORT_EMAIL= # (optional) Front sender address used to distinguish agent replies in chat history; defaults to support@bloom.chayn.co
4850
MAILCHIMP_API_KEY= # Email messaging
4951
RESPOND_IO_CREATE_CONTACT_WEBHOOK= # RESPOND.IO
5052
RESPOND_IO_DELETE_CONTACT_WEBHOOK= # RESPOND.IO
@@ -61,3 +63,21 @@ The frontend and backend each have _required_ and _optional_ environment variabl
6163
Note: Variables provided by Chayn are public, not linked to production, and subject to change at any time. Check for updates if you are experiencing problems. The absence of some optional environment variables may result in test failures. If you require an optional environment variable and cannot acquire it yourself (some must be connected to Chayn in some way), please reach out to the team in GitHub’s issue discussions.
6264

6365
**Please notify us if creating new environment variables in your PR so we can add it to Render before release deployment.**
66+
67+
## Simplybook Variables
68+
69+
`SIMPLYBOOK_CREDENTIALS` must be a JSON string with the following shape:
70+
71+
```json
72+
{ "login": "<api_user_key_or_login>", "password": "<password>", "company": "<company_login>" }
73+
```
74+
75+
For production, use a Simplybook **API User Key** (`api_user_key_...`) as the `login` value — this bypasses IP verification restrictions on the admin API.
76+
77+
`SIMPLYBOOK_WEBHOOK_SECRET` is the shared secret used to authenticate incoming webhooks from Simplybook at `POST /api/webhooks/simplybook-admin`. Configure the same value as the `?token=` query parameter in the Simplybook webhook callback URL:
78+
79+
```
80+
https://<your-domain>/api/webhooks/simplybook-admin?token=<SIMPLYBOOK_WEBHOOK_SECRET>
81+
```
82+
83+
`SIMPLYBOOK_TOTP_SECRET` is required when 2FA is enabled on the Simplybook admin account. It is the base32 TOTP secret shown during 2FA setup (the same secret you scan into an authenticator app). Leave unset if 2FA is not enabled.

docs/local-development.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,36 +4,40 @@
44

55
To run Bloom's backend:
66

7-
1. Install prerequisites
8-
2. Configure environment variables
9-
3. Install dependencies
10-
4. Run the app using Docker, Dev Containers, or Manually
11-
5. Populate the database
7+
1. [Install prerequisites](#1-prerequisites)
8+
2. [Configure environment variables](#2-configure-environment-variables)
9+
3. [Install dependencies](#3-install-dependencies-with-yarn)
10+
4. [Run the app using Docker, Dev Containers, or Manually](#4-run-the-app-locally)
11+
5. [Populate the database](#5-populate-the-database-and-database-migrations)
1212

1313
To test the backend:
1414

15-
- Run unit tests
16-
- Run e2e integration tests from the frontend for full-stack contributions
15+
6. [Run unit tests](#6-unit-testing)
16+
7. [Run e2e integration tests from the frontend for full-stack contributions](#7-format-and-linting)
1717

18-
## Prerequisites
18+
- [Git Flow and Deployment](#git-flow-and-deployment)
19+
- [APIs](#apis)
20+
21+
22+
## 1. Prerequisites
1923

2024
- NodeJS v22.x
2125
- Yarn v1.x
2226
- Docker and / or PostgreSQL
2327

2428
_Recommended Minimum System Requirements: CPU: Quad-core 2.5 GHz (i5/Ryzen 5), Memory: 16 GB RAM, Storage: 512 GB, OS: Linux, macOS, Windows, or WSL2 (latest versions), Internet Connection: For accessing dependencies and external APIs/services._
2529

26-
## Configure Environment Variables
30+
## 2. Configure Environment Variables
2731

2832
See [configure-env.md](configure-env.md) for instructions on configuring environment variables.
2933

30-
## Install dependencies with yarn
34+
## 3. Install dependencies with yarn
3135

3236
```bash
3337
yarn
3438
```
3539

36-
## Run the App Locally
40+
## 4. Run the App Locally
3741

3842
There are 3 methods you can use to run Bloom’s backend locally:
3943

@@ -97,7 +101,13 @@ You should see this in the shell output:
97101
Listening on localhost:35001, CTRL+C to stop
98102
```
99103

100-
## Unit Testing
104+
## 5. Populate the Database and Database Migrations
105+
106+
Populating your local database with test data is required for running Cypress integration tests and testing Bloom’s full-stack functionality.
107+
108+
See the [database-guide.md](database-guide.md) for instructions.
109+
110+
## 6. Unit Testing
101111

102112
To run all unit tests
103113

@@ -111,7 +121,7 @@ To have your unit tests running in the background as you change code:
111121
yarn test:watch
112122
```
113123

114-
## Format and Linting
124+
## 7. Format and Linting
115125

116126
Linting and formatting are provided by [ESLint](https://eslint.org/) and [Prettier](https://prettier.io/). We recommend VSCode users to utilize the workspace settings in [.vscode/settings.json](.vscode/settings.json) and install the extensions in [.vscode/extensions](.vscode/extensions.json) for automated consistency.
117127

@@ -135,12 +145,6 @@ Run format and fix:
135145
yarn format
136146
```
137147

138-
# Populate the Database and Database Migrations
139-
140-
Populating your local database with test data is required for running Cypress integration tests and testing Bloom’s full-stack functionality.
141-
142-
See the [database-guide.md](database-guide.md) for instructions.
143-
144148
# Git Flow and Deployment
145149

146150
**The develop branch is our source of truth, not main.** Fork from `develop`, create new feature branch, then when your PR is merged, `develop` will automatically merge into the main branch for deployment to production. Keep your branch updated by rebasing and merging feature/bug branches into `develop` as you code.

0 commit comments

Comments
 (0)