๐๐ฒ๐๐ถ๐ด๐ป๐ถ๐ป๐ด ๐๐ป ๐๐๐ฒ๐ป๐-๐ฆ๐ผ๐๐ฟ๐ฐ๐ฒ๐ฑ ๐๐๐ฑ๐ถ๐ ๐ง๐ฟ๐ฎ๐ถ๐น
Financial software needs a strong audit trail. You need to know who did what and when. Event sourcing is the best way to do this.
It creates a log you cannot change. Replay events to fix errors or meet laws.
Your system needs these parts:
- Domain services send events.
- Kafka moves the data.
- Postgres stores the logs in partitions.
Your event data needs these fields:
- Unique ID.
- Event type.
- Timestamp.
- Correlation ID to link steps.
- JSON payload for data.
Protect private data. Do not store PII in the logs. Mask sensitive fields. Redact data when you export it.
Avoid these mistakes:
- Do not use the audit log as your main database.
- Do not skip schema versions.
- Do not store plain IDs.
Track your performance. Monitor how fast events move from the service to the store. Check for missed messages.