Effect v3
Purpose
Use this as the source of truth for Effect v3 guidance. The examples target
effect@3.22.1. Check the project's installed minor version before using an
API added late in v3.
Routing Rules
- Do not read this handbook linearly.
- Pick one target file below.
- Follow
See alsoonly if that file is insufficient. - For Schema work, read
topics/schema.md, then the one specialized Schema file that matches the task. - For implementation or review, finish with the final consistency audit.
Quick Picks (Task -> File)
- Work with Schema ->
topics/schema.md, then its task-specific route - Handle
Option/Eithercontrol flow ->topics/option-either.md - Batch or cache data fetches with requests ->
topics/request-resolver.md - Build a CLI command ->
sections/20-cli.md - Configure CLI options/flags ->
topics/cli-options.md - Configure CLI positional args ->
topics/cli-args.md - Build interactive CLI prompts ->
topics/cli-prompt.md - Define HTTP endpoint + handler ->
sections/30-http-server.md - Build route-first HTTP app ->
topics/http-router.md - Derive typed HTTP client ->
topics/http-derive-client.md - Call external HTTP APIs ->
topics/http-client.md - Add Swagger/OpenAPI docs ->
topics/http-swagger.md - Handle multipart upload ->
topics/http-multipart.md - Implement streaming HTTP endpoint ->
topics/http-streaming.md - Use FileSystem/Path/Url/Terminal/KeyValueStore/Ndjson/Worker ->
sections/40-platform.md - Configure a child process environment ->
sections/40-platform.md - NDJSON encode/decode streams ->
topics/platform-ndjson.md - Worker/WorkerRunner setup ->
topics/platform-worker.md - Run Stream into platform sink ->
topics/platform-stream-sink.md - Add typed RPC client/server ->
topics/rpc.md - Export telemetry with OpenTelemetry ->
topics/opentelemetry.md - Run SQL queries / transactions / streams ->
topics/sql-client.md - Configure SQL database drivers ->
topics/sql-drivers.md - Build schema-backed SQL resolvers ->
topics/sql-resolver-schema.md - Run SQL migrations ->
topics/sql-migrations.md - Write Effect tests ->
sections/50-testing.md - Use @effect/vitest modes ->
topics/testing-vitest.md - Retry/repeat policy ->
topics/schedule-retry.md - Stream processing ->
topics/stream.md - Context/Layer wiring ->
topics/layer-context.md - Queue producer-consumer ->
topics/queue.md - HTTP middleware/auth ->
topics/http-middleware.md - Config/env vars ->
topics/config.md - Build or traverse a graph ->
topics/graph.md
By Domain
- Core (Effect, Schema, Option/Either, requests) ->
sections/00-foundations.md,sections/10-core-patterns.md,topics/schema.md,topics/option-either.md,topics/request-resolver.md - CLI (Command, Options, Args, Prompt) ->
sections/20-cli.md - HTTP (HttpApi, HttpApiBuilder, HttpRouter, HttpClient) ->
sections/30-http-server.md,topics/http-router.md,topics/http-client.md - SQL (
@effect/sql, drivers, resolvers, migrations) ->topics/sql-client.md,topics/sql-drivers.md,topics/sql-resolver-schema.md,topics/sql-migrations.md - Platform (FileSystem, Path, Url, Terminal, KeyValueStore, Ndjson, workers) ->
sections/40-platform.md - Distributed / observability (
@effect/rpc, OpenTelemetry exporters) ->topics/rpc.md,topics/opentelemetry.md - Testing (it.effect, it.live, it.scoped, TestClock) ->
sections/50-testing.md
By Primitive
Schema/Schema.Class/Schema.TaggedError->topics/schema.mdOption/Either->topics/option-either.mdRef/SynchronizedRef/FiberRef->topics/refs.mdCause/Exit->topics/cause-exit.mdSTM->topics/stm.mdScope/resource safety ->topics/scope-resource.mdDeferred->topics/deferred.mdSemaphore->topics/semaphore.mdCache->topics/cache.mdMatch->topics/match.mdLogger/Metric/tracing ->topics/observability.mdRequest/RequestResolver->topics/request-resolver.md- Concurrency/fibers/racing ->
topics/concurrency.md - Latch ->
topics/latch.md Stream(async iterables, pagination) ->topics/stream.mdSchedule(retry, repeat, backoff) ->topics/schedule-retry.mdLayer/Context(dependency injection) ->topics/layer-context.mdQueue(producer-consumer, back-pressure) ->topics/queue.mdPubSub(broadcast to subscribers) ->topics/pubsub.mdHttpApiMiddleware(auth, logging) ->topics/http-middleware.mdHttpClient/HttpClientRequest->topics/http-client.mdHttpRouter/HttpServer->topics/http-router.mdHttpApiClientderivation ->topics/http-derive-client.md- OpenAPI/Swagger ->
topics/http-swagger.md - Multipart ->
topics/http-multipart.md - HTTP streaming ->
topics/http-streaming.md - NDJSON ->
topics/platform-ndjson.md - Worker/WorkerRunner ->
topics/platform-worker.md - Stream + Sink integration ->
topics/platform-stream-sink.md RpcGroup/RpcServer/RpcClient->topics/rpc.mdNodeSdk/Otlp->topics/opentelemetry.mdSqlClient/ SQL fragments / transactions / streams ->topics/sql-client.md- SQL driver layers (
PgClient,MysqlClient,SqliteClient, etc.) ->topics/sql-drivers.md SqlResolver/SqlSchema->topics/sql-resolver-schema.md- SQL migrators (
PgMigrator,SqliteMigrator, etc.) ->topics/sql-migrations.md - Vitest integration ->
topics/testing-vitest.md Config(env, typed config) ->topics/config.mdGraph->topics/graph.md
Section Index
sections/00-foundations.md: Effect type, creation, composition, run boundariessections/10-core-patterns.md: Layers, retries, refs, concurrency, streamssections/20-cli.md: Command, Options, Args, Prompt, subcommandssections/30-http-server.md: HttpApi, HttpApiEndpoint, HttpApiBuildersections/40-platform.md: platform services, commands, clients, servers, workerssections/50-testing.md: it.effect, it.live, it.scoped, TestClock
Topic Index
topics/schema.md: Schema routing and boundary rulestopics/schema-basics.md: decoded and encoded types, decoding, encodingtopics/schema-primitives.md: primitives and composite schemastopics/schema-deriving.md: pick, omit, partial, extend, renametopics/schema-optional-defaults.md: optional fields,Option, defaultstopics/schema-unions-recursion.md: unions, discriminators, recursiontopics/schema-validation.md: filters, brands, effectful checks, constructorstopics/schema-transformations.md: transformations and compositiontopics/schema-context.md: service-backed parsing and requirementstopics/schema-classes-errors.md: classes, tagged models, errorstopics/schema-serialization.md: JSON, bytes, and redacted valuestopics/schema-tooling-errors.md: errors, metadata, generated toolingtopics/option-either.md: Option/Either control flow and pure errorstopics/refs.md: Ref, SynchronizedRef, FiberReftopics/cause-exit.md: Cause, Exit, failure inspectiontopics/stm.md: STM transactions, TReftopics/scope-resource.md: Scope and resource safetytopics/deferred.md: Deferred, one-shot signalingtopics/semaphore.md: Semaphore and bounded concurrencytopics/cache.md: Cache, TTL, lookuptopics/match.md: exhaustive pattern matchingtopics/graph.md: graph construction and traversaltopics/observability.md: Logger, Metric, tracingtopics/request-resolver.md: request batching, dedupe, cachingtopics/concurrency.md: concurrency, fibers, racing, interruptiontopics/latch.md: latch gating and releasetopics/stream.md: stream creation, transformation, consumptiontopics/schedule-retry.md: retry and repeat schedulestopics/layer-context.md: Context.Tag, Layer, dependency compositiontopics/queue.md: queues and back-pressuretopics/pubsub.md: broadcast to subscriberstopics/http-middleware.md: HttpApi middlewaretopics/http-client.md: outgoing HTTPtopics/http-router.md: route-first HTTP serverstopics/http-derive-client.md: typed clients from HttpApitopics/http-swagger.md: Swagger and OpenAPItopics/http-multipart.md: multipart payloadstopics/http-streaming.md: streaming requests and responsestopics/platform-ndjson.md: NDJSON channelstopics/platform-worker.md: worker pools and WorkerRunnertopics/platform-stream-sink.md: Stream to Sink integrationtopics/rpc.md: typed RPC clients and serverstopics/opentelemetry.md: OpenTelemetry exporterstopics/sql-client.md: SQL queries, fragments, transactions, streamstopics/sql-drivers.md: SQL driver layerstopics/sql-resolver-schema.md: SQL resolvers and schema queriestopics/sql-migrations.md: SQL migratorstopics/cli-options.md: option constructors and combinatorstopics/cli-args.md: argument constructors and combinatorstopics/cli-prompt.md: interactive promptstopics/testing-vitest.md: Effect-aware Vitest modestopics/config.md: typed configuration
Conventions
- Section and topic paths are relative to this file.
- Follow
See alsoonly when the selected file does not answer the task.
Final consistency audit
Before finishing an Effect implementation or review, inspect the complete change for:
- Direct
node:*,process.*, current time, randomness, or global environment access that should use an Effect service or explicit dependency. - Native APIs used for required semantics that Effect does not expose. Keep them at the platform edge and state the reason.
- Hidden service inputs and platform layers provided inside implementations instead of at the runtime edge.
- Manual promise lifecycles,
try/finally, or cleanup that should be scoped. catchhandlers that only log, render, set metadata, or returnvoid.- Broad
mapError,unknown,instanceof,catchDefect, ororDieusage that hides a narrower typed failure boundary. - Cleanup that suppresses a required failure or replaces the original result.
- Missing, empty, malformed, partial, and complete outcomes that callers need to distinguish.
- Normalization or disclosure of opaque and redacted values.
- Pure transformations coupled to Effect or output.
- One-use Effect wrappers, copied result types, or tests of implementation shape instead of public behavior.
- Repeated tests that should use
it.effect.each, and missing boundary, cleanup, or exact-value-preservation cases.
When to Use This Handbook
- Implementing Effect-based services, CLIs, HTTP APIs, or tests
- Looking up primitives (Schema, Option, Either, Stream, Schedule, Queue, Layer, Config)
- Building outgoing HTTP clients or route-first HTTP apps
- Using request batching / caching or typed RPCs
- Running SQL queries, transactions, migrations, or database-backed resolvers
- Resolving common pitfalls (run boundaries, retry layers, auth middleware)
- Choosing between similar primitives (Queue vs PubSub, Ref vs STM)
- Debugging Effect execution (run boundaries, fiber interruption, scoped resources)
Package References
effect: core runtime@effect/cli: Command, Options, Args, Prompt@effect/platform: HttpApi, HttpClient, HttpRouter, platform services@effect/platform-node: NodeContext, NodeHttpServer, NodeRuntime@effect/rpc: typed RPC groups, protocols, middleware@effect/opentelemetry: OTEL SDK and OTLP exporters@effect/vitest: it.effect, it.live, it.scoped@effect/sql: shared client, statements, schemas, resolvers, migrations@effect/sql-pg: PostgreSQL driver@effect/sql-mysql2: MySQL driver@effect/sql-mssql: Microsoft SQL Server driver@effect/sql-clickhouse: ClickHouse driver@effect/sql-libsql: libSQL driver@effect/sql-d1: Cloudflare D1 driver- SQLite drivers:
@effect/sql-sqlite-node,@effect/sql-sqlite-bun,@effect/sql-sqlite-wasm,@effect/sql-sqlite-react-native,@effect/sql-sqlite-do - SQL adapters:
@effect/sql-drizzle,@effect/sql-kysely
Specialized Packages Not Yet Routed In Detail
@effect/cluster@effect/workflow@effect/experimental
If one of these appears in a task, consult the reference repository first. This handbook does not have dedicated topic files for them.