What's happening here: Type-safe - Your editor knows repo is a SnippetRepository. Full autocomplete, type checking works. Automatic cleanup - The context manager ensures the database session closes, even if an exception occurs. No global state - Every request gets its own session. No risk of one request interfering with another. Testable - Here's the magic: You override the dependency with an in-memory implementation. Your test doesn't hit the database.
At the core of oRPC's design philosophy is what the team calls "powerful simplicity." Developers can define API endpoints with a syntax that feels similar to writing standard functions, while automatically gaining production features like OpenAPI specification generation, server action compatibility, and contract-first workflow support. The library supports multiple schema validators out of the box, including Zod, Valibot, and ArkType, without requiring additional configuration.