---
title: Introduction
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/introduction/
updated: 2026-11-19T04:41:09.987Z
---
# Introduction
> What Total.js LessCode is, what you can build with it and where to start.
Total.js LessCode is a small app for building services, scheduled workflows and API endpoints in the browser. You place nodes on a canvas, connect them and select **APPLY**. LessCode runs your design straight away on the same server.
LessCode uses the Total.js Flow engine and its visual designer. It holds one flow, which it saves in a single file.
## What you can build
- **API endpoints.** A **Route** node receives HTTP requests and a **Response** node answers them. See [Create a GET endpoint](../../recipes/get-endpoint/).
- **Scheduled workflows and services.** **Timer** and **Crontab** nodes start work at an interval or at set times. See [Run a workflow on a schedule](../../recipes/scheduled-workflow/).
- **Calls to other HTTP APIs.** **Link endpoint** turns any HTTP address into a node. See [Call an HTTP API](../../recipes/call-http-api/).
- **Your own logic.** A **Code** node runs a few lines of JavaScript on each message. See [Code](../../reference/code/).
## What to read next
1. Install LessCode [from source](../install-source/) or [with Docker](../install-docker/).
2. Open the designer: [First access](../first-access/).
3. Learn the screen: [The designer](../designer-overview/).
4. Build your first endpoint: [Create a GET endpoint](../../recipes/get-endpoint/).
5. Before you go live, read [Run in production](../production/) and [Back up your flow](../backups/).
---
title: Install from source
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/install-source/
updated: 2026-11-19T04:41:09.987Z
---
# Install from source
> Install LessCode with Node.js and start it on your computer or server.
You need [Node.js](https://nodejs.org) 19 or newer and Git.
## Install and start
**1.** Get the code and open its folder:
```bash
git clone https://github.com/totaljs/lesscode.git
cd lesscode
```
**2.** Install the dependencies (once):
```bash
npm install
```
**3.** Start LessCode:
```bash
npm start
```
**4.** Open `http://localhost:8000/` in your browser. See [First access](../first-access/).
LessCode keeps running until you stop it with Ctrl+C in the terminal.
## Use another port
`npm start` uses port 8000. To use another port, start LessCode with Node.js and pass the port:
```bash
node index.js 8080
```
## Where your work is saved
Your flow lives in the file `flowstreams/lesscode.flow` inside the LessCode folder. See [The flow file](../../reference/flow-file/) and [Back up your flow](../backups/).
## Keep your server safe
The designer has no sign-in. Anyone who can open its address can change your flow and run code on the server. Before you install LessCode on a server that others can reach, read [Run in production](../production/).
---
title: Install with Docker
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/install-docker/
updated: 2026-11-19T04:41:09.987Z
---
# Install with Docker
> Run the official LessCode image with a volume that keeps your flow.
The official image is `totalplatform/lesscode`. Inside the container, LessCode reads and saves its flow in the folder `/www/.src/flowstreams`. The image does not include a flow, so you put the default flow file into a volume on that folder once. Until you do, the designer shows a spinner and does not load.
## Run with Docker
**1.** Get the default flow file from the source code:
```bash
git clone https://github.com/totaljs/lesscode.git
```
**2.** Start the container with a volume for the flow:
```bash
docker run -d --name lesscode -p 8000:8000 -v lesscode-flows:/www/.src/flowstreams totalplatform/lesscode
```
**3.** Copy the flow file into the volume and restart the container:
```bash
docker cp lesscode/flowstreams/lesscode.flow lesscode:/www/.src/flowstreams/lesscode.flow
docker restart lesscode
```
**4.** Open `http://localhost:8000/`. See [First access](../first-access/).
The volume `lesscode-flows` keeps your flow when you remove and create the container again. Always start new containers with the same `-v lesscode-flows:/www/.src/flowstreams` option.
## Run with Docker Compose
**1.** Create a `docker-compose.yaml` file:
```yaml
services:
lesscode:
image: totalplatform/lesscode
container_name: lesscode
ports:
- "8000:8000"
volumes:
- flowstreams:/www/.src/flowstreams
volumes:
flowstreams:
```
**2.** Start it:
```bash
docker compose up -d
```
**3.** Copy the default flow file into the volume (from a clone of the source code, as above) and restart:
```bash
docker compose cp lesscode/flowstreams/lesscode.flow lesscode:/www/.src/flowstreams/lesscode.flow
docker compose restart
```
`docker compose down` followed by `docker compose up -d` keeps your flow, because it stays in the `flowstreams` volume.
The `docker-compose.yaml` file in the source code mounts `/www/flowstreams`. LessCode does not save to that folder, so use the volume shown above instead.
## Before you stop a container
LessCode writes changes to the flow file a few seconds after you make them. Wait a few seconds after your last change before you stop or remove the container.
To keep a copy of your flow outside Docker, see [Back up your flow](../backups/).
---
title: First access
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/first-access/
updated: 2026-11-19T04:41:09.987Z
---
# First access
> Open the designer for the first time and run the example flow.
LessCode has no sign-in page. The designer opens at the root address of the app.
## Find the address
When LessCode starts, the terminal (or `docker logs lesscode` for Docker) prints a short report. The last lines show the address and port the server listens on. The port is `8000` unless you [chose another one](../install-source/).
Open `http://localhost:8000/` on the same computer, or the server name and port from another computer.
## Run the example flow
A new LessCode flow has three nodes: **Trigger**, **Print** and **Console debug**. Trigger is already connected to Print.
1. Select **Run** on the **Trigger** node.
2. The **Print** node shows the date and the data it received. The example Trigger sends a random text.

Select **Clear** on the Print node to empty it.
## Next steps
- Learn the screen: [The designer](../designer-overview/).
- Add more components: [Download components](../download-components/).
- Build an endpoint: [Create a GET endpoint](../../recipes/get-endpoint/).
---
title: The designer
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/designer-overview/
updated: 2026-11-19T04:41:08.077Z
---
# The designer
> The parts of the designer screen: toolbar, component list, canvas and status bar.
The designer is the only screen of LessCode. It shows your flow and lets you change it.

## Toolbar

From left to right:
| Button | What it does |
|---|---|
| **APPLY** | Starts your changes on the server. See [Apply and save](../apply-and-save/). |
| **Add** (plus) | Opens the menu to download components, link an HTTP endpoint, paste nodes, download the design or clear the canvas. |
| **Variables** | Opens the [variables](../variables/) of the flow. |
| **Console** | Opens the [Console](../console/) panel at the bottom. |
| **Activities** | Opens the list of activities that nodes report. It shows **No activities** when there are none. |
| **Search in nodes** | Finds nodes by their settings. See [Search in nodes](../search-nodes/). |
| **Zoom** | Zooms the canvas out. Select it again to go back to 100%. |
| **Pause** | Pauses the whole flow. See [Pause the flow](../pause-flow/). |
## Component list
The list on the left shows the components you can use, grouped by category. Type in **Search components** to filter it. Drag a component onto the canvas to add a node. **Group** at the top adds a [group](../organize-canvas/).
A new flow has only **Print**, **Console debug** and **Trigger**. Add more with [Download components](../download-components/).
## Canvas
The canvas holds your nodes and the connections between them. Scroll to move around. Double-click a node to open its settings, and right-click it for more actions.
## Status bar

| Counter | Meaning |
|---|---|
| **Messages** | Messages processed by the flow. |
| **Pending** | Messages still being processed. |
| **Per minute** | Messages in the last minute. |
| **Errors** | Errors raised by nodes. See [Errors](../errors/). |
| **Memory** | Memory used by the flow. |
The last two values show the data the designer receives and sends over its connection to the server.
---
title: Download components
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/download-components/
updated: 2026-11-19T04:41:08.768Z
---
# Download components
> Add ready-made components, such as Route, Response, Code and Timer, from the Total.js catalog.
A new flow has only three components. The Total.js catalog has many more: HTTP routes and responses, code, timers, files, databases and more. The designer reads the catalog from the internet, so the browser needs internet access.
## Download a component
1. Select **Add** (plus) in the toolbar.
2. Select **Download components**.

3. Type in **Search components** to find a component, or scroll the groups.
4. Select the component, then select **IMPORT** to confirm.
5. Select **Close** when you have all the components you need.

Installed components are highlighted in the catalog. The component appears in the list on the left, under its group, ready to drag onto the canvas. Select **Read me** on a component to read its description before you import it.
Components marked **Community** were written by authors outside Total.js.
## Components used in these pages
| Component | Group in the catalog | Used in |
|---|---|---|
| **Route** | Total.js | [Create a GET endpoint](../../recipes/get-endpoint/) |
| **Response** | Total.js | [Create a GET endpoint](../../recipes/get-endpoint/) |
| **Code** | Common | [Code](../../reference/code/) |
| **Timer** | Triggers | [Run a workflow on a schedule](../../recipes/scheduled-workflow/) |
| **Crontab** | Triggers | [Run a workflow on a schedule](../../recipes/scheduled-workflow/) |
Components are saved in the [flow file](../../reference/flow-file/), so they stay after a restart.
## Remove a component from the list
Right-click the component in the list on the left, select **Remove**, then select **Remove** again to confirm.
---
title: Build a flow
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/build-a-flow/
updated: 2026-11-19T04:41:04.689Z
---
# Build a flow
> Add nodes to the canvas, connect them, configure them and start them.
A flow is a set of nodes joined by connections. Data travels from the output of one node to the input of the next.
## Add a node
Drag a component from the list on the left and drop it on an empty part of the canvas. The new node is marked as new until you apply.
## Connect two nodes
Drag from the dot of an output (on the right side of a node) to the dot of an input (on the left side of another node). A line joins them. An output can go to several inputs.
## Configure a node
1. Double-click the node, or right-click it and select **Configure**.
2. Change the settings in the window that opens.
3. Select **APPLY** at the bottom of the window.
When **Close after applying** is ticked, the window closes after you apply. Select **Read me** in the window to read about the component.
## Start your changes
Select **APPLY** in the toolbar, then select **Continue**. See [Apply and save](../apply-and-save/).
## Other node actions
Right-click a node to see its menu:
| Item | What it does |
|---|---|
| **Read information** | Shows the description of the component. |
| **Set a note** | Adds a note to the node. See [Organize the canvas](../organize-canvas/). |
| **Configure** | Opens the settings. |
| **Clone** | Adds a copy of the node with the same settings. Select **APPLY** to start it. |
| **Remove** | Removes the node. See [Remove nodes](../remove-nodes/). |
For a complete example, see [Create a GET endpoint](../../recipes/get-endpoint/).
---
title: Apply and save
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/apply-and-save/
updated: 2026-11-19T04:41:04.689Z
---
# Apply and save
> When your changes start to run and when LessCode writes them to the flow file.
Some changes start at once and some wait for **APPLY**.
## Changes that need APPLY
New nodes, removed nodes and new or removed connections only run after you apply them:
1. Select **APPLY** in the toolbar. It is highlighted while you have changes that are not applied.
2. Select **Continue** to confirm.
## Changes that start at once
These changes run as soon as you make them, without **APPLY**:
- The settings of a node that is already applied, after you select **APPLY** in its settings window.
- [Variables](../variables/), after you select **SUBMIT**.
- [Notes](../organize-canvas/) and [groups](../organize-canvas/).
- [Pause](../pause-flow/).
## When LessCode saves
LessCode writes your flow to the [flow file](../../reference/flow-file/) about five seconds after a change. If you stop LessCode sooner, the last change is lost. Wait a few seconds after your last change before you stop or restart it.
After a restart, LessCode loads the flow from the file and runs it again.
---
title: Remove nodes
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/remove-nodes/
updated: 2026-11-19T04:41:12.340Z
---
# Remove nodes
> Remove one node or clear the whole canvas, and restart LessCode before you add new nodes.
## Remove a node
1. Right-click the node.
2. Select **Remove**.

3. Select **APPLY** in the toolbar, then **Continue**.
## Clear the canvas
1. Select **Add** (plus) in the toolbar.
2. Select **Clear**, then select **Clear** again to confirm.
Clear removes every node and applies the change at once. Your installed components and variables stay.
## Restart after removing nodes
After an Apply that removed nodes, restart LessCode before you add new nodes. Otherwise the next Apply that adds nodes looks successful but does not run or save them, and they are gone after the next restart.
1. Wait a few seconds after the Apply, so LessCode saves the flow.
2. Stop LessCode (Ctrl+C in the terminal, or `docker restart lesscode` for Docker) and start it again.
3. Reload the designer and continue.
Changing the settings of nodes that are already applied does not need a restart.
---
title: Organize the canvas
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/organize-canvas/
updated: 2026-11-19T04:41:11.468Z
---
# Organize the canvas
> Add notes to nodes and draw groups so a large flow stays easy to read.
Notes and groups do not change what your flow does. They help you and others read it.
## Add a note to a node
1. Right-click the node and select **Set a note**.
2. Type the note. You can use Markdown.
3. Select **SUBMIT**.
The note appears inside the node.

## Add a group
A group is a labelled area of the canvas.
1. Drag **Group** from the top of the component list onto the canvas.
2. Double-click the group to edit it.
3. Type the **Group name** and pick a **Background** and **Font color** if you like.
4. Select **SUBMIT**.


To edit or remove a group later, right-click it and select **Configure** or **Remove**.
---
title: Search in nodes
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/search-nodes/
updated: 2026-11-19T04:41:12.685Z
---
# Search in nodes
> Find a node by any value in its settings, such as a URL.
1. Select **Search in nodes** in the toolbar.
2. Type a word, for example part of a URL.
The window lists every node whose settings contain the text, with the node ID and the component name.

Select the cross in the top right corner to close the window.
---
title: Variables
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/variables/
updated: 2026-11-19T04:41:13.543Z
---
# Variables
> Keep values such as texts, addresses or keys outside your nodes and use them in settings and code.
Variables are named values that belong to your flow. Use them for values you want to change in one place.
## Add a variable
1. Select **Variables** in the toolbar.
2. Type a key in **Type a key**, for example `GREETING`.
3. Type a value in **Type a value and press enter** and press Enter.
4. Select **SUBMIT**, then close the window with **Cancel** or the cross.

A variable that you do not confirm with Enter is not saved. Variables start working at once and are saved in the [flow file](../../reference/flow-file/).
## Use a variable in a Code node
Write the key in braces and pass it to `instance.replace()`:
```js
send({ message: instance.replace('{GREETING}') });
```
With `GREETING` set to `Hello from LessCode`, an endpoint built with this code answers:
```json
{"message":"Hello from LessCode"}
```

---
title: Test with Trigger and Print
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/test-with-trigger/
updated: 2026-11-19T04:41:12.685Z
---
# Test with Trigger and Print
> Send test data into a flow by hand and look at what each node produces.
**Trigger** sends data when you select **Run**. **Print** shows the data it receives. Together they let you test part of a flow without waiting for a request or a timer.
## Send test data
1. Drag **Trigger** onto the canvas and connect its output to the node you want to test.
2. Double-click the Trigger to choose what it sends. Choose the **Type**, clear **Random data** and type your own **Data**. For an object, choose **Object** and type it in JavaScript form, for example `{ product: 'Demo product', quantity: 3 }`. Select **APPLY** in the window.
3. Select **APPLY** in the toolbar, then **Continue**.
4. Select **Run** on the Trigger.
## Look at the result
Connect a **Print** node to any output. Each time data arrives, Print shows the date and the data.

Select **Clear** on the Print node to empty it.
For a full example, see [Call an HTTP API](../../recipes/call-http-api/). To see log lines and errors, use the [Console](../console/).
---
title: The Console
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/console/
updated: 2026-11-19T04:41:07.272Z
---
# The Console
> Read log lines and errors of your flow in the Console panel.
The Console panel shows errors raised by nodes and, with a **Console debug** node, the lines that your code writes with `console.log()`.
## Open the Console
Select **Console** in the toolbar. The panel opens at the bottom of the designer. Each line starts with the date and time. Errors are red.

- Select the bin icon to empty the Console.
- Select the red cross to close the panel.
## Show console.log() lines
A new flow already has a **Console debug** node. You need only one in a flow.
1. Double-click **Console debug**.
2. Tick **Capture all `console.log()`**.
3. Select **APPLY** in the window.

From now on, `console.log()` in a [Code](../../reference/code/) node writes to the Console panel instead of the terminal. Use it to follow your data:
```js
console.log('Heartbeat received:', value);
```
Without a Console debug node, or with the option off, these lines go to the terminal where LessCode runs.
---
title: Errors
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/errors/
updated: 2026-11-19T04:41:09.250Z
---
# Errors
> See which node failed and why.
When a node raises an error, the designer shows it in three places.

- **On the node.** A red bug icon appears above it and a red line below it. Hold the pointer over the node to read the error.
- **In the toolbar.** The **Console** button turns red.
- **In the status bar.** The **Errors** counter goes up.

Open the [Console](../console/) to read the full message. It names the component and the node ID.
## Find the cause
1. Open the Console and read the error.
2. Find the node it names, double-click it and check its settings or code.
3. Send test data with a [Trigger](../test-with-trigger/) to check the fix.
In a Code node, an error that you throw stops that message:
```js
throw new Error('Demo failure');
```
---
title: Pause the flow
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/pause-flow/
updated: 2026-11-19T04:41:11.468Z
---
# Pause the flow
> Stop the whole flow for a moment and start it again.
Pause stops your flow without changing it. While it is paused, the canvas is faded and your endpoints answer with the HTTP status `503`.
## Pause
1. Select **Pause** in the toolbar.
2. Select **Pause** to confirm.
## Start again
Select **Pause** in the toolbar again. The flow runs at once, with no confirmation.
---
title: Extensions
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/extensions/
updated: 2026-11-19T04:41:09.690Z
---
# Extensions
> Add your own HTML, styles and server code to LessCode with files in the extensions folder.
An extension is an HTML file in the `extensions` folder of LessCode. When the flow starts, LessCode loads every `.html` file there:
- The part inside `
```
**2.** Restart LessCode.
**3.** Call the endpoint:
```bash
curl http://localhost:8000/api/status/
```
The answer looks like this:
```json
{"name":"status","flow":"lesscode","uptime":4}
```
The designer shows the orange line under the toolbar:

## What the server part can use
| Name | Value |
|---|---|
| `exports.name` | The file name without `.html`. |
| `exports.id` | The same as `exports.name`. |
| `exports.flow` | The running flow. |
## Changes
LessCode reads the folder when the flow starts. After you add, change or remove an extension, restart LessCode.
---
title: Run in production
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/production/
updated: 2026-11-19T04:41:11.468Z
---
# Run in production
> Choose the port and address, protect the designer and keep LessCode running.
LessCode has no sign-in. Anyone who can open the designer can change your flow and run code on your server. Plan access before you put LessCode on a network.
## Listen only on the server itself
By default LessCode listens on every network interface. To accept connections only from the same machine, open `index.js` and remove the two slashes at the start of this line:
```js
// options.ip = '127.0.0.1';
```
so that it reads:
```js
options.ip = '127.0.0.1';
```
Restart LessCode. The terminal now shows the address `127.0.0.1`.
## Choose the port
Pass the port when you start LessCode:
```bash
node index.js 8000
```
With Docker, change the first number of `-p 8000:8000`.
## Protect the designer and your endpoints
- Put a reverse proxy, such as Nginx, in front of LessCode. Use HTTPS and allow only trusted people to reach the designer address.
- Your endpoints use the same port as the designer. If the public must reach your endpoints, let the proxy forward only their paths (for example `/api/`) and protect the root address.
- Keep the LessCode port closed in the firewall.
## Keep it running
- Run LessCode under a service manager or as a Docker container that restarts, so it starts again after a reboot.
- Wait a few seconds after your last change before you stop or restart it. See [Apply and save](../apply-and-save/).
- [Back up your flow](../backups/) regularly.
---
title: Back up your flow
project: LessCode
version: 1.0
section: guides
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/guides/backups/
updated: 2026-11-19T04:41:04.689Z
---
# Back up your flow
> Keep a copy of your flow and restore it on the same or another server.
Everything you build is in one file: the [flow file](../../reference/flow-file/). It holds your nodes, connections, installed components and variables.
## Download a copy from the designer
1. Select **Add** (plus) in the toolbar.
2. Select **Download design**.
The browser saves a file named `Total.js LessCode.json`. It has the same content as the flow file.
## Copy the file on the server
For a source install, copy `flowstreams/lesscode.flow` from the LessCode folder.
For Docker, copy it out of the container:
```bash
docker cp lesscode:/www/.src/flowstreams/lesscode.flow ./lesscode.flow
```
Wait a few seconds after your last change before you copy, so the file has your latest work.
## Restore a copy
**1.** Stop LessCode.
**2.** Replace `flowstreams/lesscode.flow` with your copy. A file from **Download design** works too: rename it to `lesscode.flow`.
**3.** Start LessCode and reload the designer.
For Docker, copy the file into the container and restart it:
```bash
docker cp ./lesscode.flow lesscode:/www/.src/flowstreams/lesscode.flow
docker restart lesscode
```
Keep only one `.flow` file in the `flowstreams` folder. The designer shows only one flow.
---
title: Route
project: LessCode
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/reference/route/
updated: 2026-11-19T04:41:17.865Z
---
# Route
> The settings of the Route component, which receives HTTP requests.
**Route** registers an HTTP address on the LessCode server and sends each request to its **Request** output. The address works after you [apply](../../guides/apply-and-save/). A Route must lead to a [Response](../response/), which answers the request.

| Setting | What it does |
|---|---|
| **Method** | `GET`, `POST`, `PUT`, `PATCH`, `DELETE` or `API`. |
| **Relative URL address** | The path, for example `/api/hello/`. It is added to the address of LessCode. |
| **Allow uploading files (form data)** | For requests that upload files. **Read files to** sets the form of the files. |
| **Timeout** | The time limit of a request, in milliseconds. Default `5000`. |
| **Request limit** | The largest request body, in kB. Default `5120`. |
| **Send to output** | What the node sends: **Everything**, **Payload**, **Query arguments**, **Files**, **Dynamic params**, **Headers**, **Cookies** or **User**. |
## What the node sends
With **Everything**, the data is an object with the request details, among them `query` (query arguments), `body` (the request body), `headers`, `params`, `cookies`, `ip` and `url`. For example, `value.query.name` reads `?name=Jane`. See [Create a GET endpoint](../../recipes/get-endpoint/).
With **Payload**, the data is the request body only. See [Create a POST endpoint](../../recipes/post-endpoint/).
## Things to know
- While the flow is [paused](../../guides/pause-flow/), the address answers `503`.
---
title: Response
project: LessCode
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/reference/response/
updated: 2026-11-19T04:41:17.281Z
---
# Response
> The settings of the Response component, which answers HTTP requests.
**Response** answers the request that a [Route](../route/) received earlier in the same flow.

| Setting | What it does |
|---|---|
| **Type** | The kind of answer: **Auto**, **JSON**, **Success**, **Error**, **Empty response**, **Plain text**, **HTML**, **XML** or **Buffer**. |
| **Status code** | The HTTP status, for example `200` or `400`. With **Auto**, the field is locked at `200`. |
| **Path for reading value** | The property of the data to send. Default `response`. Empty it to send the whole data. |
The node header shows the status and the type, for example `200 auto` or `400 json`.
## Examples
| Data the node receives | Path | Answer |
|---|---|---|
| `{ message: 'Hello, Jane!' }` | empty | `{"message":"Hello, Jane!"}` |
| `{ response: { success: true } }` | `response` | `{"success":true}` |
See [Create a GET endpoint](../../recipes/get-endpoint/) and [Create a POST endpoint](../../recipes/post-endpoint/).
If your endpoint answers `{}`, the data has no property with the name in **Path for reading value**.
---
title: Code
project: LessCode
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/reference/code/
updated: 2026-11-19T04:41:16.354Z
---
# Code
> Write a few lines of JavaScript that run on each message.
The **Code** node runs your JavaScript on every message it receives, on the server. Download it from the **Common** group of the catalog.
| Setting | What it does |
|---|---|
| **Name** | A name for your own reference. |
| **Number of outputs** | How many outputs the node has: **Output #1**, **Output #2** and so on. |
| **Code** | Your JavaScript. |
## What you can use
| Name | What it is |
|---|---|
| `value` | The data of the message. |
| `send(data)` | Sends data to the first output. |
| `$.send('output2', data)` | Sends data to the second output. Use `output3`, `output4` and so on for the next ones. |
| `instance.replace('{KEY}')` | Returns the text with each `{KEY}` replaced by the [variable](../../guides/variables/) of that name. |
| `console.log(...)` | Writes a line to the [Console](../../guides/console/) or to the terminal. |
| `throw new Error('...')` | Stops the message and reports an [error](../../guides/errors/). |
A message that you do not send on does not go further.
## Examples
Answer with a greeting:
```js
send({ message: 'Hello, ' + (value.query.name || 'world') + '!' });
```
Send to one of two outputs:
```js
if (!value.product) {
$.send('output2', { error: 'The product is required.' });
return;
}
send({ response: { success: true, product: value.product } });
```
More examples are in the [recipes](../../recipes/get-endpoint/).
---
title: The flow file
project: LessCode
version: 1.0
section: reference
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/reference/flow-file/
updated: 2026-11-19T04:41:16.354Z
---
# The flow file
> Where LessCode keeps your work and what the file contains.
LessCode keeps your whole flow in one JSON file.
| Installation | Location |
|---|---|
| Source | `flowstreams/lesscode.flow` in the LessCode folder |
| Docker | `/www/.src/flowstreams/lesscode.flow` in the container |
## What it contains
| Part | Content |
|---|---|
| Design | Your nodes, their settings, positions, notes and connections, and your groups. |
| Components | The source of every component in the list on the left, including downloaded ones and those made with Link endpoint. |
| Variables | Your [variables](../../guides/variables/). |
**Download design** in the designer gives the same content as a file named `Total.js LessCode.json`. See [Back up your flow](../../guides/backups/).
## Rules
- LessCode writes the file about five seconds after each change.
- Keep a single `.flow` file in the folder. The designer shows only one flow.
- Edit the file only while LessCode is stopped.
---
title: Create a GET endpoint
project: LessCode
version: 1.0
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/recipes/get-endpoint/
updated: 2026-11-19T04:41:14.691Z
---
# Create a GET endpoint
> Build an HTTP endpoint that reads a query argument and answers with JSON.
This endpoint answers `GET /api/hello/`. It greets the name you pass in the address, or the world when there is none.

You need the **Route**, **Code** and **Response** components. See [Download components](../../guides/download-components/).
## Build it
1. Drag **Route**, **Code** and **Response** onto the canvas.
2. Connect **Request** of Route to **Input** of Code, and **Output** of Code to **Response** of Response.
3. Double-click **Route**. Keep **Method** `GET`, set **Relative URL address** to `/api/hello/` and select **APPLY**.
4. Double-click **Code**, replace the code with the code below and select **APPLY**.
5. Double-click **Response**, empty **Path for reading value** and select **APPLY**.
6. Select **APPLY** in the toolbar, then **Continue**.
The code of the Code node:
```js
send({ message: 'Hello, ' + (value.query.name || 'world') + '!' });
```
`value` is the request that Route sends: with **Send to output** set to **Everything**, the query arguments are in `value.query`.
## Try it
```bash
curl 'http://localhost:8000/api/hello/?name=Jane'
```
```json
{"message":"Hello, Jane!"}
```
Without a name:
```bash
curl http://localhost:8000/api/hello/
```
```json
{"message":"Hello, world!"}
```
## Why empty the path
By default, Response sends only the `response` property of the data it receives. Empty **Path for reading value** to send the whole object, or send your data inside `response`, as in [Create a POST endpoint](../post-endpoint/).
See also [Route](../../reference/route/) and [Response](../../reference/response/).
---
title: Create a POST endpoint with validation
project: LessCode
version: 1.0
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/recipes/post-endpoint/
updated: 2026-11-19T04:41:15.510Z
---
# Create a POST endpoint with validation
> Accept JSON data, check it and answer with success or with a 400 error.
This endpoint accepts an order at `POST /api/orders/`. It answers `200` with the order when a product is given, and `400` with an error when it is missing.

## Build it
1. Drag **Route**, **Code** and two **Response** nodes onto the canvas.
2. Double-click **Route**. Set **Method** to `POST`, **Relative URL address** to `/api/orders/` and **Send to output** to **Payload**. Select **APPLY**.
3. Double-click **Code**. Set **Name** to `Check order`, **Number of outputs** to `2`, and paste the code below. Select **APPLY**.
4. Double-click the second **Response**. Set **Type** to **JSON**, **Status code** to `400`, empty **Path for reading value** and select **APPLY**. Keep the first Response as it is.
5. Connect **Request** of Route to **Input** of Code, **Output #1** to the first Response and **Output #2** to the second Response.
6. Select **APPLY** in the toolbar, then **Continue**.

The code of the Code node:
```js
if (!value.product) {
$.send('output2', { error: 'The product is required.' });
return;
}
send({ response: { success: true, product: value.product, quantity: value.quantity || 1 } });
```
With **Send to output** set to **Payload**, `value` is the JSON body of the request. `send()` uses the first output and `$.send('output2', ...)` the second one. The first Response keeps its default path `response`, so it sends the object inside `response`.
## Try it
```bash
curl -X POST -H 'Content-Type: application/json' --data '{"product":"Demo product","quantity":2}' http://localhost:8000/api/orders/
```
```json
{"success":true,"product":"Demo product","quantity":2}
```
Without a quantity, the answer uses 1:
```json
{"success":true,"product":"Demo product","quantity":1}
```
Without a product, the status is `400`:
```bash
curl -X POST -H 'Content-Type: application/json' --data '{"quantity":2}' http://localhost:8000/api/orders/
```
```json
{"error":"The product is required."}
```
---
title: Run a workflow on a schedule
project: LessCode
version: 1.0
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/recipes/scheduled-workflow/
updated: 2026-11-19T04:41:16.354Z
---
# Run a workflow on a schedule
> Run work every few seconds with Timer, or at set times with Crontab.
**Timer** starts a flow at a fixed interval. **Crontab** starts it at set minutes, hours or days. Both run on the server, with or without the designer open.

## Every few seconds: Timer
This service runs every 10 seconds, writes a log line and passes a status to Print.
1. Drag **Timer**, **Code** and **Print** onto the canvas and connect them in that order.
2. Double-click **Timer**. Set **Interval** to `10000` (milliseconds). To send fixed data, clear **Random data** and type the **Data**, for example `tick`. Select **APPLY**.
3. Double-click **Code**, paste the code below and select **APPLY**.
4. Select **APPLY** in the toolbar, then **Continue**.

```js
console.log('Heartbeat received:', value);
send({ status: 'ok', checked: new Date().toISOString() });
```
Every 10 seconds, Print shows the status and the time, and the log line appears in the [Console](../../guides/console/). Select **Run** on the Timer to start it at once.
## At set times: Crontab
1. Drag **Crontab** and **Print** onto the canvas and connect them.
2. Double-click **Crontab**.
3. In **Timers**, type a schedule in the empty field at the bottom and press Enter. A new Crontab has `0 9 * * *` (every day at 9:00). Remove a schedule with the bin icon next to it.
4. Choose what it sends in **Type**, for example **Current date and time**.
5. Select **APPLY**, then **APPLY** in the toolbar and **Continue**.

A schedule has five fields: minute, hour, day of month, month and day of week (0 is Sunday). `*` means every value.
| Schedule | Runs |
|---|---|
| `* * * * *` | Every minute |
| `0 9 * * *` | Every day at 9:00 |
| `0 20 * * 1` | Every Monday at 20:00 |
**Time zone offset** is in minutes. As the window says, the server time is in UTC, and the window shows the offset of your browser.
Select **Run** on the Crontab to start it at once.
---
title: Call an HTTP API
project: LessCode
version: 1.0
section: recipes
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/recipes/call-http-api/
updated: 2026-11-19T04:41:14.223Z
---
# Call an HTTP API
> Turn an HTTP address into a reusable node with Link endpoint and send data to it.
**Link endpoint** creates a component that calls one HTTP address. The component has two outputs: **Output** for a successful answer and **Error** for an answer with an error status, such as `400`.
This example calls the endpoint from [Create a POST endpoint](../post-endpoint/).
## Create the component
1. Select **Add** (plus) in the toolbar, then **Link endpoint**.
2. Set **Name** to `Orders API`, **Group name** to `My APIs`, **HTTP method** to `POST`, **Data serialization** to `JSON` and **URL address** to `http://localhost:8000/api/orders/`.
3. Select **CREATE**.

The component appears in the list on the left under **My APIs**. You can use it as many times as you like.
| Field | What to enter |
|---|---|
| **Name** | The name of the component. Required. |
| **Group name** | The heading it appears under in the list. |
| **Icon** | The icon of the component. |
| **HTTP method** | `POST`, `GET`, `PUT`, `PATCH` or `DELETE`. |
| **Data serialization** | **JSON** or **URL encode**, for the body of the request. |
| **URL address** | The address to call. Required. |
| **Custom headers** | A header name and value. Press Enter to confirm each one. |
| **Compress data via GZIP** | Compresses the data you send. |
| **Read me** | A description, shown by **Read information**. |
## Use it
1. Drag **Trigger**, **Orders API** and two **Print** nodes onto the canvas.
2. Connect Trigger to the input of Orders API, **Output** to the first Print and **Error** to the second Print.
3. Double-click **Trigger**, choose **Object**, clear **Random data**, set **Data** to `{ product: 'Demo product', quantity: 3 }` and select **APPLY**.
4. Select **APPLY** in the toolbar, then **Continue**.
5. Select **Run** on the Trigger.
The first Print shows the answer of the API:
```json
{"success":true,"product":"Demo product","quantity":3}
```

When the API answers with an error, the answer goes to the **Error** output. With `{ quantity: 1 }` as Trigger data, the second Print shows:
```json
{"error":"The product is required."}
```
---
title: The designer
project: LessCode
version: 1.0
section: faq
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/faq/designer/
updated: 2026-11-19T04:41:04.689Z
---
# The designer
> Answers to common questions about the designer.
## Why does the designer show only a spinner?
LessCode has no flow to show. This happens with the Docker image when the volume has no `lesscode.flow` file. Copy the default file into the container and restart it. See [Install with Docker](../../guides/install-docker/).
## Why is the component list so short?
A new flow has only **Print**, **Console debug** and **Trigger**. Add more with **Add > Download components**. See [Download components](../../guides/download-components/).
## Where is the sign-in page?
There is none. Protect the designer with the steps in [Run in production](../../guides/production/).
## My changes disappeared after a restart. Why?
- LessCode saves about five seconds after a change. Stopping it sooner loses the last change.
- After an Apply that removed nodes, new nodes are not saved until you restart LessCode. See [Remove nodes](../../guides/remove-nodes/).
- With Docker, the volume must be on `/www/.src/flowstreams`. See [Install with Docker](../../guides/install-docker/).
## How do I delete a node?
Right-click it, select **Remove**, then select **APPLY** and **Continue**. See [Remove nodes](../../guides/remove-nodes/).
---
title: Endpoints
project: LessCode
version: 1.0
section: faq
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/faq/endpoints/
updated: 2026-11-19T04:41:04.689Z
---
# Endpoints
> Answers to common questions about API endpoints.
## My endpoint answers 404. Why?
- You have not applied the Route yet. Select **APPLY** in the toolbar, then **Continue**.
- You removed nodes before you added the Route. Restart LessCode and add the Route again. See [Remove nodes](../../guides/remove-nodes/).
- The method or address differs. Check **Method** and **Relative URL address** in the [Route](../../reference/route/) settings.
## My endpoint answers 503. Why?
The flow is paused. Select **Pause** in the toolbar to start it again. See [Pause the flow](../../guides/pause-flow/).
## My endpoint answers {}. Why?
The [Response](../../reference/response/) reads the property named in **Path for reading value**, which is `response` by default. Empty that field, or send your data inside `response`.
---
title: Components and development
project: LessCode
version: 1.0
section: development
language: en
license: MIT
url: https://totaljs.es/docs/lesscode/1-0/development/components/
updated: 2026-11-19T10:58:54.144Z
---
# Components and development
> The components of LessCode come from the Total.js Flow catalogue: their reference and how to write your own are in the Flow documentation.
LessCode runs the same FlowStream engine as Total.js Flow and downloads its components from the same official catalogue. That is why the components and how to write them are documented once, in the documentation of Flow.
## The available components
Every component of the official catalogue, with its inputs, outputs, settings and description:
- [Official components](/flow/11-1/components/introduction/): where they come from, their versions and how they are updated.
- [Common](/flow/11-1/components/common/), [Triggers and time](/flow/11-1/components/triggers-and-time/), [Data and transformations](/flow/11-1/components/data-and-transformations/) and the other groups of the catalogue.
To add them to a flow in LessCode, see [Download components](/lesscode/1-0/guides/download-components/).
## Write your own components
A component is one HTML file with its server code, its settings form and its look. The guides start here:
- [Develop components](/flow/11-1/development/introduction/)
- [The component file](/flow/11-1/development/component-file/) and [Your first component](/flow/11-1/development/first-component/)
- [Inputs, outputs and messages](/flow/11-1/development/inputs-outputs/)
- The reference of the [component file](/flow/11-1/development/component-api/), the [instance](/flow/11-1/development/instance-api/) and the [message](/flow/11-1/development/message-api/)
## What is only in LessCode
LessCode adds its own HTML, styles and server code with the files of its `extensions` folder: see [Extensions](/lesscode/1-0/guides/extensions/).