---
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 `<script total>` runs on the server, once, when the flow starts.
- The rest of the file (HTML, `<style>` and normal scripts) is added to the designer page.

The folder does not exist in a new installation. Create it next to `index.js`. Do not remove the file `extensions.js`: it loads your extensions.

## Example

This file adds an endpoint that reports the uptime of the server, and an orange line under the designer toolbar.

**1.** Create the file `extensions/status.html`:

```html
<script total>
	ROUTE('GET /api/status/', $ => $.json({ name: exports.name, flow: exports.flow.id, uptime: Math.round(process.uptime()) }));
</script>

<style>
	.fheader { border-bottom: 3px solid #E8A317; }
</style>
```

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

![The designer toolbar with an orange line added by an extension](/files/Jap1Zn2JO60f.webp)

## 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.
