Skip to content

Commit b615a20

Browse files
authored
Merge pull request #116 from bitloops/modernise/pnpm-frontend-foundation
Modernise/pnpm frontend foundation
2 parents 3b0dd4d + f64a99e commit b615a20

137 files changed

Lines changed: 13152 additions & 28470 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.

.dockerignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
.git
2+
.github
3+
.vscode
4+
**/node_modules
5+
**/dist
6+
**/coverage
7+
**/.nyc_output
8+
**/*.log
9+
**/*.tsbuildinfo
10+
**/.env
11+
**/.development.env
12+
README.md
13+
k8s

.github/dependabot.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,19 @@
55

66
version: 2
77
updates:
8-
- package-ecosystem: "npm" # See documentation for possible values
9-
directory: "/backend" # Location of package manifests
8+
- package-ecosystem: "npm"
9+
directory: "/"
1010
schedule:
1111
interval: "weekly"
1212
target-branch: "develop"
1313
labels:
1414
- "npm dependencies"
15-
- "backend"
16-
17-
- package-ecosystem: "npm"
18-
directory: "/frontend"
15+
- "workspace"
16+
17+
- package-ecosystem: "github-actions"
18+
directory: "/"
1919
schedule:
2020
interval: "weekly"
2121
target-branch: "develop"
2222
labels:
23-
- "npm dependencies"
24-
- "frontend"
23+
- "github actions"

.github/workflows/main.yml

Lines changed: 46 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,58 @@
1-
name: Node.js CI
1+
name: CI
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main ]
7+
branches: [main]
88

99
permissions:
1010
contents: read
1111

1212
jobs:
13-
build:
14-
13+
node:
14+
name: Node workspace
1515
runs-on: ubuntu-latest
16-
17-
strategy:
18-
matrix:
19-
node-version: [20.11.1]
20-
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
16+
services:
17+
postgres:
18+
image: postgres:18-alpine
19+
env:
20+
POSTGRES_DB: bitloops_test
21+
POSTGRES_USER: user
22+
POSTGRES_PASSWORD: postgres
23+
ports:
24+
- 5432:5432
25+
options: >-
26+
--health-cmd "pg_isready -U user -d bitloops_test"
27+
--health-interval 5s
28+
--health-timeout 5s
29+
--health-retries 10
2130
2231
steps:
23-
- uses: actions/checkout@v3
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: ${{ matrix.node-version }}
28-
cache: 'yarn'
29-
cache-dependency-path: backend/yarn.lock
30-
- name: Install Yarn
31-
run: npm install -g yarn
32-
- run: yarn install --frozen-lockfile
33-
working-directory: backend
34-
- name: Run build script if present
35-
run: |
36-
if grep -q "\"build\":" backend/package.json; then
37-
yarn run build
38-
else
39-
echo "Build script not found. Skipping."
40-
fi
41-
working-directory: backend
42-
- run: yarn test
43-
working-directory: backend
32+
- uses: actions/checkout@v6
33+
- uses: pnpm/action-setup@v4
34+
with:
35+
run_install: false
36+
- uses: actions/setup-node@v6
37+
with:
38+
node-version: 24
39+
cache: pnpm
40+
- run: pnpm install --frozen-lockfile
41+
- name: Build backend
42+
run: pnpm --dir backend run build
43+
- name: Lint backend
44+
run: pnpm --dir backend run lint
45+
- name: Test backend
46+
run: pnpm --dir backend run test
47+
- name: Test backend PostgreSQL integration
48+
run: pnpm --dir backend run test:integration
49+
env:
50+
PG_DATABASE: bitloops_test
51+
PG_USER: user
52+
PG_PASSWORD: postgres
53+
- name: Lint frontend
54+
run: pnpm --dir frontend run lint
55+
- name: Build frontend
56+
run: pnpm --dir frontend run build
57+
- name: Test frontend behaviour
58+
run: pnpm --dir frontend/tests run test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
.DS_Store
22
*/.env
3+
node_modules
4+
.pnpm-store
5+
*.tsbuildinfo

CHANGELOG.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Changelog
2+
3+
All notable changes to this project are documented in this file. The format is
4+
based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and the
5+
project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6+
7+
## [1.0.0] - 2026-07-31
8+
9+
### Added
10+
11+
- A pnpm workspace pinned through Corepack, with Node.js 24 and TypeScript 6.
12+
- A frontend anti-corruption layer that translates backend `completed` values
13+
into the UI model's `isCompleted` property for REST and SSE messages.
14+
- Unit and behavioural frontend tests for transport mapping and Todo state
15+
transitions.
16+
- PostgreSQL event sourcing for the Todo aggregate, including append-only
17+
events, an optimistic version check, and a query projection.
18+
- A PostgreSQL transactional outbox and retrying NATS relay for Todo domain
19+
events.
20+
- Real-PostgreSQL integration tests for atomic persistence and stale aggregate
21+
rejection.
22+
- Backend linting, database integration tests, and PostgreSQL 18 in CI.
23+
- Production-focused Node.js 24 Docker images and validated Kubernetes
24+
manifests.
25+
26+
### Changed
27+
28+
- Modernised the frontend to Vite 7, Redux Toolkit, current generated OpenAPI
29+
client tooling, and an nginx runtime image.
30+
- Modernised the backend to NestJS 11, Fastify 5, ESLint 10, Jest 30, pnpm 11,
31+
and TypeScript 6.
32+
- Consolidated IAM, Marketing, Todo projections, Todo events, and the outbox on
33+
PostgreSQL as the sole application database.
34+
- Changed external browser communication to REST and server-sent events.
35+
- Made NATS publishing awaitable, bounded failed-message redelivery, and
36+
isolated tracing delivery failures from business operations.
37+
- Aligned the root, backend, frontend, and frontend-test package versions at
38+
`1.0.0`.
39+
40+
### Removed
41+
42+
- Yarn and npm lockfiles in favour of one pnpm lockfile.
43+
- MongoDB code, dependencies, Compose services, persistent volumes, and
44+
Kubernetes resources.
45+
- The unused gRPC/protobuf generation pipeline, generated stubs, gRPC guard,
46+
and Envoy deployment resources.
47+
48+
### Security
49+
50+
- Updated direct dependencies and constrained vulnerable Fastify/Nest
51+
transitive packages to patched releases.
52+
- Stopped persisting request JWTs in Todo event or outbox metadata.

CONTRIBUTING.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ We recommend baby steps so you can get familiar with our contribution process. W
1717
If you decide to fix an issue, please be sure to check the comments in case somebody is already working on it. If there hasn’t been any activity, then leave a comment stating that you intend to work on it so other people don’t accidentally duplicate your effort.
1818
If the issue has already been claimed by someone else, but there hasn’t been any recent activity, then feel free to take over after leaving a comment.
1919

20+
Use Node.js 24 and the pnpm version pinned by the root `packageManager` field.
21+
Before opening a pull request, run the workspace gates:
22+
23+
```bash
24+
corepack enable
25+
pnpm install --frozen-lockfile
26+
pnpm build
27+
pnpm lint
28+
pnpm test
29+
```
30+
31+
Changes to Todo persistence should also include the PostgreSQL integration lane
32+
described in [`docs/backend-architecture.md`](./docs/backend-architecture.md).
33+
2034
We would also welcome any new issues you may find. We do suggest searching for the particular issue you would like to report in the existing issue list before reporting new ones. In addition, if you do encounter any vulnerability issues, please do follow our [Security Policy](https://github.com/bitloops/bitloops-language/blob/main/.github/SECURITY) instead of creating a new issue.
2135

2236
### Create a Pull Request

K8s.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,45 @@
11
# Deploying on Kubernetes
22

3-
Run the following script after making sure you have added the appropriate secrets to your configuration files located in the k8s folder:
3+
The manifests under `k8s` deploy the frontend, backend, PostgreSQL, NATS, and
4+
the observability services. MongoDB and the former Envoy/gRPC edge are no
5+
longer part of the deployment.
6+
7+
## Prepare images and secrets
8+
9+
Build and publish the application images, or load them into your local cluster:
10+
11+
```bash
12+
docker build -f backend/Dockerfile -t todo-backend:latest .
13+
docker build -f frontend/Dockerfile -t todo-frontend:latest .
14+
```
15+
16+
For a remote registry, change the image names in
17+
`k8s/deployment-todo-backend.yaml` and
18+
`k8s/deployment-todo-frontend.yaml` to immutable, registry-qualified tags.
19+
20+
Before applying the manifests, replace every development value in
21+
`k8s/secret-bl-postgres-secret.yaml`, especially `POSTGRES_PASSWORD` and
22+
`JWT_SECRET`. Do not commit production secrets. PostgreSQL is the sole
23+
application database and uses the `bitloops` database by default.
24+
25+
## Validate and apply
26+
27+
Perform a client-side validation first:
28+
29+
```bash
30+
kubectl apply --dry-run=client --validate=false -f k8s
31+
```
32+
33+
Apply the namespace and resources in dependency order with:
434

535
```bash
636
./apply_k8s_files.sh
737
```
38+
39+
The application image currently initialises its schemas idempotently at
40+
startup. For a production deployment, introduce a dedicated migration job
41+
before scaling the backend beyond one replica.
42+
43+
Keycloak is not included in the 1.0.0 manifests. Its proposed database and
44+
deployment boundary are documented in
45+
[`docs/keycloak-iam-roadmap.md`](./docs/keycloak-iam-roadmap.md).

0 commit comments

Comments
 (0)