Where to host a static docs site
How to host a static documentation site on GitHub Pages, Cloudflare, Netlify or S3, compared on previews, redirects, base paths and agent features.
You have a docs site that builds to a folder of HTML, and now you need somewhere to put it. Almost any host can serve static files, so the choice comes down to the details around them. Here is how we think about where to host a static documentation site, and what to check before you commit.
How to host a static documentation site: what to check
A marketing page can live anywhere. Docs are more demanding, because they change often, get linked from everywhere, and now get read by software as well as people. We look at five things:
- Setup effort: how many steps between a git push and a live page.
- Preview deploys: can a reviewer see a pull request's docs before it merges.
- Redirects: pages move, and old links should keep working.
- Custom domains and base paths:
docs.example.com, or a sub-path like/repo/. - Agent features: serving Markdown to an AI agent that asks for it.
DocsLit builds a plain static site with docslit build, and the output lands in ./dist. Upload that folder and you are done, on any provider. The rest of this post is about which provider makes the surrounding work easiest.
Comparing the common options
These are general characteristics, not a feature audit. Plans and limits change, so check each provider's current docs before deciding.
| Host | Setup | PR previews | Redirects | Base path |
|---|---|---|---|---|
| GitHub Pages | Low if your code is on GitHub (an Actions workflow) | Not built in | Limited, mostly client-side tricks | Project sites live under /repo/ |
| Cloudflare Pages | Low, connect a repo or upload | Yes, commonly per branch and PR | Redirects file or config | Usually the domain root |
| Netlify | Low, connect a repo or use the CLI | Yes, deploy previews | Redirects file or config | Usually the domain root |
| AWS S3 (with CloudFront) | Highest, you assemble the pieces | You build it yourself | Possible, through CloudFront or bucket rules | Whatever you configure |
GitHub Pages is the easiest if your docs sit in the same repo as your code. The catch is the base path. A project site is served from https://user.github.io/repo/, so every asset and link has to know about the /repo prefix. In DocsLit you set "basePath": "/repo" in docslit.json and the URLs stay correct. Pages also has no native pull request previews, which matters if you review docs changes the way you review code.
Cloudflare and Netlify are the ones we reach for when previews matter. Both can build a preview per pull request and put the link on the PR, and both serve from the domain root, so base paths rarely come up. S3 is the right call when your organization already runs on AWS and wants the files in a bucket you control. Expect to wire up HTTPS, caching, index documents and redirects yourself.
Let the CLI write the host config
Each host wants slightly different files. Rather than copying snippets from five blog posts, DocsLit writes them:
docslit deploy --github-pages
docslit deploy --netlify
docslit deploy --cloudflare
docslit deploy --vercel
These write the host-specific recipe for the provider you pick. The GitHub Pages one is a workflow at .github/workflows/docslit.yml. For Vercel it also writes a middleware.js so that agents sending Accept: text/markdown get the page's Markdown source. That is the agent-feature gap to watch: static files alone can't answer a content negotiation request, so each host needs a small piece of middleware, or you serve the .md files at known URLs and let agents ask for them directly.
If you need the opposite of hosting, docslit build --offline produces a self-contained folder that opens from file://. It suits air-gapped networks, USB distribution and archives. It skips the sitemap and SEO pages, so use the normal build for anything public. The details are in offline builds, and the host-by-host steps are in static hosting.
The managed option: DocsLit Cloud
If you would rather not own any of this, there is DocsLit Cloud. It is in early access, priced on request, and we set up each account by hand. You get an API token, put it in CI as DOCSLIT_TOKEN, and run docslit publish. It builds if needed, uploads, and prints the URL.
What you get is the part that is fiddly on a bare static host. Releases are atomic, so visitors see the old site or the new one and never a half-written deploy. You can roll back to an earlier deploy on plans that include it. Every site has a hosted MCP endpoint at /mcp and answers Accept: text/markdown with no middleware to maintain. For more on how agents use those, see how AI agents read your docs.
The limits are real. Custom domains are not available yet, so your docs live at a {slug}.sites.docslit.com address for now. If you need docs.yourcompany.com today, or password-protected docs, host the build yourself on one of the providers above. The CLI is Apache-2.0 and the same dist folder works everywhere, so choosing Cloud now doesn't lock you in.
To see what the build produces, run npx docslit init and then docslit build. The CLI is free and open source on GitHub, and pull requests that improve the deploy recipes are welcome.