--- title: Introduction project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/introduction/ updated: 2026-11-19T05:59:09.540Z --- # Introduction > Documents is a self-hosted documentation app built with Total.js 5. People read clean pages; agents and LLMs read the same content as Markdown, llms.txt, a dataset or through MCP. Documents is an app for writing and publishing the documentation of your projects: libraries, apps, APIs or anything else. You install it on your own server, write in a panel, and every page is online at once. ## What you get - **A clear structure.** Every project has versions, and every version has guides, reference, recipes, FAQ and a changelog. Readers always know where to look. - **A real API reference.** Methods, properties, events and commands are structured entries with a signature, parameters, a return value and examples, not loose text. - **Versions side by side.** Version 4 and version 5 of the same project live together, with links between equivalent pages and entries. - **Languages.** Each project has an original language. Pages and entries are translated one by one, and a translation is marked as outdated when its original changes. - **Ready for AI.** Every page is also Markdown. There is an `llms.txt`, a JSONL dataset, a sitemap with every language, JSON-LD and an MCP server that agents can read and, with a token, write. - **A panel with roles.** Owners, editors and translators, a full history of every change with restore, and agent tokens. - **Simple to run.** One Node.js process and a PostgreSQL database. The content is kept in memory, so pages render without a query. ## This documentation is an example What you are reading is the documentation of Documents itself. It comes with every installation, so a new site is never empty and you can see how a complete project looks. It is updated with every new version of the app. To write your own documentation, create a new project, or duplicate this one and change it. See [The example project](/documents/1/guides/example-project/). --- title: Getting started project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/getting-started/ updated: 2026-11-19T05:59:09.540Z --- # Getting started > Install Documents, create the owner account and publish your first page. ## Requirements - Node.js 22 or newer, or Docker. - A PostgreSQL database. Put its connection in the `config` file before the first start: ``` database : postgresql://user:password@localhost:5432/documents ``` On an empty database Documents creates its tables by itself. ## Install with Node.js ```bash git clone https://github.com/totaljs-es/documents.git cd documents npm install npm start ``` Open `http://localhost:8000`. For production, start it in release mode with `npm run release`. ## Install with Docker ```bash docker compose up -d ``` The compose file mounts the `config` file of the app in the container, so the database and every other setting stay there. The content lives in PostgreSQL, the uploaded images in the `documents-data` volume and the backups in `documents-backups`. Put a reverse proxy with HTTPS in front of the app. ## Create the owner account On the first start, Documents creates the **owner**, the account that can manage everything, with a random login and password. Open `/admin/`: the sign-in page shows them, with a button that fills in the form. They are also in the log (with Docker: `docker compose logs documents`). Sign in with them and you are in the panel. Then, in **Users**, change that login and password for your own (at least 8 characters): until you do, the panel reminds you. The sign-in page shows them only until the first sign-in, so sign in as soon as the site is online. ## Your first project 1. In **Projects**, press **New project**. Give it a name and a slug: the slug is its address, for example `/my-library/`. 2. The project starts with a version `1`. Open the project and press **New page**. 3. Choose the section (Guides, for example), write a title and the text in Markdown, and set the status to **Published**. 4. Save. The page is online, together with its Markdown version for agents. ## Set the public address In **Settings**, write the public address of the site, for example `https://docs.example.com`. Documents uses it for the absolute links of `llms.txt`, the sitemap and the MCP server. --- title: How content is organized project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/content-model/ updated: 2026-11-19T05:59:09.540Z --- # How content is organized > Projects, versions, sections, pages and entries: five levels, each with one clear job. | Level | Example | Job | | --- | --- | --- | | Project | Total.js | The product you document | | Version | 5 | One release line, with its own pages | | Section | Reference | The kind of content | | Page | Routing | One topic | | Entry | `ROUTE()` | One method, property, event or command | Addresses follow the same shape: `/{project}/{version}/{section}/{page}/`. An entry is an anchor inside its page: `/{project}/{version}/reference/{page}/#{entry}`. ## Projects A project has a name, a slug, a summary, a group, an original language, a license and a visibility. It can also have the address of its repository (GitHub by default, or GitLab, Bitbucket, Codeberg or another one): the home page of the project shows it as a badge with its logo, and its `llms.txt` names it. Groups (Libraries, Apps, Tools…) are a list of the site: create them with **New group** in **Projects**, move them with the arrows, and drag the projects inside their group. The home page shows them in the same order. A **private** project is only visible to signed-in users and never appears in `llms.txt`, the sitemap, the dataset or the public MCP tools. ## Sections Each project has its own sections, in its own order. In the panel, open the project: every section has buttons to add a page, move it up or down and edit its name and slug, and **New section** adds one. A section with pages cannot be removed, and a new slug changes the addresses of its pages. A new project starts with these five: - **Guides** explain a topic from the start. - **Reference** lists the API as structured entries. - **Recipes** solve one concrete task, step by step. - **FAQ** answers short questions. - **Changelog** records what changed in each release. ## Pages A page has a title, a summary, a body in Markdown, tags, an order and a status: **published** or **draft**. A page can have a parent page, so a section can have sub-pages. Drafts are not public. ## Entries Entries belong to a page, usually in the Reference section. They are explained in [API reference](/documents/1/guides/api-reference/). --- title: Writing pages project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/writing-pages/ updated: 2026-11-19T05:59:09.540Z --- # Writing pages > The page editor: Markdown, preview, images, draft or published, order and the change note. Open a project in the panel and press **New page**, or **+ Page** in a section, or click a page to edit it. Each page of the list also has quick buttons to publish or unpublish it, duplicate it as a draft, or remove it. ## Title, slug and summary The slug is filled from the title while the page is new; you can change it. The **summary** is one or two sentences: it appears under the title, in search results, in `llms.txt` and for agents. Write it for someone who only reads that line. ## Markdown The text is Markdown: `##` and `###` headings (they build the table of contents), **bold**, `code`, lists, tables, links and code blocks with a language: three backticks and the name of the language on the first line, three backticks on the last one. A `js` block: ```js var client = new Client(); ``` Press **Preview** to see the page as readers will see it. ## Images Press **Upload image**: the image is stored in the app and a Markdown link is added to the text. Images up to 5 MB: jpg, png, gif or webp. SVG is not accepted, because an SVG can run scripts. Every uploaded file is in **Files**: where it was uploaded, which pages use it now, and whether it is **unused** (for example after you replaced it with another image). Copy its address or its Markdown to use it in another page, and remove the files that nothing uses. ## Draft or published A **draft** is only visible in the panel. Set the status to **Published** to put it online. ## Order and parent page Pages of a section are sorted by **order**, from low to high: drag them in the list of the project to change it. A page with a **parent page** appears under it in the sidebar. ## Change note The change note is optional and is stored in the history together with your name. Every save leaves a revision, so you can always go back. See [History and restore](/documents/1/guides/history/). --- title: API reference project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/api-reference/ updated: 2026-11-19T05:59:09.540Z --- # API reference > Entries are the methods, properties, events and commands of your API, with their signature, parameters, return value and examples. Open a page (usually in the Reference section) and press **Add entry**. ## Fields of an entry | Field | Example | Notes | | --- | --- | --- | | Name | `client.get()` | Used by the search and by `Docs_entry` | | Type | `method` | method, property, event, delegate, command, rest, glossary, component, config, class, type | | Signature | `client.get(path, [options])` | How it is called; shown as the title of the card | | Summary | Sends a GET request. | One sentence | | Parameters | `path`, `options` | Name, type, optional, default and description | | Returns | `Promise` | Type and description | | Details | | Markdown, for everything else | | Examples | | Title, language and code | | Since | `2.0` | The version where it appeared | | Deprecated | Use `client.fetch()` | Empty, or what to use instead | | Keywords | | Words that help the search | Readers see each entry as a card with a colored type, its parameters in a table and a link that copies its address. Agents receive the same entry as clean Markdown. ## Anchors Every entry has an anchor, made from its name: `#get`. You can change it in the editor. ## The same entry in another version When a version is created as a copy of another, every page and entry remembers its original. Readers then see a link to the same page or entry in the other version. --- title: Versions project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/versions/ updated: 2026-11-19T05:59:09.540Z --- # Versions > Keep several release lines of a project side by side and start a new one as a copy of the current one. Every project has at least one version. Each version has its own pages and entries, and its own address: `/{project}/{version}/`. ## Status | Status | Meaning | | --- | --- | | current | The version that new readers should use | | legacy | Still documented, in maintenance; readers see a notice | | archived | Kept for reference | | draft | Being written; not public | The **default version** of the project (in the project form) is where `/{project}/` sends readers. ## A new version Open the project, choose the version to start from and press **New version**. The new version starts as a **draft** copy of every page and entry. Change what is new, then set it to **current** and the old one to **legacy**. Readers switch versions with the selector at the top of the sidebar. --- title: Languages and translations project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/languages/ updated: 2026-11-19T05:59:09.540Z --- # Languages and translations > Write in one language and translate page by page. Documents tells you when a translation falls behind its original. ## Enabled languages In **Languages** you choose the languages of the site and the default one, and you can add a language with its flag. Pages in the default language have no prefix in the address; the others have one: `/es/{project}/…`. The interface of the site follows the language of the address. The panel has its own: each person chooses it in the language menu under their name (or on the sign-in page), and it is kept with their account. The interface comes in English, Spanish, German, French, Italian and Slovak; a new `resources/{language}.resource` adds another one (`node tools/translations.js --export` lists every text). ## The original language Each project has an **original language**. Pages and entries are written in it, and translated into the other enabled languages. ## Translating Open **Translations** in the panel and choose a language: its tab shows how much of it is up to date. The list is grouped by project, with a progress bar, and shows every page with its API entries under it, in reading order. Filter it by status (**To do** shows what is outdated or missing), by project, or search it. Each item has a status: - **missing**: not translated yet. Readers see the original with a notice. - **outdated**: the original changed after the translation. Readers see the translation with a notice. - **current**: up to date. Click an item to translate it next to its original. For entries, the parameters and examples start as a copy of the original, so you only translate the texts. In the form: - **Changes in the original since this translation**: for an outdated translation, the lines added and removed in the original, so you do not read the whole page again. - **Mark as up to date**: when the change of the original does not affect the translation (a typo, a link). - **Copy the original**: fills the empty fields with the original, to translate over it (code blocks and tables stay). - **Save and next**: saves and opens the next item that still needs work. ## Agents that translate A token with the **translator** role lets an AI agent list what is missing and save translations. See [Let an agent translate](/documents/1/recipes/agent-translator/). --- title: History and restore project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/history/ updated: 2026-11-19T05:59:09.540Z --- # History and restore > Every change leaves a revision with who made it, how and why. Any revision can be restored. Each time a project, version, page, entry or translation is saved, Documents stores a full copy of it: a **revision**. It records the person or agent, the way (panel, MCP or update) and the change note. ## See the history Press **History** in the editor of a page, an entry or a translation. The newest revision is first. **Show** opens the stored copy. ## Restore Press **Restore this version** on an older revision. The restore is itself a new revision, so nothing is lost: you can go back again. Removed pages and entries stay in the history too. --- title: Users and roles project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/users-and-roles/ updated: 2026-11-19T05:59:09.540Z --- # Users and roles > Owners manage everything, editors write content and translators translate. Each user can be limited to some projects. | Role | Can | | --- | --- | | owner | Everything: settings, users, agent tokens, projects, content and translations | | editor | Projects, pages, entries and translations | | translator | Translations only | Open **Users** in the panel (owners only) to add people. A user with projects selected only works in those projects; without projects, in all of them. Passwords are stored as hashes. After 10 wrong passwords from the same address, the sign-in is blocked for a while. There must always be at least one owner. When a password changes, every open session of that user ends. --- title: AI and agents project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/ai-and-agents/ updated: 2026-11-19T05:59:09.540Z --- # AI and agents > Everything agents, crawlers and training pipelines can read, and how an agent can write with a token. Documents publishes every page twice: as HTML for people and as Markdown for machines. Private projects never appear in any of the files or tools below. ## Markdown of every page Add `.md` to the address of a page: `/{project}/{version}/{section}/{page}.md`. It starts with a YAML header (title, project, version, section, language, license, URL, update date) and includes all the entries of the page. The page links to it with ``. ## llms.txt, llms-full.txt and the dataset - `/llms.txt` lists every public project and version. - `/{project}/{version}/llms.txt` lists every page of a version with a link to its Markdown. - `/{project}/{version}/llms-full.txt` is the whole version in one file. - `/{project}/{version}/dataset.jsonl` has one JSON line per page and language, with its license, ready for indexing or training. ## Search engines `/sitemap.xml` lists every page in every language with `hreflang` alternates, and every page has JSON-LD (`TechArticle` or `APIReference`). In **Settings** you choose what `robots.txt` allows: everything, everything except AI training crawlers, or nothing. ## MCP server `/mcp/` is an MCP server (Streamable HTTP). Reading needs no token: `Docs_projects`, `Docs_search`, `Docs_page` and `Docs_entry`. It is announced at `/.well-known/mcp.json`, and there is an agent skill at `/.well-known/agent-skills/documents/SKILL.md`. The page `/ai/` explains all of this to people. ## WebMCP Every page also offers the reading tools to AI agents that run inside the browser (WebMCP), with the `webmcp` component of jComponent. They are the same public tools of `/mcp/` and are listed at `/.well-known/webmcp`. While WebMCP is a Chrome trial, paste your origin trial token in **Settings**. ## Agents that write In **Agent tokens** an owner creates a token with a role (editor or translator), some projects and an expiry. The token is shown once; only its hash is stored. With the header `Authorization: Bearer `, an agent connects to `/mcp/` and gets the writing tools of its role (see [MCP tools](/documents/1/reference/mcp-tools/)), or uses the same JSON API as the panel (`POST /api/`). Both work with the permissions of its role and projects, and every change is in the history with the name of the token. Writing through MCP will come back when the native MCP of Total.js runs each tool as the agent that calls it. See [MCP tools](/documents/1/reference/mcp-tools/) and [Connect Claude Code](/documents/1/recipes/connect-claude-code/). --- title: Settings project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/settings/ updated: 2026-11-19T05:59:09.540Z --- # Settings > Name, public address, logo, accent color, languages and the policy for crawlers of the site. Open **Settings** in the panel (owners only). | Setting | Used for | | --- | --- | | Site name | The header, the titles and `llms.txt` | | Public address | Absolute links in `llms.txt`, the sitemap, MCP and the share menu | | Summary | The home page and `llms.txt` | | Accent color | Links, buttons and highlights, for example `#4D8A1F` | | Logo URL | Replaces the mark in the header; upload the image in a page first or use any address | | Layout | The home page: the cards of every documentation (default), or a welcome with every documentation in a sidebar | | Crawlers | What `robots.txt` allows | | Enabled languages | The languages of the site | | Default language | The language without a prefix in the address | The links of the home page have their own screen: see [Links](/documents/1/guides/links/). The design of the site, with its light and dark themes, is the same for every installation. --- title: Links project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/links/ updated: 2026-11-19T05:59:09.540Z --- # Links > The buttons, social networks and support pages of the home page, and their order. Open **Links** in the panel (owners only) to add the links of the home page. They appear under the welcome text in both layouts of the home page. ## Places on the home page | Place | What it shows | | --- | --- | | Buttons under the welcome text | Large buttons with a name, for example your website, blog or GitHub | | Follow us on | Round icons of the social networks | | Support us | Small buttons to the pages where readers can fund the project | A place without links is left out of the home page. ## Add a link 1. Click **Add link**. 2. Choose the **Kind of link**: a brand, such as GitHub, X, YouTube, Discord or Patreon, or **Custom link**. 3. Choose **Where on the home page**. A brand suggests its usual place, and you can change it. 4. Write the **Address**. It must start with `https://` or `http://`. 5. For a custom link, write its **Name** and choose its **Icon**. 6. Click **SUBMIT**. A brand shows its own name and logo. A custom link shows the name and the icon that you choose. ## Change the order Drag the links by the handle on the left. The home page shows them in the same order, each one in its place. ## Edit or remove a link Click a link to edit it or to move it to another place. **Remove** takes it off the home page. --- title: Reading and sharing project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/reading/ updated: 2026-11-19T05:59:09.540Z --- # Reading and sharing > What readers get: search, versions and languages, the table of contents, copy as Markdown and the share menu. - **Search.** The box at the top searches pages and API entries. Press `/` to jump to it. An exact entry name, like `client.get`, comes first. - **Versions and languages.** The selector at the top of the sidebar changes the version; the button next to the theme changes the language. - **Table of contents.** On wide screens the right column lists the headings and entries of the page and marks the one you are reading. - **Copy as Markdown.** Copies the whole page as Markdown, ready to paste into a chat with an AI. - **Share.** Sends the page by email, WhatsApp, Telegram, X or LinkedIn, copies its link or its Markdown, or opens the share sheet of the phone. - **Copy link of an entry.** The link icon of every API entry copies its exact address. - **Light and dark.** The theme follows the system, and the moon button changes it. --- title: Backups and updates project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/backups-and-updates/ updated: 2026-11-19T05:59:09.540Z --- # Backups and updates > Where the content lives, how to back it up and restore it, and how to update the app without losing anything. ## Where the content lives Everything you write is in PostgreSQL: projects, pages, entries, translations, revisions, languages, users, tokens and settings. The uploaded images are in the `databases` folder (with Docker, the `documents-data` volume). **Keep both.** ## Backups ```bash npm run backup ``` This writes `backups/documents-YYYY-MM-DD-HHmm.backup` with every table of the database and the uploaded images. Copy the backups to another place too. ## Restore Stop the app, then: ```bash npm run restore -- backups/documents-2026-11-15-1030.backup ``` The tables are replaced by the ones of the backup, and the current `databases` folder is kept as `databases-before-restore-`. ## Updating the app The database and the `databases` folder are not part of the code: a `git pull` or a new Docker image never replaces them. ```bash git pull npm install npm run release ``` When a new version of the app brings a new version of this documentation, Documents first makes an automatic backup (`backups/…-update.backup`, the last 10 are kept) and then updates only the example project. Your projects are never touched. Do not copy a new `databases` folder over your own one. ## Coming from an older Documents Older versions kept everything in NoSQL files in the `databases` folder. Stop the app, put `database` in the `config` file and copy the files once into the empty tables: ```bash node tools/migrate-nosql.js databases ``` It copies every collection, the revisions too, and checks the count of each table. The files are not changed. --- title: The example project project: Documents version: v1 section: guides language: en license: MIT url: https://totaljs.es/docs/documents/1/guides/example-project/ updated: 2026-11-19T05:59:09.540Z --- # The example project > This documentation comes with the app and is updated with it. Play with it to learn, duplicate it to make it yours, or hide it. Every installation includes this project, the documentation of Documents. It shows how a complete project looks: guides, API reference, recipes, FAQ, changelog and a translation. ## It is updated with the app The example is part of each new version of Documents. When you update the app, the example is updated too, after an automatic backup. Only the example project is written; your projects are never touched. ## Play with it Edit it like any project to learn how Documents works: change pages, add sections and pages, translate, reorder. Keep in mind that the next update of the app replaces it: your changes in the example and the pages you add to it are replaced by the new documentation, after the backup. Its visibility, group and order are kept. ## Make it yours Open the project in the panel and press **Duplicate as a new project**. The copy has every version, page, entry and translation, starts as **private**, and is a normal project of your site: edit it as you like. ## Hide it Press **Project** and set the **Visibility** to **Private**. It disappears from the site, `llms.txt`, the sitemap and the public MCP tools. Updates keep your choice. --- title: HTTP endpoints project: Documents version: v1 section: reference language: en license: MIT url: https://totaljs.es/docs/documents/1/reference/http-endpoints/ updated: 2026-11-20T06:51:57.969Z --- # HTTP endpoints > The public addresses for agents, crawlers and other programs. Private projects never appear in them. All the endpoints are public and read-only. Absolute links use the public address set in **Settings**. ## API ### GET /{project}/{version}/{section}/{page}.md Type: `rest` A page and all its entries as Markdown, with a YAML header. Returns: `text/markdown` Example: Read a page ```bash curl https://docs.example.com/documents/1/guides/introduction.md ``` ### GET /llms.txt Type: `rest` The index of every public project and version, following llmstxt.org. Returns: `text/plain` ### GET /{project}/{version}/llms.txt Type: `rest` Every page of a version, by section, with a link to its Markdown. Returns: `text/plain` ### GET /{project}/{version}/llms-full.txt Type: `rest` The whole version in one Markdown file. Returns: `text/plain` ### GET /{project}/{version}/dataset.jsonl Type: `rest` One JSON line per page and language: id, url, project, version, section, language, title, summary, markdown, entries, license and update date. Returns: `application/x-ndjson` ### GET /sitemap.xml Type: `rest` Every public page in every language, with hreflang alternates. Returns: `application/xml` ### GET /api/search/ Type: `rest` Searches pages and entries. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `q` | `String` | yes | | The words to search for. | | `project` | `String` | no | | A project slug. | | `version` | `String` | no | | A version slug. | | `type` | `String` | no | | `page` or an entry type such as `method`. | | `language` | `String` | no | | A language code. | | `take` | `Number` | no | `10` | Maximum results, up to 50. | Returns: `Array` Results with kind, type, title, url, project, version, section and summary. Example: Search ```bash curl "https://docs.example.com/api/search/?q=versions&project=documents" ``` ### GET /api/projects/ Type: `rest` The public projects with their versions and the address of their llms.txt. Returns: `Array` ### GET /api/page/ Type: `rest` A page as Markdown. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `url` | `String` | yes | | The address or path of the page. | Returns: `Object` `{ url, language, markdown }` ### GET /api/entry/ Type: `rest` API entries by exact name, as Markdown. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `name` | `String` | yes | | The entry name, with or without `()`. | | `project` | `String` | no | | | | `version` | `String` | no | | | | `language` | `String` | no | | | Returns: `Array` ### POST /mcp/ Type: `rest` The MCP server (Streamable HTTP, JSON answers). See MCP tools. Returns: `application/json` --- title: MCP tools project: Documents version: v1 section: reference language: en license: MIT url: https://totaljs.es/docs/documents/1/reference/mcp-tools/ updated: 2026-11-20T06:51:57.969Z --- # MCP tools > The tools of the MCP server at /mcp/: public and read-only. The server is the native MCP of Total.js 5: every action marked with `mcp: true` becomes a tool named after the action, and its arguments go in `query`, `input` or `params`, like in the action. ```json { "name": "Docs_search", "arguments": { "query": { "q": "versions" } } } ``` Without a token, `/mcp/` lists only the public reading tools, and the same tools are registered in the browser for WebMCP. With the header `Authorization: Bearer `, every tool runs as the agent of the token: the list adds the tools of its role, and each action checks the role and the projects of the token again. | Tools | Role of the token | | --- | --- | | `Projects_list`, `Pages_list`, `Pages_read` | editor, translator | | `Pages_save`, `Entries_save` | editor | | `Translations_list`, `Translations_read`, `Translations_save` | translator, editor | ```json { "name": "Pages_save", "arguments": { "input": { "versionid": "…", "section": "guides", "slug": "install", "title": "Install", "body": "…", "status": "draft", "note": "First draft" } } } ``` Agents cannot remove anything: that stays in the panel. See [AI and agents](/documents/1/guides/ai-and-agents/). ## API ### Docs_projects({ query: { language } }) Type: `command` Lists the projects, their versions and the address of their llms.txt. Start here when you do not know the slug of a project. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `language` | `String` | no | | Language of the names and summaries. | Returns: `Array` ### Docs_search({ query: { q, project, version, type, language, take } }) Type: `command` Searches pages and API entries. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `q` | `String` | yes | | The words to search for. | | `project` | `String` | no | | A project slug. | | `version` | `String` | no | | A version slug. | | `type` | `String` | no | | `page` or an entry type. | | `language` | `String` | no | | | | `take` | `Number` | no | `10` | | Returns: `Array` Titles, addresses and summaries; read the full text with Docs_page or Docs_entry. ### Docs_page({ query: { url } }) Type: `command` Returns a page and all its entries as Markdown. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `url` | `String` | yes | | The address or path of the page, for example /documents/1/guides/introduction/. | Returns: `Object` `{ url, language, markdown }` ### Docs_entry({ query: { name, project, version, language } }) Type: `command` Finds API entries by exact name and returns each one as Markdown. | Parameter | Type | Required | Default | Description | | --- | --- | --- | --- | --- | | `name` | `String` | yes | | The entry name, with or without `()`. | | `project` | `String` | no | | | | `version` | `String` | no | | | | `language` | `String` | no | | | Returns: `Array` --- title: Commands and configuration project: Documents version: v1 section: reference language: en license: MIT url: https://totaljs.es/docs/documents/1/reference/commands/ updated: 2026-11-20T06:51:57.969Z --- # Commands and configuration > The npm scripts of the app and the keys of its config file. Run the commands in the folder of the app. ## API ### npm start Type: `command` Starts the app on port 8000 in debug mode: it restarts when a file changes. ### npm run release Type: `command` Starts the app on port 8000 in release mode, for production. ### npm run backup Type: `command` Writes a backup of the database and the uploaded images to backups/. ### npm run restore -- Type: `command` Restores a backup. Stop the app first; the current folder is kept aside. ### npm run export-documents Type: `command` For the developers of Documents: exports the example project to private/documents.json. ### builtin : false Type: `config` In the config file: `false` turns off the example project; `edit` (for the developers of Documents) unlocks it and stops updating it, so it can be edited and exported. ### database : postgresql://user:password@localhost:5432/documents Type: `config` In the config file: the connection to the PostgreSQL database. It is required; on an empty database Documents creates its tables. The value can also be written as `hex …` or `base64 …`. ### revisions : 50 Type: `config` In the config file, how many revisions of each document the history keeps (50 by default). ### url : https://docs.example.com Type: `config` In the config file: the public address of the site when it is not set in Settings. Empty: the address of the first request. --- title: Connect Claude Code project: Documents version: v1 section: recipes language: en license: MIT url: https://totaljs.es/docs/documents/1/recipes/connect-claude-code/ updated: 2026-11-19T05:59:09.540Z --- # Connect Claude Code > Let Claude Code read your documentation through MCP. ```bash claude mcp add --transport http docs https://docs.example.com/mcp/ ``` Then ask, for example: *"Search the docs for how versions work"*. Claude calls `Docs_search` and `Docs_page` by itself and can cite the page it used. Any other MCP client works the same way: the address is `/mcp/` and reading needs no token. --- title: Let an agent translate project: Documents version: v1 section: recipes language: en license: MIT url: https://totaljs.es/docs/documents/1/recipes/agent-translator/ updated: 2026-11-19T05:59:09.540Z --- # Let an agent translate > Give an AI agent a translator token and let it fill the missing translations through MCP or the JSON API. 1. Enable the language in **Languages**, for example Spanish. 2. In **Agent tokens**, create a token with the **translator** role, for the projects to translate, with an expiry. 3. Connect the agent to `/mcp/` with the token. It gets `Translations_list` (what is missing or outdated), `Translations_read` (the original and its translation) and `Translations_save`. Agents without MCP use these two calls of the JSON API: ```bash # What is missing or outdated curl -X POST https://docs.example.com/api/ -H "Authorization: Bearer docs_…" -H "Content-Type: application/json" \ -d '{"schema":"translations?language=es"}' # Save one translation curl -X POST https://docs.example.com/api/ -H "Authorization: Bearer docs_…" -H "Content-Type: application/json" \ -d '{"schema":"translations_save","data":{"reftype":"pages","refid":"…","language":"es","fields":{"title":"…","body":"…"}}}' ``` 4. The agent reads each original with `Translations_read` (`translations_read` in the JSON API). Every translation is in the history with the name of the token. Review them in **Translations**, and revoke the token when you are done. --- title: Start from the example project: Documents version: v1 section: recipes language: en license: MIT url: https://totaljs.es/docs/documents/1/recipes/duplicate-the-example/ updated: 2026-11-19T05:59:09.540Z --- # Start from the example > Duplicate this documentation and turn it into the documentation of your product. 1. In **Projects**, open **Documents** and press **Duplicate as a new project**. 2. Give it the name and the slug of your product. 3. The copy is private. Change the pages, remove what you do not need and add your own. 4. When it is ready, set its visibility to **Public**, and set the example to **Private** if you do not want it on your site. --- title: Deploy with Docker project: Documents version: v1 section: recipes language: en license: MIT url: https://totaljs.es/docs/documents/1/recipes/deploy-with-docker/ updated: 2026-11-19T05:59:09.540Z --- # Deploy with Docker > Run Documents on a server with Docker and HTTPS. 1. Get the code. In the `config` file, write the connection of your PostgreSQL database (`database`) and the public address of your site (`url`, for example `https://docs.example.com`). The compose file mounts this `config` in the container. ```bash git clone https://github.com/totaljs-es/documents.git cd documents docker compose up -d --build ``` 2. Open `/admin/` in the browser: the sign-in page shows the random login and password of the first start, with a button that fills in the form. Sign in, and then change them for your own in **Users**. They are also in the log: ```bash docker compose logs documents ``` 3. Put a reverse proxy with HTTPS in front of port 8000 (Caddy, nginx or Traefik). The content lives in PostgreSQL, the uploaded images in the `documents-data` volume and the backups in `documents-backups`. To update: ```bash git pull docker compose up -d --build ``` The database and the volumes are kept. Back them up regularly: see [Backups and updates](/documents/1/guides/backups-and-updates/). --- title: Frequently asked questions project: Documents version: v1 section: faq language: en license: MIT url: https://totaljs.es/docs/documents/1/faq/faq/ updated: 2026-11-19T05:59:09.540Z --- # Frequently asked questions > Short answers to common questions. ## Do I need a database server? Yes: PostgreSQL. Put its connection in the `config` file (`database`); on an empty database Documents creates its tables by itself. The uploaded images stay in the `databases` folder. ## Can I keep a project private? Yes. A private project is only visible to signed-in users and never appears in `llms.txt`, the sitemap, the dataset or the public MCP tools. ## Can I change the design? In **Settings** you change the name, the logo and the accent color. The layout, with its light and dark themes, is the same for every site. ## Can I remove this example? Hide it with its visibility set to **Private**, or turn it off with `builtin : false` in the config file. ## Is my content used to train AI? Only if you allow it. In **Settings**, choose *Block AI training crawlers* for `robots.txt`, and set a license on each project: it is part of every Markdown page and of the dataset. --- title: Changelog project: Documents version: v1 section: changelog language: en license: MIT url: https://totaljs.es/docs/documents/1/changelog/changelog/ updated: 2026-11-19T05:59:09.540Z --- # Changelog > What changed in each version of Documents. ## 0.1.0 - First version: projects, versions, sections, pages and structured API entries. - Translations with outdated notices, and the interface in English and Spanish. - Search, Markdown of every page, llms.txt, dataset, sitemap, JSON-LD and the MCP server. - Panel with roles, history with restore, agent tokens and settings. - Share menu, backups, Docker and this example documentation.