Overview
ff-effect is a utilities package that provides Effect.ts-first wrappers for popular libraries:
- AI SDK - Effectful wrappers for AI SDK’s
generateText,streamText, andtoolwith automatic callback bridging - Drizzle - Type-safe database operations with built-in transaction support
- Inngest - Background job orchestration with Effect-based function handlers
- oRPC - RPC procedures backed by Effect
Installation
Peer Dependencies
Depending on which integrations you use, install the corresponding peer dependencies:Core Utilities
The package exports three core utilities:extract
Extract services from an Effect function to move dependencies up the stack. This is particularly useful when building service containers that expose methods requiring services.runPromiseUnwrapped
Run an Effect as a Promise, automatically unwrapping errors fromCause to throw them directly.
wrapClient
Wrap any Promise-based client with consistent Effect error handling.Integration Modules
Each integration is available under a separate export path:- AI SDK Integration - Effect wrappers for AI SDK functions
- Drizzle Integration - Database operations with transactions
- Inngest Integration - Background jobs with Effect
- oRPC Integration - RPC procedures with Effect handlers
Type Safety
All utilities preserve full type inference and provide compile-time safety:- Service dependencies are tracked in the
Rtype parameter - Errors are represented in the
Etype parameter - Success values flow through the
Atype parameter