What problem does it solve?
It prevents business logic, database work, and error-mapping duplication from creeping into Connect RPC handlers, keeping your API layer predictable and maintainable.
Core Features & Use Cases
- Thin translation layer: validate requests, extract auth claims, convert proto ↔ internal types, call a service method, convert results back to proto, and wrap errors with svcerr.Wrap.
- Consistent error handling: maps domain failures from the service layer to the correct Connect error codes using svcerr sentinels/constructors (no per-service error-mapping helpers).
- Clear separation of concerns: enforces that validators stay pure, invariants live in services, and DB/orchestration/logging stay out of handlers.
Use Case: When adding a new RPC method, implement only the canonical six-step handler shape, delegate domain failures to internal/<svc>/contract.go using svcerr, and return stable wire responses without leaking internal details.
Quick Start
Implement your Connect RPC method handler in the handlers layer by following the six-step shape and delegating business logic and domain errors to the service contract, then wrap failures with svcerr.Wrap.