Effect
Typed errors, DI, and concurrency for TypeScript
Replaces —

Who it's for
Services that call several upstream APIs benefit from typed errors, retries with backoff, and bounded parallelism, all visible in function signatures.
Your service is a thin CRUD layer where plain async and await already reads clearly.
Built-in OpenTelemetry tracing, logging, and metrics let a team connect Effect code to an existing observability stack.
You have no OpenTelemetry pipeline and do not plan to build one.
Wrap one painful area such as dependency injection, error handling, or concurrency, then expand outward as the team gains confidence.
Your team cannot absorb a new programming style right now.
The problem
TypeScript tells you what a function returns but not how it can fail. Try-catch blocks leave you with `catch (e: unknown)`, one rejected promise inside `Promise.all` can crash a whole batch, retry logic is written by hand, and dependency injection depends on decorators and magic strings. Validation gets duplicated across layers, and when production breaks there is often no tracing to explain why. Teams stitch together separate libraries for each concern, and the pieces rarely share conventions.
How it works
The Effect<Success, Error, Requirements> type records what an operation returns, what can fail, and what it needs. Failures can be short-circuited or collected, and retries run automatically with backoff.
Services are defined with types, resolved automatically, and swapped for mocks in tests. Dependencies show up in the type signature instead of hiding in decorators or global state.
Run work in parallel with limits and get automatic resource cleanup. One failure no longer leaves orphaned async operations behind, which the project names as a main cause of leaks and resource exhaustion.
Cron-like schedules, exponential backoff, and jittered retries are built in, so you state when and how many times to retry instead of writing the loop yourself.
Tracing, structured logging, and metrics collection ship with the library. The @effect/opentelemetry package connects to existing observability stacks.
Schema derives runtime validation from types, handles JSON serialization, and generates API contracts, which removes duplicated validation logic across layers. Packages also cover SQL clients, AI providers, and OpenAPI code generation.
Features
- Typed errors in function signatures
- Dependency injection with no globals
- Structured concurrency with fibers
- Scheduling and retries
- Built-in OpenTelemetry tracing
- Unified Schema validation
How to install
Install the core package from npm, with strict mode enabled in your TypeScript config setup.
npm install effectRecommended for this setup
Strengths
- Broad scope in one runtime: Async control, dependency management, error handling, and observability share one set of conventions, so you install one package instead of one per problem.
- Gradual adoption: You can wrap existing promise-based code with Effect.tryPromise and exit with Effect.runPromise, then refactor leaf modules upward instead of rewriting everything.
- Wide runtime and database coverage: Platform packages target Node.js, Bun, Deno, and the browser, and SQL clients cover PostgreSQL, MySQL, SQLite, SQL Server, ClickHouse, libSQL, and Cloudflare D1.
- Stated support policy: Effect 4.x is a long-term support release with at least three years of bug and security fixes, and stable APIs reserve breaking changes for major versions.
Trade-offs
- Unfamiliar syntax: Code uses Effect.gen, yield*, and tagged errors rather than plain async and await. The project says you can be productive in a few days, but new team members still have to learn a different style.
- Strict toolchain requirements: Effect needs TypeScript 5.9 or newer with the strict flag enabled in tsconfig.json. Node.js 18 or newer is the general minimum, and some integration packages need newer runtimes, such as Node.js 22.16 for the SQLite node client.
- Migration from v3: Moving from Effect 3.x to 4.x requires following a migration guide, and v3 source now lives on a separate branch.
- Unstable and experimental APIs: APIs marked unstable may change in minor releases, and experimental ones may change in patch releases, so pin versions if you use them.
Tech stack
FAQ
Effect is released under the MIT license, according to the GitHub repository metadata. You can use it in commercial and internal projects without a separate agreement.
Effect.gen, yield*, and tagged errors exist because they enable typed, composable errors, dependency injection with no globals, interruptible workflows, and business logic you can test in isolation. The project suggests starting by replacing await with yield*.
Yes. Wrap existing async code with Effect.tryPromise, run the program with Effect.runPromise to return to normal promises, and progressively refactor leaf modules into Effects, moving upward through the codebase.
It needs TypeScript 5.9 or newer with strict type-checking, and Node.js 18 or newer in general. Platform packages exist for Node.js, Bun, Deno, and the browser.
No single one. It is a free library covering retries, tracing, validation, and dependency injection that teams otherwise assemble from separate packages or commercial services. The maintainers' adoption partners offer paid consulting and support if you want it.