Docs/Getting started

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):

Terminal
cargo install --path crates/efs_cli

Create a project

Terminal
efs init hello && cd hello
Terminal
pnpm install

This creates a TypeScript project with src/main.efs, a tsconfig.json and an efs.json. Check it, build it and run it:

Terminal
efs check && efs build && pnpm tsc && node dist/main.js

efs 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

EffScriptTry it
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

Edit this page on GitHub →
MIT licensedBuilt with EffScript, Effect UI and Tailwind CSSGitHub