Communication Service — Local Dev Setup
Status: populated Owner: TBD Last updated: 2026-04-17 Companion: Service Template
1. Prerequisites
- Node 22 LTS, pnpm 9
- Docker 25+ and Docker Compose v2
- A running Kong edge container (from platform compose)
- Application monorepo at
D:/GhasiTech/Ghasi-eHealth(code lives underservices/communication-service/)
2. Compose recipe (excerpt)
# docker-compose.dev.yml (service fragment)
services:
comms-postgres:
image: postgres:16
environment:
POSTGRES_DB: communication
POSTGRES_USER: comms
POSTGRES_PASSWORD: comms
ports: ["5438:5432"]
nats:
image: nats:2-alpine
command: ["-js"]
ports: ["4222:4222"]
redis:
image: redis:7-alpine
ports: ["6379:6379"]
minio:
image: minio/minio
command: server /data
ports: ["9000:9000"]
jitsi:
image: jitsi/web:stable
ports: ["8000:80"]
communication-service:
build: ./services/communication-service
env_file: .env.dev
depends_on: [comms-postgres, nats, redis, minio, jitsi]
ports: ["3030:3000"]
3. Required env (.env.dev)
DATABASE_URL=postgres://comms:comms@comms-postgres:5432/communication
NATS_URL=nats://nats:4222
REDIS_URL=redis://redis:6379
OBJECT_STORE_URL=http://minio:9000
KMS_KEY_ARN=local-dev-kms
KEYCLOAK_JWKS_URL=http://keycloak:8080/realms/ghasi-dev/protocol/openid-connect/certs
SMS_DEFAULT_PROVIDER=fake
EMAIL_DEFAULT_PROVIDER=fake
PUSH_FCM_KEY_REF=fake
JITSI_BASE_URL=http://jitsi:80
JITSI_APP_SECRET=dev-secret
OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
4. Seed data
- 2 tenants (
ten_dev_clinic_a,ten_dev_clinic_b) - 8 users (2 DOCTOR, 2 NURSE, 4 PATIENT across tenants)
- 10 threads with varied states (active / escalated / archived)
- 3 virtual sessions in different states
- Test templates for
appointment_reminder,secure_message,critical_result
Run: pnpm --filter @ghasi/service-communication seed:dev
5. Common commands
pnpm --filter @ghasi/service-communication dev # start with hot reload
pnpm --filter @ghasi/service-communication test # unit + integration
pnpm --filter @ghasi/service-communication test:contract # Pact + schema
pnpm --filter @ghasi/service-communication migrate # drizzle migrate
pnpm --filter @ghasi/service-communication openapi:generate
6. Test utilities
- Fake SMS provider logs to console + appends to
/tmp/fake-sms.log— assert in E2E. - Fake push provider opens a SSE stream at
/dev/push-stream— subscribe in Playwright tests. - Jitsi dev token helper:
pnpm dev:vc:token --session <id> --role provider.
7. Troubleshooting
| Symptom | Fix |
|---|---|
ECONNREFUSED nats:4222 | docker compose up nats -d |
| 401 on every request | Re-issue dev JWT via pnpm dev:token --role DOCTOR --tenant ten_dev_clinic_a |
| Outbox lag | Restart outbox-relay process; check JetStream stream exists |
| Attachment upload stuck | MinIO bucket policy missing; run pnpm dev:minio:setup |