Installation
Requirements:
- TypeScript 5.4 or newer.
- Node.js 22.18 or newer, Deno, and Bun are supported.
Manual Installation
JavaScript runtimes
Follow these steps to create a new Effect project for Node.js, Bun, or Deno:
-
Create a project directory and navigate into it:
Terminal window mkdir hello-effectcd hello-effect -
Initialize a TypeScript project:
Terminal window npm init -ynpm install --save-dev typescriptTerminal window pnpm initpnpm add --save-dev typescriptTerminal window yarn init -yyarn add --dev typescriptTerminal window bun initTerminal window deno initThis creates a
package.jsonfile with an initial setup for your TypeScript project. For Bun, this also generates atsconfig.jsonfile. For Deno, this generates adeno.jsonfile.Make sure the
package.jsonfile contains the"type": "module"field, so that Node.js treats your source files as ES modules (bun initadds this automatically):{"type": "module"} -
Initialize TypeScript:
Terminal window npx tsc --initTerminal window pnpm tsc --initTerminal window yarn tsc --initbun inithas already generated atsconfig.jsonfile.Deno runs TypeScript out of the box, and
deno inithas already generated adeno.jsonfile withstrictmode enabled by default. No further configuration is needed.When running this command, it will generate a
tsconfig.jsonfile that contains configuration options for TypeScript. One of the most important options to consider is thestrictflag.Make sure to open the
tsconfig.jsonfile and verify that the value of thestrictoption is set totrue.{"compilerOptions": {"strict": true}} -
Install the necessary package as dependency:
Terminal window npm install effectTerminal window pnpm add effectTerminal window yarn add effectTerminal window bun add effectTerminal window deno add npm:effectThis package will provide the foundational functionality for your Effect project.
Let’s write and run a simple program to ensure that everything is set up correctly.
In your terminal, execute the following commands:
mkdir srctouch src/index.tsOpen the src/index.ts file and add the following code:
import { Effect, Console } from "effect"
const program = Console.log("Hello, World!")
Effect.runSync(program)Run the src/index.ts file. Node.js 22.18 or newer, Bun, and Deno can run TypeScript files directly, so no additional tooling is needed: