Skip to content

Installation

Effect ships as a single package, effect, that contains the entire core library — the Effect type, Schema, Stream, Layer, and much more. Installing that one package is all you need to start. This page walks you through creating a fresh, strict TypeScript project and running a first program.

Requirements:

  • TypeScript 5.8 or newer (Effect v4 is developed and built against TypeScript 6.x — use the latest release for the best results)
  • A runtime: Bun, Node.js 18+, or Deno
  1. Create a project directory and move into it:

    Terminal window
    mkdir hello-effect
    cd hello-effect
  2. Initialize the project and install TypeScript and Effect:

    Terminal window
    bun init -y
    bun add effect
    bun add -d typescript
  3. Generate a tsconfig.json and make sure strict mode is on:

    bun init already creates a tsconfig.json with strict enabled. Verify it contains:

    {
    "compilerOptions": {
    "strict": true
    }
    }

Create a source file:

Terminal window
mkdir -p src
touch src/index.ts

Add the following to src/index.ts. The program is described as a value, then handed to a runtime to actually run:

src/index.ts
import { Console, Effect } from "effect"
// `Effect.gen` builds an effect in imperative style. Nothing runs yet — this is
// just a description of the work to be done.
const program = Effect.gen(function* () {
yield* Console.log("Hello, Effect!")
})
// `Effect.runPromise` executes the program and returns a Promise. This is the
// boundary between the Effect world (descriptions) and the outside world.
Effect.runPromise(program)
Terminal window
bun run src/index.ts

You should see Hello, Effect! printed to the console. That confirms your project is set up correctly.

Now that everything runs, the Quickstart builds a small but realistic program with services, typed errors, and a Layer. To learn how the package is organized and how to reach the unstable modules (HTTP, CLI, RPC, and more), see Importing Effect.