Overview
Effect v4 is a major release with structural and organizational changes across the ecosystem. The core programming model —Effect, Layer, Schema, Stream, etc. — remains the same, but how packages are organized, versioned, and imported has changed significantly.
Key Changes
Unified Versioning
All Effect ecosystem packages now share a single version number and are released together.In v3, packages were versioned independently (e.g.
[email protected], @effect/[email protected], @effect/[email protected]), making compatibility between packages difficult to track.[email protected], the matching SQL package is @effect/[email protected]. This makes dependency management straightforward and eliminates version compatibility issues.
Package Consolidation
Many previously separate packages have been merged into the coreeffect package. Functionality from @effect/platform, @effect/rpc, @effect/cluster, and others now lives directly in effect.
Packages that remain separate are platform-specific, provider-specific, or technology-specific:
@effect/platform-*— platform packages (Node.js, Bun, Browser)@effect/sql-*— SQL driver packages (PostgreSQL, MySQL, SQLite, etc.)@effect/ai-*— AI provider packages (OpenAI, Anthropic, etc.)@effect/opentelemetry— OpenTelemetry integration@effect/atom-*— framework-specific atom bindings@effect/vitest— Vitest testing utilities
Unstable Module System
v4 introduces unstable modules undereffect/unstable/* import paths. These modules may receive breaking changes in minor releases, while modules outside unstable/ follow strict semver.
Unstable modules include:
ai— AI model integrationscli— Command-line interface utilitiescluster— Distributed computing primitivesdevtools— Development toolingeventlog— Event sourcinghttp/httpapi— HTTP client and serverjsonschema— JSON Schema utilitiesobservability— Tracing and metricspersistence— Data persistence patternsprocess— Process managementreactivity— Reactive programmingrpc— Remote procedure callsschema— Schema validation and transformationsocket— Socket programmingsql— SQL query buildingworkflow— Workflow orchestrationworkers— Worker thread management
As these modules stabilize, they graduate to the top-level
effect/* namespace.Performance and Bundle Size
The fiber runtime has been rewritten for reduced memory overhead and faster execution. The coreeffect package supports aggressive tree-shaking:
- Minimal Effect program: ~6.3 KB (minified + gzipped)
- With Schema: ~15 KB (minified + gzipped)
Core Breaking Changes
Services: Context.Tag → ServiceMap.Service
All service definition APIs have been consolidated into ServiceMap.Service.
v3
Cause: Flattened Structure
In v3,Cause<E> was a recursive tree with six variants. In v4, it’s been flattened to a simple wrapper around an array of Reason values.
v3
Error Handling: catch* Renamings
| v3 | v4 |
|---|---|
Effect.catchAll | Effect.catch |
Effect.catchAllCause | Effect.catchCause |
Effect.catchAllDefect | Effect.catchDefect |
Effect.catchSome | Effect.catchFilter |
Effect.catchSomeCause | Effect.catchCauseFilter |
Effect.catchSomeDefect | Removed |
Forking: Renamed Combinators
| v3 | v4 | Description |
|---|---|---|
Effect.fork | Effect.forkChild | Fork as a child of the current fiber |
Effect.forkDaemon | Effect.forkDetach | Fork detached from parent lifecycle |
Effect.forkScoped | Effect.forkScoped | Fork tied to the current Scope (unchanged) |
Effect.forkAll | Removed | Fork effects individually instead |
Effect.forkWithErrorHandler | Removed | Use Fiber.join or Fiber.await for error handling |
Runtime: Runtime<R> Removed
The Runtime<R> type no longer exists. Run functions live directly on Effect.
v3
Layer Memoization Across Effect.provide Calls
In v3, layers were only memoized within a single Effect.provide call. In v4, layers are automatically memoized across multiple provide calls by default.
v3
Even with automatic memoization, composing layers before providing is still the recommended pattern. The auto-memoization is a safety net, not a substitute for proper layer composition.
Schema Breaking Changes
Schema has undergone significant restructuring in v4. See the Schema migration guide for comprehensive details. Key highlights:- Variadic to array:
Union(A, B)→Union([A, B]),Tuple(A, B)→Tuple([A, B]) - Record restructure:
Record({ key, value })→Record(key, value) - Filter rename:
filter(predicate)→check(makeFilter(predicate)) - Transform restructure:
transform(from, to, { decode, encode })→from.pipe(decodeTo(to, SchemaTransformation.transform(...))) - Decode/Encode rename:
decodeUnknown→decodeUnknownEffect,decode→decodeEffect - FromSelf suffix removal:
BigIntFromSelf→BigInt,URLFromSelf→URL - validate removal*: Use
Schema.decode*+Schema.toTypeinstead
Migration Strategy
1. Update Dependencies
Update all Effect packages to matching v4 beta versions:2. Update Imports
Many imports that previously came from@effect/* packages now come from effect:
v3
3. Update Service Definitions
ReplaceContext.Tag, Context.GenericTag, and Effect.Tag with ServiceMap.Service:
4. Update Error Handling
Renamecatch* combinators:
5. Update Forking
Rename forking combinators:6. Update Schema Usage
Follow the Schema migration guide for detailed transformation patterns.Getting Help
If you encounter issues during migration:- Check the detailed migration guides for specific APIs
- Search the Effect Discord community
- Review the v4 changelog
- Open an issue on GitHub if you find bugs or documentation gaps
Remember that v4 is currently in beta. Your feedback during the beta period helps shape the final release.
