Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
E

EffectPatterns

> 设计协作
Open source

A community-driven knowledge base of practical patterns for Effect-TS.

784 stars0 likes0 views
WebsiteGitHub

About

A community-driven knowledge base of practical patterns for Effect-TS.

[!WARNING] This is an auto-generated file. Manual edits will be overwritten by the publishing pipeline. For project information, see ABOUT.md

The Effect Patterns Hub

A community-driven knowledge base of practical, goal-oriented patterns for building robust applications with Effect-TS.

This repository is designed to be a living document that helps developers move from core concepts to advanced architectural strategies by focusing on the "why" behind the code.

EffectTalk.dev — Browse all 300+ patterns, take guided learning tours, and run code examples in the browser. Built on this repo.

  • Start the Guided Tour
  • Browse Patterns
  • Welcome Post

Install the CLI to search, browse, and install patterns from your terminal:

bash
bun add -g @effect-patterns/ep-cli
ep search "error handling"

Looking for machine-readable rules for AI IDEs and coding agents? See the AI Coding Rules section below.

Table of Contents

Effect Patterns

  • Getting Started
  • Core Concepts
  • Error Management
  • Resource Management
  • Concurrency
  • Streams
  • Scheduling
  • Domain Modeling
  • Schema
  • Platform
  • Building APIs
  • Making HTTP Requests
  • Building Data Pipelines
  • Testing
  • Observability
  • Tooling & Debugging

Getting Started

Foundational patterns for your first steps with Effect-TS.

Pattern Skill Level Summary
Why Effect? Comparing Effect to Promise Beginner Understand what Effect gives you that Promise doesn't: type-safe errors, dependency injection, and composability.
Hello World: Your First Effect Beginner Create and run your very first Effect program using Effect.succeed and Effect.runSync.
Transform Values with Effect.map Beginner Use Effect.map to transform the success value of an Effect without changing its error or dependency types.
Handle Your First Error with Effect.fail and catchAll Beginner Learn how to create Effects that can fail and how to recover from those failures using Effect.fail and Effect.catchAll.
Run Multiple Effects in Parallel with Effect.all Beginner Use Effect.all to run multiple Effects at the same time and collect all their results.
Retry a Failed Operation with Effect.retry Beginner Use Effect.retry with a Schedule to automatically retry failed operations with customizable delays and limits.

Core Concepts

Essential building blocks for understanding and using Effect.

Pattern Skill Level Summary
Understand the Either Data Type Beginner Use Either to represent computations that can fail, allowing you to accumulate multiple errors instead of short-circuiting on the first one.
Chaining Computations with flatMap Beginner Use flatMap to chain together computations where each step may itself be effectful, optional, or error-prone.
Combining Values with zip Beginner Use zip to combine two computations, pairing their results together in Effect, Stream, Option, or Either.
Comparing Data by Value with Data.struct Beginner Use Data.struct to create immutable, structurally-typed objects that can be compared by value, not by reference.
Comparing Data by Value with Structural Equality Beginner Use Data.struct and Equal.equals to safely compare objects by their value instead of their reference, avoiding common JavaScript pitfalls.
Conditional Branching with if, when, and cond Beginner Use combinators like if, when, and cond to express conditional logic declaratively across Effect, Stream, Option, and Either.
Converting from Nullable, Option, or Either Beginner Use fromNullable, fromOption, and fromEither to convert nullable values, Option, or Either into Effects or Streams, enabling safe and composable interop.
Create Pre-resolved Effects with succeed and fail Beginner Use Effect.succeed(value) to create an Effect that immediately succeeds with a value, and Effect.fail(error) for an Effect that immediately fails.
Creating from Collections Beginner Use fromIterable and fromArray to create Streams or Effects from arrays, iterables, or other collections, enabling batch and streaming operations.
Creating from Synchronous and Callback Code Beginner Use sync and async to lift synchronous or callback-based computations into Effect, enabling safe and composable interop with legacy code.
Execute Asynchronous Effects with Effect.runPromise Beginner Use Effect.runPromise at the 'end of the world' to execute an asynchronous Effect and get its result as a JavaScript Promise.
Execute Synchronous Effects with Effect.runSync Beginner Use Effect.runSync at the 'end of the world' to execute a purely synchronous Effect and get its value directly.
Filtering Results with filter Beginner Use filter to keep or discard results based on a predicate, across Effect, Stream, Option, and Either.
Lifting Errors and Absence with fail, none, and left Beginner Use fail, none, and left to represent errors or absence in Effect, Option, or Either, making failures explicit and type-safe.
Lifting Values with succeed, some, and right Beginner Use succeed, some, and right to lift plain values into Effect, Option, or Either, making them composable and type-safe.
Understand the Option Data Type Beginner Use Option to explicitly represent a value that may or may not exist, eliminating null and undefined errors.
Set Up a New Effect Project Beginner Initialize a new Node.js project with the necessary TypeScript configuration and Effect dependencies to start building.
Solve Promise Problems with Effect Beginner Understand how Effect solves the fundamental problems of native Promises, such as untyped errors, lack of dependency injection, and no built-in cancellation.
Transform Effect Values with map and flatMap Beginner Use Effect.map for synchronous transformations and Effect.flatMap to chain operations that return another Effect.
Transforming Values with map Beginner Use map to transform the result of an Effect, Stream, Option, or Either in a declarative, type-safe way.
Understand that Effects are Lazy Blueprints Beginner An Effect is a lazy, immutable blueprint describing a computation, which does nothing until it is explicitly executed by a runtime.
When to Use Chunk vs Array Beginner Choose Chunk for Effect pipelines, Stream results, and immutable collection operations; use Array when interfacing with existing APIs.
Understand the Three Effect Channels (A, E, R) Beginner Learn about the three generic parameters of an Effect: the success value (A), the failure error (E), and the context requirements (R).
Use .pipe for Composition Beginner Use the .pipe() method to chain multiple operations onto an Effect in a readable, top-to-bottom sequence.
Working with Immutable Arrays using Data.array Beginner Use Data.array to create immutable, type-safe arrays that support value-based equality and safe functional operations.
Working with Tuples using Data.tuple Beginner Use Data.tuple to create immutable, type-safe tuples that support value-based equality and pattern matching.
Wrap Asynchronous Computations with tryPromise Beginner Use Effect.tryPromise to safely convert a function that returns a Promise into an Effect, capturing rejections in the error channel.
Wrap Synchronous Computations with sync and try Beginner Use Effect.sync for non-throwing synchronous code and Effect.try for synchronous code that might throw an exception.
Wrapping Synchronous and Asynchronous Computations Beginner Use try and tryPromise to safely wrap synchronous or asynchronous computations that may throw or reject, capturing errors in the Effect world.
Write Sequential Code with Effect.gen Beginner Use Effect.gen with yield* to write sequential, asynchronous code in a style that looks and feels like familiar async/await.
Access Configuration from the Context Intermediate Access your type-safe configuration within an Effect.gen block by yielding the Config object you defined.
Beyond the Date Type - Real World Dates, Times, and Timezones Intermediate Use the Clock service for testable access to the current time and prefer immutable primitives for storing and passing timestamps.
[Control Flow with Conditional Combinat

Issues· 14 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

TypeScriptdesign-patternseffecteffect-tsfunctional-programming

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category设计协作
PricingOpen source

> Related tools

F
Figma
协作式界面设计工具
S
sketch-wakatime
Sketch plugin for automatic time tracking and metrics generated from your Sketch usage.
Q
QuickColor
Quickly apply fills from the global or document color palettes to selected elements - 🎨