Core Modules
The core Effect library provides the fundamental building blocks for effectful programming.Effect
TheEffect type represents a computation that may succeed with a value of type A, fail with an error of type E, or require services of type R.
Effect.succeed— Create a successful effectEffect.fail— Create a failed effectEffect.gen— Generator-based effect compositionEffect.flatMap— Sequential compositionEffect.map— Transform success valuesEffect.catch— Error recoveryEffect.provide— Provide service implementations
Schema
Define data shapes, validate unknown input, and transform values between formats. Key Features:- Elementary schemas (primitives, literals, strings, numbers)
- Composite schemas (structs, tuples, arrays, records, unions)
- Validation rules with
.check() - Transformations with
decodeToandencodeTo - Opaque types and classes
- JSON Schema generation
Stream
Effectful streams for processing sequences of values with backpressure support. Key Operations:Stream.make— Create a stream from valuesStream.fromIterable— Create from an iterableStream.map— Transform elementsStream.filter— Filter elementsStream.flatMap— Flatten nested streamsStream.runCollect— Collect all elementsStream.run— Run stream with a sink
Layer
Manage service dependencies and their lifecycles. Key Operations:Layer.succeed— Create a layer from a valueLayer.effect— Create a layer from an effectLayer.scoped— Create a scoped layer with cleanupLayer.provide— Wire layer dependenciesLayer.merge— Combine layers
Data Structures
Effect provides immutable, persistent data structures optimized for functional programming.Collection Types
Chunk— Immutable array-like collection with O(1) appendHashMap— Persistent hash map with structural equalityHashSet— Persistent hash set with structural equalityList— Linked list with efficient head operationsRedBlackTree— Ordered map with O(log n) operationsSortedSet— Ordered set with O(log n) operations
Concurrent Primitives
Queue— Concurrent queue with backpressurePubSub— Publish-subscribe messagingRef— Concurrent mutable referenceDeferred— One-time settable promiseSemaphore— Resource limiting and coordinationMutex— Mutual exclusion lock
Configuration and Resources
Config
Type-safe configuration management with environment variable support. Key Operations:Config.string— String configurationConfig.number— Number configurationConfig.boolean— Boolean configurationConfig.array— Array configurationConfig.nested— Nested configurationConfig.withDefault— Default values
Cache
Memoization and caching with TTL support. Key Features:- Time-to-live (TTL) expiration
- Size-based eviction
- Effectful lookups
- Concurrent access coordination
Scheduling and Timing
Schedule
Define retry and repeat policies with backoff strategies. Key Schedules:Schedule.forever— Repeat indefinitelySchedule.recurs— Repeat n timesSchedule.exponential— Exponential backoffSchedule.spaced— Fixed delay between runsSchedule.jittered— Add randomness to delays
Unstable Modules
Unstable modules are available undereffect/unstable/* import paths. These modules may receive breaking changes in minor releases.
HTTP & API
http— HTTP client and serverhttpapi— HTTP API definitions and routing
CLI & Processes
cli— Command-line interface toolsprocess— Process management
AI & Language Models
ai— Language model integrations (OpenAI, Anthropic, etc.)
Distributed Systems
cluster— Distributed systems primitivesrpc— Remote procedure callsworkflow— Workflow orchestration
Other Modules
observability— Tracing and metricspersistence— Data persistence layerssocket— WebSocket supportsql— SQL query buildersworkers— Worker thread management
Platform Packages
Platform-specific implementations for different JavaScript runtimes.Runtime Support
@effect/platform-node— Node.js integration@effect/platform-browser— Browser integration@effect/platform-bun— Bun runtime integration
SQL Packages
Database drivers and query builders.Supported Databases
@effect/sql-pg— PostgreSQL@effect/sql-mysql2— MySQL@effect/sql-mssql— Microsoft SQL Server@effect/sql-sqlite-*— SQLite (multiple implementations)@effect/sql-clickhouse— ClickHouse@effect/sql-libsql— LibSQL/Turso@effect/sql-d1— Cloudflare D1
Additional Resources
TypeDoc Documentation
For detailed API documentation with type signatures and examples, visit the Effect TypeDoc documentation.GitHub Repository
Explore the source code, examples, and contribute to the project on GitHub.Community
Join the Effect community:Migration Guides
Migrating from Effect v3? Check out the migration guides:Services Migration
Context.Tag → ServiceMap.Service
Error Handling
catch* renamings and patterns
Schema v4
Schema validation changes
Migration Overview
Complete v3 to v4 guide