> For the complete documentation index, see [llms.txt](https://trillojs.gitbook.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trillojs.gitbook.io/en/quick-start.md).

# Quick Start

## Installation

> Trillo requires Node.js v.16 or higher. If you don't have it on you machine, download it from the [Node.js site](https://nodejs.org/en) and install it before proceeding.

```sh
npm install -g trillo
```

Once installed, we can use the [`trillo serve`](https://trillojs.dev/docs/reference/cli) command to start a [development server](https://trillojs.dev/docs/reference/server#development-mode).

## Hello World

```sh
mkdir myapp
trillo serve myapp
# ... http://localhost:3000
```

We can add a simple page...

```html
<!-- myapp/index.html -->
<html>
  <body :count="[[0]]"
        :did-init="[[
          setInterval(() => count++, 1000);
        ]]">
    Seconds: [[count]]
  </body>
</html>
```

...and open [http://localhost:3000](http://localhost:3000/) to see the seconds counter live.

## Use in a project

Let's create a demo project:

```sh
mkdir myproject
cd myproject
npm init -y
npm install trillo
mkdir docroot
```

We need to add an entry point with our configuration:

```js
// index.js
const trillo = require('trillo');
const path = require('path');

new trillo.Server({
  port: 3001,
  rootPath: path.join(__dirname, 'docroot'),
});
```

In TypeScript (or ES6 code) we can use imports instead:

```ts
// index.ts
import { Server } from 'trillo';
import path from 'path';

new Server({
  port: 3001,
  rootPath: path.join(__dirname, 'docroot'),
});
```

We can now create a page in `docroot/` like shown above and run the project:

```sh
node index.js
# ... START http://localhost:3001
```

> When using Trillo in a project we can customize it and add our own services and middleware to the server. All options are documented in the [Server Reference](https://trillojs.dev/docs/reference/server).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://trillojs.gitbook.io/en/quick-start.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
