Our Week 6 capstone: a small customer management platform for Northstar. Agents sign in, look up a customer, and record interactions (calls, emails, notes) against them. The record is saved in PostgreSQL first, then a CustomerInteractionRecordedV1 event goes out on Kafka; customer status changes publish CustomerStatusChangedV1. Access is JWT-based with AGENT and ADMIN roles.
| Layer | What we use |
|---|---|
| Frontend | Angular 19 (frontend/) |
| API | REST, documented with OpenAPI |
| Backend | Spring Boot 3.3, Java 21 (backend/, package com.northstar.crm) |
| Database | PostgreSQL 16, schema managed by Flyway |
| Events | Kafka, topics crm.customer.interactions.v1 and crm.customer.lifecycle.v1 (+ .DLT) |
| Security | Spring Security JWT resource server (HS256), roles AGENT / ADMIN |
| Observability | Actuator liveness/readiness, correlation id (X-Correlation-Id) in every log line |
| CI/CD | GitHub Actions |
| Containers | Docker, Docker Compose for local dev |
| Deploy | Shared k3s cluster |
| Infra | Terraform and Ansible |
You need Docker (Docker Desktop on a Mac, running), JDK 21, Maven, and Node 20+.
cp .env.example .env # local only, never commit .env
docker compose up -d # Postgres 16 + single-node KafkaBackend (first terminal):
cd backend
mvn clean verify # unit, MockMvc, security, JPA, API, and Kafka integration tests
# (Testcontainers: needs Docker running, e.g. Docker Desktop)
SPRING_PROFILES_ACTIVE=local SERVER_PORT=8081 mvn spring-boot:run
# API on http://localhost:8081 (frontend dev env points here)Frontend (second terminal):
cd frontend
npm ci
npx ng serve # UI on http://localhost:4200Same steps, with Docker Desktop running. PowerShell sets environment variables with
$env:NAME = "value"; they last until that terminal is closed.
Copy-Item .env.example .env # local only, never commit .env
docker compose up -d # Postgres 16 + single-node KafkaBackend (first terminal):
cd backend
mvn clean verify
$env:SPRING_PROFILES_ACTIVE = "local"
$env:SERVER_PORT = "8081"
mvn spring-boot:run # API on http://localhost:8081Frontend (second terminal):
cd frontend
npm ci
npx ng serve # UI on http://localhost:4200Selenium e2e (third terminal for the server, then npm run e2e in another):
cd frontend
$env:CRM_E2E_API_TARGET = "http://localhost:8081"
npm run e2e:serveFind what is holding a port (the Windows version of the lsof check below):
Get-NetTCPConnection -State Listen -LocalPort 5432,9092,8081,4200 | Select-Object LocalPort, OwningProcess,
then Get-Process -Id <OwningProcess>.
scripts/smoke-crm.sh is a bash script; run it from Git Bash or WSL.
The backend refuses to start without CRM_JWT_SECRET. The local profile
(backend/src/main/resources/application-local.yml) supplies throwaway dev-only values:
| User | Roles | Local-profile password |
|---|---|---|
agent |
AGENT | agent-local-dev |
admin |
AGENT, ADMIN | admin-local-dev |
Open http://localhost:4200, sign in as agent, and pick Look up a customer on the home
screen to search. Only admin
can close a customer or reopen a closed one, whether by the close button or by setting the
status in the edit form (the API returns 403 for agent; the UI hides those options).
Health: GET /actuator/health/readiness and /actuator/health/liveness (public).
Selenium UI test: see frontend/e2e/README.md.
Changing the look: site-wide styles are in frontend/src/styles.css, the header in
frontend/src/app/app.component.html / .css, and each page's styles in its feature folder
(customer-pages.component.css for the customer pages, interaction-list-page.component.css
for the interaction pages, login-page.component.css for sign-in).
Test data:
| Customer id | Who |
|---|---|
CUS-1001 |
Amina Khan |
CUS-1002 |
Ravi Singh |
CUS-9999 |
Doesn't exist, should come back 404 |
The API lives under /api/v1/customers and /api/v1/interactions. Get a token from
POST /api/v1/auth/login ({"username":"agent","password":"..."}) and send it as
Authorization: Bearer <jwt>; tokens expire after 15 minutes. Default correlation id is
lab-request-001. Details: docs/lab51/security-and-observability.md.
To stop everything: docker compose down (add -v to wipe the database).
- Port already in use (
port is already allocatedfrom Compose, orPort 4200 is already in usefromng serve): runlsof -nP -iTCP:5432 -iTCP:9092 -iTCP:8081 -iTCP:4200 -sTCP:LISTENanddocker ps. Stop the other project's container (docker stop <name>; its data is kept) or process, or run Angular on 4201 (npx ng serve --port 4201). The backend only allows browser origins 4200 and 4201 (onlocalhostor127.0.0.1), so other ports get a CORS 403 on login. 127.0.0.1:4200does not load:ng serveis set to listen on127.0.0.1inangular.json, so bothhttp://localhost:4200andhttp://127.0.0.1:4200work. An older checkout listened only on IPv6::1, where onlylocalhostworked.- Login fails or the app shows the old demo-token screen: an old backend is still running
on 8081. Stop it (Ctrl+C, or
pkill -f spring-boot:run), start it again with the command above, and hard-refresh the browser. - Selenium (
npm run e2e) times out on/customers: start the e2e server withCRM_E2E_API_TARGET=http://localhost:8081 npm run e2e:serve. The proxy defaults to 8080. - Smoke script against a laptop backend: set
CRM_SMOKE_SKIP_FRONTEND=true, or it fails with a 401 on/:CRM_BASE_URL=http://localhost:8081 CRM_SMOKE_SKIP_FRONTEND=true CRM_SMOKE_PASSWORD=agent-local-dev bash scripts/smoke-crm.sh docker buildfails on a missing JAR ordist/: the Dockerfiles only copy prebuilt output. Runmvn clean verifyinbackend/andnpx ng buildinfrontend/first, thendocker build -t northstar-crm-backend:local backendanddocker build -t northstar-crm-frontend:local frontend.
backend/ Spring Boot API, JPA entities, Flyway migrations, Kafka publisher
frontend/ Angular app: login, interceptors, customer + interaction screens, e2e/ Selenium test
docs/ Architecture, ADRs, plans, backlog, lab notes
defense/ Lab 52 demo and defense packet
reports/ Sanitized evidence (test runs, scans, deploy/smoke/rollback)
compose.yaml Local Postgres + Kafka
- docs/ — planning pack and lab notes
- Lab 48 planning pack index — every Lab 48 deliverable, file and status
- Architecture
- AI usage plan
- Environment strategy
- GitHub Actions plan
- Terraform / Ansible plan
- Backlog
- ADRs · NFRs · Risk register · Team roles
- Lab 49 backend notes · Lab 50 frontend + persistence notes
- Lab 51 CI/CD runbook
- Lab 51 security and observability — roles, endpoint matrix, negative tests, health
- reports/ — sanitized test, scan, and deploy evidence
- Customer management — customer CRUD slice (scope, design, tests)
- defense/ — Lab 52 presentation packet
- CAPSTONE-BRIEF-AND-RUBRIC.md — the course brief and self-check rubric
- Branch off
main, one issue per branch, PR back intomainwith one non-author review. - Diagrams are Mermaid in the markdown, not image exports.
- Secrets stay out of git.
.envis ignored; only.env.exampleis committed.