Effect Website Documentation

repository·main·Indexed 40 days ago

https://github.com/effect-ts/website

Developer guidelines and technical documentation for the Effect website. Includes the design system for UI components, color tokens, and typography; instructions for the Icon Generator utility using Font Awesome 7 Brands; configuration for Expressive Code; and schemas for blog and docs collections. Also covers Alchemy stack integration with Mixedbread VectorStore and dependency patches for Effect, Alchemy, and Distilled.

Tokens
424.8K
Snippets
1.2K
Records
1.6K
Agent score
97%

What's inside Effect Website

  1. Introduction to Effect AI

    main

    Effect AI is a set of experimental/alpha packages designed for interacting with Large Language Models (LLMs) in a provider-agnostic manner. It allows you to write declarative business logic that describes what you want to do (e.g., generating text, tool calling, streaming) without committing to how or where it is executed.

    By decoupling the interaction logic from the provider implementation, you can easily swap between providers (OpenAI, Anthropic, etc.) or use mocks for testing without changing your core application logic.

  2. What is Effect?

    main

    Effect is a TypeScript library designed for building production-grade software. It provides a composable core for managing complex application concerns that standard TypeScript/Promises do not natively handle in the type system.

    Key capabilities include:

    • Typed errors: Failures are part of the function signature and treated as data.
    • Retries and scheduling: Composable backoff policies instead of manual loops.
    • Structured concurrency: Bounded parallel work with automatic cleanup.
    • Resource safety: Guaranteed acquisition and release of resources, even during failures.
    • Dependency injection: Services are wired through the type system, making them easy to swap for testing.
    • Observability: Built-in support for tracing, metrics, and structured logging.
    • Streaming: Backpressured streams using standard operators.
    • Schema validation: Parsing and transforming data with type-safe schemas.
    • Configuration: Typed, validated environment configuration with secret redaction.
  3. Introduction to Effect Platform

    main

    The Effect Platform provides unified, platform-independent abstractions for building applications that run across different environments like Node.js, Deno, Bun, and browsers.

    Instead of using environment-specific APIs directly, you use abstract services (like FileSystem or Terminal) from the effect package. When deploying, you provide the concrete implementation for your target environment using platform-specific packages:

    • @effect/platform-node for Node.js or Deno
    • @effect/platform-bun for Bun
    • @effect/platform-browser for browsers
  4. Overview of Effect Metrics types

    main

    Effect Metrics provides tools to monitor application performance and behavior through five primary metric types:

    MetricDescription
    CounterTracks values that increase or decrease over time (e.g., request counts, error counts).
    GaugeRepresents a single numerical value that fluctuates up and down (e.g., memory usage).
    HistogramTracks the distribution of observed values across different buckets (e.g., request latencies).
    SummaryProvides insights into a sliding window of a time series, offering specific percentiles/quantiles (e.g., response times).
    FrequencyCounts occurrences of distinct string values (e.g., tracking how often specific events occur).
  5. Core features of Effect

    main

    Effect provides a composable core for production-grade software with the following built-in capabilities:

    • Typed errors: Failures are part of the type signature and handled as data.
    • Retries and scheduling: Compose backoff policies instead of writing manual loops.
    • Structured concurrency: Manage bounded parallel work with automatic cleanup.
    • Resource safety: Guaranteed acquisition and release of resources, even during failures.
    • Dependency injection: Services are wired through the type system, making them easy to swap for testing.
    • Observability: Built-in support for tracing, metrics, and structured logging.
    • Streaming: Backpressured streams using standard operators.
    • Schema validation: Parse and transform data with types that match reality.
    • Configuration: Typed, validated environment configuration with secret redaction.
    • Consistent ecosystem: Specialized packages for HTTP, SQL, CLI, AI, and more, all built on the same core.
  6. New features in Effect v4 Beta

    main

    The Effect v4 Beta introduces several improvements across core modules, specifically in effect-smol:

    HTTP Improvements

    • Static File Server: Added support for serving static files.
    • Cookie Management: Added expireCookie APIs for HTTP cookies.
    • Headers: Added Headers.removeMany combinator.
    • Rate Limiting: Improved HttpClient.withRateLimiter to automatically handle delays using Retry-After headers.
    • Bug Fix: Fixed HttpApiBuilder where void responses incorrectly produced a non-empty body instead of Response.empty.

    AI & OpenAI Compatibility

    • Customization: Added support for custom model and request properties in openai-compat.
    • Reasoning: Forwarded reasoning configuration.
    • Schema: Added Model.BooleanSqlite schema for AI model integrations.

    Schema & CLI

    • Atom: Added Atom.swr combinator.
    • Codec: Improved Schema.Unknown and Schema.ObjectKeyword handling in toCodecJson.
    • JSON Schema: Fixed JSON Schema emission for unannotated Never index signatures.
    • CLI: Made parent flag inheritance explicit via Command.withSharedFlags.

    Core & Internals

    • Scope: Fixed Effect.forkScoped Scope requirements.
    • SQL: Corrected SqlSchema findAll/findNonEmpty request input typing.
    • Error Handling: Exposed the fallback parameter in Effect.catchTags.
    • Scheduler: Added Scheduler.PreventSchedulerYield reference.
  7. Explore the Effect ecosystem and community

    main

    The Effect ecosystem includes various specialized tools and community resources:

    Key Libraries & Tools

    • Effect AI SDK: For integrating AI capabilities into your programs.
    • @effect/workflow: (Alpha) For building durable workflows in TypeScript.
    • effect-env: A TypeScript library for type-safe environment variable management, schema validation, and security, built with Effect.
    • Alette Signal: A frontend data fetching library built with Effect.
    • @effectify/node-better-auth: An integration of better-auth with Effect for Node.js applications.

    Community Resources

    • Discord: Join the Effect Discord community to connect with over 5,000 members, find job postings in the #job-board channel, and participate in discussions.
    • Cause & Effect Podcast: Listen to stories from engineers using Effect in production on YouTube, Spotify, and Apple Podcasts.
    • Effect Office Hours: Watch live sessions and recorded content on the Effect YouTube channel covering topics like Effect Atom, Tracing, Telemetry, and File System Abstractions.
  8. Navigate Effect documentation by topic

    main

    The documentation is organized into specialized guides. You can use these to deep-dive into specific functional areas of the library:

    • Error Management: Typed errors, fallbacks, and retries.
    • Concurrency: Fibers, bounded parallelism, and racing.
    • Resource Management: Safe acquisition and release of resources.
    • Schema: Data parsing, validation, and transformation.
    • Observability: Logging, metrics, and tracing.
    • Streaming: Building data pipelines with backpressure.

    For a complete list of all modules, use the API Reference.

  9. Core operations in Effect Schema

    main

    The effect/Schema module provides several operations for managing data structure and validation:

    OperationDescription
    DecodingTransforming data from an input type Encoded to an output type Type.
    EncodingConverting data from an output type Type back to an input type Encoded.
    AssertingVerifying that a value adheres to the schema's output type Type.
    Standard SchemaGenerating a Standard Schema V1 implementation.
    ArbitrariesGenerating and shrinking schema values using the Arbitrary module.
    JSON SchemasCreating JSON Schemas for the encoded representation.
    EquivalenceCreating an Equivalence based on a schema.
    FormattingCreating a Formatter based on a schema.
  10. Explore Effect ecosystem updates and alpha packages

    main

    The Effect ecosystem includes several specialized packages, some of which are currently in alpha:

    • @effect/workflow (Alpha): Provides durable workflows in TypeScript.
    • @effect/ai (Alpha): Provides AI integration capabilities.
    • Effect AI integration packages: Support for various AI providers and models.
    • Effect Cluster: For distributed computing/runner management.
    • Effect Platform: For building server-side applications (e.g., HTTP servers).
    • Effect RPC: For remote procedure calls.
    • Effect Vitest: For testing with Vitest.
  11. Understand the dependency patches in this repository

    main

    This repository uses dependency patches to maintain compatibility with specific versions of Effect, Alchemy, and Distilled. These patches are necessary because certain upstream packages still use legacy constructors that have been updated in the Effect RC API.

    Key patch areas:

    • Effect API Compatibility: Patches for Alchemy (2.0.0-beta.77) and Distilled (1.0.0-rc.9) update calls to legacy config and CLI constructors to use the new RC API (e.g., Config.String, Flag.String, Argument.String, etc.).
    • Cloudflare Runtime: The @alchemy.run/cloudflare-runtime patch updates config constructors for Docker, runtime directories, file watching, and Cloudflare Access.
    • Astro Tweet: An independent patch for astro-tweet is maintained here.