Backend
Target backend: Spring Boot service with PostgreSQL, Flyway, security, and contract verification.
Responsibilities
- Enforce authentication and authorization.
- Validate API requests.
- Apply domain rules in transactions.
- Own database migrations.
- Ingest append-only asset events idempotently.
- Expose read models for web and mobile.
- Emit audit records for sensitive operations.
Target Stack
| Concern | Choice |
|---|---|
| Runtime | Java LTS |
| Framework | Spring Boot |
| Database | PostgreSQL |
| Migrations | Flyway |
| Integration tests | Testcontainers |
| API contract | OpenAPI |
| Observability | Actuator, structured logs, trace IDs |
Package Shape
apps/backend/src/main/java/.../
├── asset/
├── auth/
├── custody/
├── maintenance/
├── document/
├── finance/
├── compliance/
└── shared/
Prefer business modules over technical-only folders.
Build Targets
Planned commands:
./gradlew test
./gradlew bootRun
./gradlew bootBuildImage
Required Tests
- Domain unit tests.
- Repository integration tests with Testcontainers.
- REST validation and contract tests.
- Authorization tests for every protected endpoint.
- Migration tests against realistic data.
Security Notes
- Never expose JPA entities as API responses.
- Never log passwords, tokens, or secrets.
- Configure CORS only for known web origins.
- Use narrow database privileges in staging and production.