--- title: Introduction project: OpenTemplates version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/opentemplates/1-0/guides/introduction/ updated: 2026-11-19T07:56:18.024Z --- # Introduction > What OpenTemplates is, what it does and where to start. OpenTemplates keeps the HTML templates of your documents, such as invoices, contracts or letters, in one place. Your other apps send it the data of a document, and OpenTemplates answers with the finished HTML. With a Total.js API token it can also print the document as PDF, DOCX or JPG. OpenTemplates is an official Total.js app under the MIT license. The code is on [GitHub](https://github.com/totaljs/opentemplates). ## What you can do - Group your templates in **profiles**, for example one profile per project or customer. - Give every profile a **layout**: the HTML page around its templates, with shared styles and helpers. - Write templates in HTML with a live preview, a sample model and your own helpers. - Let each app render templates with its own **API token**. - See every render in the **Logs**. - Export profiles and templates as JSON files and import them on another server. ## How it fits together 1. You create a profile with the identifier `demo`. 2. In that profile you create a template with the identifier `invoice` and write its HTML. 3. You create an API token for your app. 4. Your app sends `{"id":"demo/invoice","data":{...}}` to OpenTemplates with the token. 5. OpenTemplates fills the template with the data, puts it into the layout and answers with the HTML. ## Where to go next - [Install OpenTemplates](../install/) and [open it for the first time](../first-start/). - Create your first [profile](../profiles/) and [template](../templates/). - Learn the [template syntax](../template-syntax/). - Connect your app: [REST API overview](../../reference/rest-api/). --- title: Install from source project: OpenTemplates version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/opentemplates/1-0/guides/install/ updated: 2026-11-19T07:56:18.024Z --- # Install from source > Install OpenTemplates with Node.js and start it on your computer or server. You need [Node.js](https://nodejs.org) (a current LTS release) and Git. ## Install and start **1.** Get the code and open its folder: ```bash git clone https://github.com/totaljs/opentemplates.git cd opentemplates ``` **2.** Install the dependencies (once): ```bash npm install ``` **3.** Start OpenTemplates: ```bash npm start ``` **4.** Open `http://localhost:8000/` in your browser. It takes you to the interface at `/setup/`. See [First start](../first-start/). OpenTemplates 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 OpenTemplates with Node.js and pass the port: ```bash node index.js 8080 ``` ## Where your data is saved Profiles, templates, tokens, the configuration, the logs and uploaded files are saved in the `databases` folder inside the OpenTemplates folder. See [The data folder](../../reference/data-folder/) and [Back up your data](../backups/). Before you open OpenTemplates to other people, read [Run in production](../production/). --- title: First start project: OpenTemplates version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/opentemplates/1-0/guides/first-start/ updated: 2026-11-19T07:56:18.024Z --- # First start > Open the interface for the first time and protect it with a primary access token. OpenTemplates has no user accounts. The interface is protected by one **primary access token**. Until you set it, anyone who can reach the server can open the interface, so set it first. ## Open the interface Open `http://localhost:8000/setup/`. The start page shows the three parts of the interface. The same icons are always in the menu on the left. ![The start page with Profiles, Tokens and Configuration](/files/JapW2G4mY61f.webp) - **Profiles**: your [profiles](../profiles/), their [templates](../templates/) and the [logs](../logs/). - **Tokens**: the [API tokens](../api-tokens/) your apps use. - **Configuration**: the name of the app, the primary access token and the [Total.js API token](../configuration/). ## Set the primary access token **1.** Click **Configuration**. **2.** Under **Security**, click **Generate**. A new random token fills the **Primary access token** field. You can also type your own. **3.** Click **SUBMIT**. **4.** OpenTemplates says that the configuration has been saved and that the app needs to be reloaded. Click **OK**. The interface opens again at `/setup/?token=...`. **5.** Bookmark that address or keep the token in your password manager. You need it every time you open the interface. ## Open the interface with the token From now on, open the interface with the token in the address: ```text http://localhost:8000/setup/?token=YOUR_PRIMARY_TOKEN ``` Without the token, `/setup/` answers `401 Unauthorized`. With the token the start page is empty: use the icons in the menu on the left. The primary access token only opens the interface. Your apps use their own [API tokens](../api-tokens/) to render templates. ## Change the token Open **Configuration**, enter or generate a new **Primary access token** and click **SUBMIT**. The old token stops working at once. --- title: Profiles project: OpenTemplates version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/opentemplates/1-0/guides/profiles/ updated: 2026-11-19T07:56:19.966Z --- # Profiles > Create, edit, clone and remove the profiles that group your templates. A profile is a group of templates that share one [layout](../layouts/). Use one profile per project, customer or brand. Every profile has an **Identifier** that your apps use in the template ID, for example `demo` in `demo/invoice`. Click **Profiles** in the menu on the left to see your profiles. ![The Profiles page with two profiles](/files/JapW2W51Y60f.webp) Each card shows the name of the profile, how many times its templates have been rendered (**Used**) and when the last render happened. Type in **Search** to filter the cards by name. Click a card to open its [templates](../templates/). ## Create a profile **1.** Click **Create**. **2.** Fill in the form: ![The Create profile form](/files/JapW2Y52Y61f.webp) | Field | What it does | |---|---| | **Identifier** | Required. The first part of the template ID, for example `letters`. Use short lowercase words without spaces. | | **Name** | Required. The name you see in the interface. | | **Color** | The color of the icon. | | **Icon** | The icon of the card. | **3.** Click **SUBMIT**. A new profile starts with the default layout. See [Layouts](../layouts/). ## The profile menu Click the gear on the right of a card to open the menu of the profile. ![The menu of a profile](/files/JapW2Z53Y60f.webp) - **Edit**: change the identifier, name, color or icon. - **Update template**: edit the [layout](../layouts/) of the profile. - **Clone**: create a copy of the profile with all its templates. The copy is named `... (CLONED)`, its identifier ends with `_cloned`, and its form opens so you can rename it. - **Export**: download the profile with its layout and templates as a JSON file. See [Export and import](../export-import/). - **Remove**: remove the profile and all its templates, after you confirm. If you change the **Identifier** of a profile, change the template IDs in your apps too. --- title: Layouts project: OpenTemplates version: 1.0 section: guides language: en license: MIT url: https://totaljs.es/docs/opentemplates/1-0/guides/layouts/ updated: 2026-11-19T07:56:18.767Z --- # Layouts > Edit the HTML page that wraps every template of a profile. Every profile has one layout. The layout is a full HTML page, and every template of the profile is rendered inside it. Put the styles, fonts and helpers that all your documents share in the layout. ## Edit the layout **1.** On the **Profiles** page, click the gear of the profile. **2.** Click **Update template**. **3.** Edit the HTML on the left. The right side shows a preview. ![The layout editor](/files/JapW2N4tY60f.webp) **4.** Click **SUBMIT** to save. ## The default layout A new profile starts with this layout: ```html OpenTemplates {{ value | raw }} ``` Three parts matter: - `{{ value | raw }}` is where the rendered template goes. Keep it in every layout. - `{{ if $.preview }}` is true only in the editor preview. The default layout uses it to show an A4 sheet on a grey background in the editor, and a plain white page in the real output. - The ` ``` ## Helpers A helper changes a value before it is written. Define helpers in a plain ` ``` With the data `{"name":"Jane Doe"}` this renders `Hello JANE DOE!`. The `