Project · Microservices · Document dispatch
Swisslife
A platform that sends personal documents to thousands of people, gets each one to verify with a one-time code, and tracks every step for compliance.
- Period
- 2025 - 2026
- Role
- Backend engineer
- Client
- Insurance / financial-services domain client.
10
services from one monolith
8
JetStream streams in the event bus
1
command to start the full local stack
0
shared databases between services
Problem
Insurance work means sending personal documents - policy updates, claim packs, statements - to thousands of people at once, and proving who opened what, when. Email by itself isn't enough: the recipient needs to verify they are who they say they are before any document is shown. The system needed bulk dispatch, time-limited personal links, one-time codes via SMS or email, an unforgeable audit trail, scheduled reminders, and an export-ready report for compliance reviews.
Approach
- 01
Split the platform into one service per concern: login, settings, the campaigns themselves (envoi), recipients, documents, email, reminders, one-time codes, reports, audit. Each service owns its own database - no shared tables, no hidden coupling.
- 02
Wired every service to a message bus so anything that happens - an email opened, a code verified, a document downloaded - fires an event that the audit service catches and writes into an unalterable time-series log.
- 03
Consolidated two separate one-time-code systems into a single authority service; every other service now asks for codes over gRPC instead of duplicating the logic.
- 04
Designed the reporting service to pull from each service's database read-only, generate a four-sheet Excel workbook (summary, recipients, events, analytics) with charts inline, and cache the result for an hour so big workbooks don't get regenerated for every click.
- 05
Configured Kong gateway in declarative mode - every route, every rate limit, every plugin is checked into git, no runtime config drift.
- 06
Stood up Prometheus, Grafana, and Jaeger in the dev compose so observability is wired before the first feature ships, not after the first outage.
Stack
- Go 1.24 (9 services) · NestJS/TypeScript (email service)
- PostgreSQL · MongoDB (documents + audit) · Redis (sessions, OTP cache, report cache)
- NATS JetStream (8 streams)
- Kong gateway (DB-less, declarative)
- MinIO (document storage)
- Twilio (SMS OTP) · SMTP (email)
- Prometheus · Grafana · Jaeger
Lessons
- Stand up the observability stack before the first service ships. Adding tracing after an outage is twice the work and you've already missed the bug.
- One-time codes should live in exactly one service. Every other service that needs them calls over gRPC. Duplicate OTP systems are a refactor waiting to happen.
- Kong's declarative config is the right abstraction for cross-cutting concerns - auth, rate limit, body validation, OpenAPI rewrites all in version-controlled YAML, never in a clicked-through admin panel.