Dev.to WebDev 🛠 Dev 👁 0 📖 9 min read

How to build and publish a docs site with Thally

I built a small docs site for the Hyperliquid funding-rate API with Thally: an introduction, a quickstart, one practical guide, and a generated API reference. Live site: https://hl-funding.thally.app. Source: https://git

I built a small docs site for the Hyperliquid funding-rate API with Thally: an introduction, a quickstart, one practical guide, and a generated API reference. Live site: https://hl-funding.thally.app. Source: https://github.com/0xLisanAlGaib/hyperliquid-funding-guide.

This article is the path I'd give another developer who wants to do the same, including the seven things that broke and how I fixed them. Budget about two hours, most of it on writing.

What you'll end up with

  • A site at https://<your-site>.thally.app built from a GitHub repo you own.
  • Pages written in MDX, navigation in one JSON file.
  • Every push to the production branch redeploys the site.
  • Free extras you don't configure: search, Markdown copies of every page, llms.txt, and a read-only MCP endpoint at <site>/api/mcp.

Prerequisites

  • A Thally Cloud account (sign in at app.thally.io; the first sign-in starts a 7-day trial).
  • A GitHub account that can approve the Thally GitHub App.
  • For local checks: Node.js and npm. The quickstart doesn't state a minimum version. Node 22 worked for me.
  • Something to document that you know well. Pick a product with a quickstart a reader can finish in five minutes. I picked a public API that needs no key, so a reviewer can verify every example with curl.

1. Create the site in Thally Cloud

  1. Sign in, then Create a site from the workspace Home page.
  2. Enter a name, a description, and a thally.app address. Thally checks the address is free.
  3. Under docs source, choose Create a new docs repository. Thally creates a GitHub repo from its starter template. You'll be asked to install the Thally GitHub App. It asks which account or organization owns the repo and requests access to All repositories, then you pick or create the repo. It took about a minute.
  4. Check the new repo's visibility on GitHub. Mine was created private, while the site links to it from its header and llms.txt. Make it public if readers should see the source.
  5. Skip Thally Track (it opens PRs from your product repos; not needed for a first site) and Knowledge surfaces.
  6. Publish site. When the Home page shows Live, open the site.

You now have a working site with placeholder content. Everything after this is editing a Git repo.

2. Clone and check locally

git clone https://github.com/<you>/<docs-repo>.git
cd <docs-repo>
npm install
npm run dev          # http://localhost:3040

The dev server runs on port 3040. The quickstart page doesn't say so; the dev script in package.json does.

Two commands are your quality gate before every push:

npx --yes @thallylabs/cli@latest check   # lints content and config
npm run build                            # full production build

3. Learn the three files that matter

File What it controls
src/content/**/*.mdx Pages. The path is the URL: guides/funding-monitor.mdx → /guides/funding-monitor.
docs.json Tabs, sidebar groups, page order, the navbar button, and which OpenAPI file to render.
src/data/site.ts Site name, description, header links, brand colors.

Read AGENTS.md in the repo too. It's written for coding agents, but it's also the clearest statement of the house rules: every page needs title and description frontmatter, every page must be in docs.json, and runtime-owned files are not yours to edit.

4. Replace the starter content

The starter ships with example pages (components, customization, a sample "Posts" API). Delete what you won't use, then set your navigation. Mine:

"tabs": [
  { "tab": "Guide", "groups": [
    { "group": "Get started", "pages": ["introduction", "quickstart"] },
    { "group": "Guides", "pages": ["guides/funding-monitor"] }
  ]},
  { "tab": "API reference", "groups": [], "api": { "source": "openapi.yaml" } },
  { "tab": "Changelog", "href": "/changelog" }
]

5. Write the pages

The MDX components will feel familiar if you've used Mintlify: Steps/Step, Tabs/Tab, CodeGroup, AccordionGroup, Card/CardGroup, and callouts (Note, Tip, Warning, Info, Danger, Check). The home page can use a Hero with two buttons.

What made my pages work, regardless of tool:

  • Quickstart = one result the reader can verify. Mine ends with a table of the 10 markets with the highest funding and says what the reader should see, with real output.
  • Run every example before publishing it. Testing turned up four behaviors that the official API docs don't mention, and each became a troubleshooting row. One example: passing startTime in seconds doesn't fail. The API quietly returns data from 2023.
  • Troubleshooting as a table: symptom, cause, fix. Readers scan for their error message, so put the exact text in the first column.

Code block titles work with title="file.mjs" after the language:

```js title="top-funding.mjs"
const res = await fetch(...)
```

Add expandable to collapse long scripts.

6. Add an API reference (optional)

Point a tab at an OpenAPI file and Thally generates one page per operation, with request examples in several languages and a Try it button. Replace the starter's sample openapi.yaml, even if you don't want an API tab. The file is still served at /openapi.yaml, and every page advertises it in an HTTP Link header.

7. Publish

git add -A
git commit -m "Add funding guide content"
git push origin main

Thally builds the new commit and records it in the site's deployment history (Deployments in the Cloud dashboard). Check the live site in a private window once the deploy finishes. See obstacle 5 for why.

8. Make it agent-ready

Thally Cloud grades every site under Readiness: how useful the published pages are to AI agents. My first publish scored 89 (B). Four changes took it to 100 (A):

Check Fix
OpenAPI examples (0/3) Add example on the request body's media type and on each 2xx response. An example on a single property doesn't count. I used real responses, trimmed.
Verification freshness (n/a) Add lastVerified: 2026-12-04 to the frontmatter of every page you've tested against the product.
Golden-question retrieval (n/a) List questions your docs must answer in docs.json under readiness.goldenQuestions, each with the page that should answer it. The site's own search has to rank that page in the top 3.
Chunkable structure Keep every section under ~1,000 tokens. A long script or a <Steps> block counts as one section, so give it its own ## or ### heading.

Run the same scoring locally before you push:

npm run runtime-sources:build   # without this, the score reads stale content
npm run check:agents

Golden questions are worth the effort for their own sake. When I added a section to the introduction, "Does positive funding mean longs pay shorts?" dropped out of the top 3. Renaming the heading to say "units and who pays" fixed the score and made the page easier for humans to scan.

Write an AGENTS.md for the people using your product

The site serves the repository's root AGENTS.md at /AGENTS.md, and llms.txt points agents to it. The starter's version is written for agents editing the docs repo, and it talks about Thally's own internal repositories. An agent that wants to use the product you're documenting gets nothing from it.

Replace it. Mine leads with what an agent needs to get correct data on the first try:

  • the request body for each task, and the response shape;
  • the rules that prevent wrong answers (units, pagination, which rate to use);
  • checks the agent can run on its own result, and an error table;
  • links to raw, runnable scripts.

A short "Editing these docs" section goes at the end for agents working in the repo. AGENTS.md is marked user-owned in starter-release.json, so framework updates won't overwrite it.

9. Test it with an agent that hasn't seen your work

A quickstart is only "working" if someone who didn't write it can finish it. I gave a fresh AI agent the public URL and nothing else, with four tasks:

  1. run the quickstart;
  2. run the guide;
  3. a transfer task the docs don't spell out (45-day funding for three coins, compared against Binance);
  4. trigger the documented errors.

It passed all four, and every documented error matched the live API. It scored the site 8/10 for humans and 7/10 for agents, and it found four real gaps I had missed:

  • I wrote that Binance settles "every 8 hours". It's per coin, and most are on 4.
  • 21 Binance entries omit fundingIntervalHours.
  • The docs never said which of two "live" rates to use.
  • The Node-only script needed shims to run anywhere else.

Each one became a fix and a changelog entry. Run this test before you ship. It costs a few minutes and finds what self-review can't.

Obstacles I hit and how I fixed them

1. npm run build failed: "Failed to fetch Inter from Google Fonts." The starter loads fonts with next/font/google, which downloads them at build time. My build environment had no route to fonts.googleapis.com, so the build failed before compiling any pages. Thally Cloud builds on its own servers, so production was never affected. Locally you need network access to Google Fonts. In a locked-down CI, switch to next/font/local.

2. A YAML typo showed up as "OpenAPI source file not found." I wrote description: Missing Content-Type: application/json header. A second colon inside an unquoted YAML value is invalid. thally check reported it correctly, with line and column. npm run build reported the file as missing. Fix: quote the value. Lesson: run check before build; its errors are the ones to trust.

3. Generated API examples used 123 for fields without an example. The request sample for my history endpoint sent "endTime": 123, which returns no data. Copied as-is, the example looks broken. Fix: add an example: to every field in the spec, optional ones included.

4. One URL, several request types. Hyperliquid's Info API is a single POST /info where a type field in the body picks the operation. OpenAPI allows one operation per path and method. I used fragment paths (/info#fundingHistory, /info#predictedFundings) so each request type gets its own page. Clients drop the fragment, so the requests still hit /info. A discriminated oneOf body on a single path would be more correct, but readers would get one dense page.

5. During each deploy, the live site returned 403 to everyone. On both of my deploys, every page, homepage included, briefly showed "Documentation access required: ask your client administrator or the publisher to review your access" to signed-out visitors. Settings → Reader access still said Public, and that text isn't in the repo's code, so it comes from Thally's hosting layer. It lasted 6–10 minutes the first time and about 1.5 minutes the second, then cleared on its own while the new version went live. Fix: after a push, wait for the deploy to finish under Deployments, then open the site in a private window before you share the link.

6. /AGENTS.md served Thally's internal instructions to the public. See step 8. Fix: replace the root AGENTS.md with guidance for your product's users.

7. The source repository was private. Thally Cloud created the docs repo as private, but the site links to it, so every reader got a GitHub 404. Fix: Settings → Change visibility → Public on GitHub, or keep it private and remove the links.

Checklist before you share the link

  • thally check passes and npm run build passes.
  • Every command on the quickstart was run from a clean shell.
  • No starter pages, sample API, or placeholder text left.
  • Every page is in docs.json.
  • The live site loads each page, and the API reference has real examples.
  • The GitHub repo opens from a signed-out browser, if you link to it.
  • Readiness is an A, and /AGENTS.md describes your product, not the docs repo.
  • An agent that has never seen your work completed the quickstart.

That's the whole loop: create in Cloud, edit MDX, check, build, push, then test it with an agent that hasn't seen your work. The tool takes about twenty minutes. Testing and writing take the rest.

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.