A visual, hands-on curriculum for mastering Effect.ts.
# Install dependencies
npm init -y
npm install effect typescript ts-node @types/node
# Run the examples
npx ts-node examples.ts| Module | Topic | Key Concepts |
|---|---|---|
| 01 | Core Concepts | Effect type, A/E/R parameters, Effect.gen |
| 02 | Error Handling | Typed errors, catchTag, error composition |
| 03 | Services | Context.Tag, provideService, layers |
| 04 | Resources | Scope, acquireRelease, guaranteed cleanup |
| 05 | Concurrency | Fibers, fork/join, parallel execution |
| 06 | Scheduling | Retry, repeat, exponential backoff |
| 07 | Streams | Data pipelines, transformation, running |
| 08 | Patterns | Architecture, layers, testing, best practices |
Effect = Recipe (description of what to do)
Runtime = Cook (actually executing it)
Effect<A, E, R> = Success type | Error type | Requirements
Create → Compose → Run
↑
Effect.gen
| What You Want | Effect Function |
|---|---|
| Wrap a value | Effect.succeed(value) |
| Create an error | Effect.fail(error) |
| Wrap sync code | Effect.try(...) |
| Wrap async code | Effect.tryPromise(...) |
| Compose effects | Effect.gen(function* () {...}) |
| Transform success | Effect.map(effect, fn) |
| Chain effects | Effect.flatMap(effect, fn) |
| Handle errors | Effect.catchAll / catchTag |
| Run sync | Effect.runSync(effect) |
| Run async | Effect.runPromise(effect) |
| Parallel execution | Effect.all([...], { concurrency: "unbounded" }) |
| Race | Effect.race(effect1, effect2) |
| Retry | Effect.retry(effect, Schedule.recurs(3)) |
- Start here: Read Core Concepts
- Learn errors: Error Handling
- Build real apps: Dependency Injection
- Advanced topics: Modules 4-7
- Put it together: Patterns
Happy learning! 🎉