Codes: A lightweight JVM library for stable application outcomes
Codes – typed application outcomes for Kotlin and Java
Codes is a zero-dependency Java 17+ library that gives applications stable outcome identities and explicit mappings to protocols like HTTP and gRPC. It lets you define domain-specific outcomes (e.g., PAYMENT_DECLINED) and map them to status codes without coupling your domain model to a framework. Includes standard outcome catalogs, structured issues, and Kotlin-friendly APIs.
A domain outcome can keep the same identity across boundaries: com.example.payments:PAYMENT_DECLINED | +-- HTTP 422 +-- gRPC FAILED_PRECONDITION +-- logs/metrics keep PAYMENT_DECLINED