Prerequisites
Before installing Effect, ensure you have:- Node.js 18+ (or Bun/Deno)
- TypeScript 5.0+
- A package manager: npm, pnpm, yarn, or bun
Installation
Install the effect package
Install Effect using your preferred package manager:This installs the core
effect package, which includes:- Core Effect runtime and data types
- Built-in modules for concurrency, streaming, and error handling
- Schema validation and encoding
- Service and Layer utilities
- Observability features (logging, tracing, metrics)
Configure TypeScript
Effect requires specific TypeScript compiler options. Add these to your
tsconfig.json:tsconfig.json
The
strict flag is highly recommended for the best type-safety experience with Effect.Platform-Specific Packages
Depending on your runtime environment, you may need additional packages:Node.js
For Node.js-specific features like file system access and HTTP servers:NodeRuntimefor running Effect programs- File system operations
- HTTP client and server
- Command execution and child processes
- Terminal and readline utilities
Bun
For Bun runtime support:Browser
For browser environments:Optional Packages
Effect has a rich ecosystem of optional packages for specialized use cases:Testing
OpenTelemetry
SQL
RPC
Many advanced features are available in the main
effect package under effect/unstable/* paths. These APIs are production-ready but may have breaking changes in minor versions.Package Structure
Theeffect package uses subpath exports for organizing functionality:
Editor Setup
VS Code
For the best development experience in VS Code:- Install the Effect Language Service extension
- This provides:
- Enhanced type checking for Effect code
- Better error messages
- Improved autocomplete
Other Editors
Effect works with any editor that supports TypeScript. Ensure you have:- TypeScript language server enabled
- IntelliSense/autocomplete configured
Next Steps
Now that Effect is installed, you’re ready to build your first program:Quick Start
Build your first Effect application with a complete working example
Troubleshooting
Module resolution errors
Module resolution errors
If you see module resolution errors, ensure your
tsconfig.json has moduleResolution set to "NodeNext" or "Bundler". Effect uses modern ES modules.Type errors with generators
Type errors with generators
If you see type errors in generator functions, make sure you’re using
yield* (not yield) and that your TypeScript version is 5.0 or higher.Runtime errors about missing modules
Runtime errors about missing modules
If you get runtime errors about missing modules, you may need to install platform-specific packages like
@effect/platform-node for Node.js features.