Runnable at every step
Every lesson ships with an index.test.ts. Run it locally with pnpm test, or read the generated lesson in your browser. The type system and the test suite keep you honest.
Effect 4 · 61 lessons
Effect by Effect is a test-driven tutorial for Effect 4. Each lesson is a runnable test file — read the explanation, fill in the stubs, run the suite. You move from Effect<A, E, R> to services, layers, concurrency, streams, and production patterns used in real Effect applications.
// Effect<A, E, R>
// A = what you get on success
// E = what can go wrong
// R = what needs to be provided
//
// Three dimensions. One type. Everything else is discipline.
import { Effect } from "effect"
const divide = (a: number, b: number): Effect.Effect<number, Error, never> =>
b === 0
? Effect.fail(new Error("Cannot divide by zero"))
: Effect.succeed(a / b)
Effect.runSync(divide(10, 2))
// 5Every lesson ships with an index.test.ts. Run it locally with pnpm test, or read the generated lesson in your browser. The type system and the test suite keep you honest.
Topics appear when you need them. Context and layers come after error handling. Streams come after schedules. You build one mental model and extend it — nothing to unlearn later.
Capstones combine retries, dependency injection, schema validation, and observability. The same patterns you will find in Effect's own libraries and documentation.
Why typed errors beat try/catch, what Effect<A, E, R> describes, and how to create, compose, and run effects with pipe, Effect.gen, and the standard runners.
Context, Layer, and dependency injection — the structure Effect applications use to stay testable.
Test layers, TestClock, and assertions on Exit — test the program, not the mocks.
Fibers, interruption, Ref, queues, and semaphores — Effect's structured concurrency model in practice.
Config, observability, HTTP clients, CLI parsing, and runtimes — the path from tutorial exercises to deployable code.
61 lessons, one source tree under steps/. Read here or run locally — same content, same Effect 4 APIs.