What problem does it solve?
Effect-TS concurrency patterns help developers implement robust, efficient concurrent workflows by providing reusable abstractions for common coordination tasks.
Core Features & Use Cases
- Race: Use Effect.race to obtain the fastest result while interrupting losers; suitable for multi-source queries or timeouts.
- Rate Limiting: Use Semaphore to cap concurrent operations to prevent resource exhaustion (DB connections, API limits).
- Shared State: Use Ref to safely mutate shared state across fibers with atomic updates.
- Parallel Composition: Use Effect.all and Effect.forEach to process independent tasks in parallel with optional concurrency limits.
- Coordination: Use Latch for barrier synchronization among workers; fan-out/fan-in patterns.
- Event Broadcasting: Use PubSub to publish events to multiple subscribers in a decoupled fashion.
Quick Start
Experiment by implementing small TS examples that demonstrate racing data sources, limiting concurrency with a Semaphore, incrementing a shared Ref across fibers, running a batch of tasks in parallel with Effect.forEach, coordinating with a Latch, and broadcasting events via PubSub. Install the Effect library and run with ts-node or your TS build tool, then modify parameters to observe behavior.