---
title: "Expressions"
url: https://devlanes.run/docs/reference/expressions/
description: "The syntax of expressions in the project file, the names they read, and the functions they can use."
updated: 2026-11-16T02:09:32.000Z
---

# Expressions

Values in the project file and the local file can hold `${{ ... }}` expressions, which devlanes evaluates for each lane. [Environment and expressions](/docs/concepts/environment/) explains where their values go.

## Syntax

| Form | Meaning |
|---|---|
| `${{ expression }}` | An expression, in the expression language of MiniJinja templates. |
| `text ${{ a }} text` | Text with expressions in it. The result is text. |
| `${{ '${{' }}` | A literal `${{`. |
| `${{ a \| default('x') }}` | A filter. Filters and tests are MiniJinja's built-in ones, such as `default`, `upper`, `replace`, `join`, `int`, `tojson` and `is defined`. |
| <code>${{ 'a' if lane.<wbr>index == 0 else 'b' }}</code> | A condition. |

A value that is one whole expression keeps its type, so `autostart: ${{ lane.index == 0 }}` is a boolean. Text with an expression in it is text. A name that does not exist is an error; `default` gives it a value.

## Namespaces

| Name | Value |
|---|---|
| <code>project.<wbr>name</code> | `project` from the project file. |
| <code>project.<wbr>primary_path</code> | The path of the primary worktree. |
| <code>lane.<wbr>index</code> | The lane number: `0`, `1`, `2` and so on. |
| <code>lane.<wbr>name</code> | `main` for lane 0, `lane<N>` for lane N. |
| <code>lane.<wbr>label</code> | The branch with each `/` replaced by `-`, such as `feat-checkout`. |
| <code>lane.<wbr>path</code> | The path of the lane's worktree. |
| <code>lane.<wbr>data_path</code> | The [lane data folder](/docs/reference/files/#lane-data-folder). |
| <code>lane.<wbr>domain</code> | The lane domain: `myapp.localhost` in lane 0, `myapp1.localhost` in lane 1. |
| <code>lane.<wbr>port</code> | The first port of the lane's port block. |
| <code>lane.<wbr><var></code> | An entry of `lanes.vars`. |
| <code>self.<wbr>name</code> | The name of the service the value belongs to. |
| <code>self.<wbr>port</code> | Its port. |
| <code>self.<wbr>ports.<wbr><name></code> | Its named port `<name>`. |
| <code>self.<wbr>url</code> | `http://127.0.0.1:<port>`. |
| <code>self.<wbr>public_url</code> | `https://` and its first hostname. Undefined for a service without hostnames. |
| <code>self.<wbr>hosts</code> | Its hostnames. |
| <code>services.<wbr><service>.<wbr><field></code> | The same fields for another service of the lane. |
| <code>lanes.<wbr>main.<wbr>services.<wbr><service>.<wbr><field></code> | The same fields for a service of lane 0. |
| <code>projects.<wbr><project>.<wbr>services.<wbr><service>.<wbr><field></code> | The same fields for a service of another running project. |
| <code>infra.<wbr><container>.<wbr>port</code> | The host port of a container's first published port. |
| <code>infra.<wbr><container>.<wbr>ports['<port>']</code> | The host port published for a container port of a Compose service. |
| <code>infra.<wbr><container>.<wbr>ports.<wbr><name></code> | The host port of a named port of an `infra.containers` entry. |
| <code>env.<wbr><NAME></code> | A variable from the shell that ran the devlanes command, else from the lane's `.env` file. |
| <code>replica.<wbr>index</code>, `replica.count` | The replica's number, from 1, and the service's `replicas`. |

In a task, `self` holds only `name`. `infra.containers`, `infra.compose`, `infra.hosts`, `infra.env` and `infra.external` read only `project`, `lane`, `infra` and `env`.

A name with a dash is written `services['crm-api']` or `services.crm_api`.

## Functions

| Function | Result |
|---|---|
| `domain(name)` | The domain of `name` in this lane, by the rule of `lane.domain`: `pages.localhost` in lane 0, `pages2.localhost` in lane 2. |
