Quick Start Guide

June 28, 2026 · View on GitHub

Get up and running with r3lfe in 5 minutes.

Installation

New Project

# Create project directory
mkdir my-lfe-app
cd my-lfe-app

# Create rebar.config
cat > rebar.config <<EOF
{plugins, [
    {rebar3_lfe, "0.5.0"}
]}.

{deps, [
    {lfe, "2.2.0"}
]}.
EOF

# Create source directory
mkdir src

# Create a simple module
cat > src/myapp.lfe <<EOF
(defmodule myapp
 (export
  (hello 1)))

(defun hello (name)
  (io:format "Hello, ~s!~n" (list name)))
EOF

# Compile
rebar3 lfe compile

# Start REPL
rebar3 lfe repl

In the REPL:

> (myapp:hello "World")
Hello, World!
ok

Existing Project

Add to your rebar.config:

{plugins, [
    {rebar3_lfe, "0.5.0"}
]}.

Then:

rebar3 lfe compile

Project Structure

Simple Library

my-lib/
├── rebar.config
├── src/
│   ├── mylib.lfe
│   └── mylib-utils.lfe
└── test/
    └── mylib-tests.lfe

With Packages (Nested Modules)

my-app/
├── rebar.config
├── src/
│   ├── myapp.lfe           → myapp
│   └── myapp/
│       ├── core.lfe        → myapp.core
│       └── utils/
│           └── helpers.lfe → myapp.utils.helpers
└── include/
    └── records.lfe

Umbrella Project

my-umbrella/
├── rebar.config
└── apps/
    ├── web/
    │   ├── rebar.config
    │   └── src/
    │       └── web.lfe
    └── db/
        ├── rebar.config
        └── src/
            └── db.lfe

Common Tasks

Compiling

# Compile all files
rebar3 lfe compile

# Compile specific profile
rebar3 as prod lfe compile

# Verbose output
rebar3 lfe compile --verbose

Cleaning

# Remove beam files
rebar3 lfe clean

# Remove everything (including deps)
rebar3 clean

REPL

# Start REPL with project loaded
rebar3 lfe repl

# Start with specific apps
rebar3 lfe repl --apps myapp,mylib

# Run script before REPL
rebar3 lfe repl --script init.lfe

Quick Expression Evaluation

# Evaluate expressions without starting a REPL
rebar3 lfe eval '(+ 1 2 3)'

# Complex expressions
rebar3 lfe eval '(lists:map (lambda (x) (* x x)) (list 1 2 3))'

# Call your project code
rebar3 lfe eval '(myapp:version)'

Testing

# Run tests (requires ltest dependency)
rebar3 lfe ltest

# Run specific suite
rebar3 lfe ltest --suite my-suite

# Verbose output
rebar3 lfe ltest --verbose

Releases

# Build release
rebar3 lfe release

# Build tar
rebar3 as prod lfe release tar

Configuration

Compiler Options

{lfe_opts, [
    debug_info,      % Include debug info
    verbose,         % Verbose compilation
    {i, "include"},  % Additional include dir
    {outdir, "ebin"} % Output directory
]}.

First Files

Compile certain files before others:

{lfe_first_files, [
    "src/records.lfe",
    "src/macros.lfe"
]}.

Source Directories

{src_dirs, [
    "src",
    "extra_src"
]}.

Include Directories

{lfe_include_dirs, [
    "include",
    "extra_include"
]}.

Next Steps