Guide
Getting started
On this page›
Install
EffScript is not on npm yet. Build the efs command from this repository
(Rust 1.100 or newer):
cargo install --path crates/efs_cliCreate a project
efs init hello && cd hellopnpm installThis creates a TypeScript project with src/main.efs, a tsconfig.json and
an efs.json. Check it, build it and run it:
efs check && efs build && pnpm tsc && node dist/main.jsefs build writes src/main.ts next to the source, and TypeScript compiles it
with the rest of your code. To skip TypeScript and write JavaScript directly,
use efs build --emit js, or use a bundler plugin.
A first program
error EmptyNameeffect function greet(name: string) { if name.length == 0 { fail new EmptyName(); } run Console.log(`Hello, ${name}!`);}export const main = greet("Effect") catch { EmptyName => Console.log("Who are you?") };effect function and run work like async function and await: run
runs an effect and gives you its result. use Service gets a service your
code depends on. Console, Effect and the other core Effect modules need no
import: they come from the prelude. See the
language guide for everything else, and
what each construct compiles to.
Next steps
The
efscommand: building, checking, formatting and linting.Editors: the VS Code extension and the language server.
TypeScript interop: using EffScript in a TypeScript project.
Bundlers: Vite, Rollup, Rolldown, esbuild, Bun and webpack.