Host the static documentation on Cloudflare Workers static assets under a custom domain.
The site is deployed to Cloudflare Workers as static assets and served at https://ttspa.docs.isaackogan.com/. There is no Worker script: docs/wrangler.jsonc only declares the asset directory, the HTML handling and the custom domain. The site needs no Pages Functions, no Cloudflare Astro adapter and no TikTok credentials.
Configuration
Section titled “Configuration”{ "name": "tiktok-shop-partner-api-docs", "compatibility_date": "2026-10-20", "assets": { "directory": "./dist", "html_handling": "auto-trailing-slash", "not_found_handling": "404-page" }, "workers_dev": false, "routes": [ { "pattern": "ttspa.docs.isaackogan.com", "custom_domain": true } ]}html_handling: auto-trailing-slashmatches Astro’strailingSlash: 'always'. A request for/sdks/pythonredirects to/sdks/python/, which servessdks/python/index.html.not_found_handling: 404-pageserves Starlight’s generated404.htmlwith a 404 status.workers_dev: falsekeeps the site off theworkers.devhostname, so the custom domain is the only public origin.- The
routesentry withcustom_domain: truemakes Cloudflare create the DNS record and the certificate for the hostname on deploy. Theisaackogan.comzone must be in the same Cloudflare account as the Worker, and the hostname must not already have a DNS record.
DOCS_SITE overrides the canonical origin and defaults to the custom domain. DOCS_BASE sets a deployment subpath and defaults to /. Neither needs to be set for a production build.
The spec files under /openapi/ are copied from .openapi/ at build time, so each deploy serves the spec the site was built from.
Deploy from a checkout
Section titled “Deploy from a checkout”Wrangler is pinned in docs/package.json, so the install below provides it. Run pnpm --dir docs exec wrangler login once on a new machine.
pnpm --dir docs install --frozen-lockfilepnpm --dir docs buildpnpm --dir docs run deploy:cloudflareThe first deploy creates the Worker and attaches the custom domain. Later deploys upload only the files that changed.
Continuous deployment
Section titled “Continuous deployment”The documentation workflow, .github/workflows/docs.yml, does three things:
- it validates pull requests;
- it uploads the built site as a review artifact;
- on pushes to
main, it deploys withcloudflare/wrangler-action, when the repository has two Actions secrets.
| Secret | Value |
|---|---|
CLOUDFLARE_API_TOKEN | A token created from the Edit Cloudflare Workers template, scoped to the hosting account and the isaackogan.com zone |
CLOUDFLARE_ACCOUNT_ID | The hosting account’s ID, shown by wrangler whoami |
Without the secrets, the deploy step is skipped and the workflow still validates the build. Forks and pull requests are unaffected.
The spec is regenerated daily. A push that changes .openapi/ therefore redeploys the site with the new spec and API reference.
Verify a deployment
Section titled “Verify a deployment”curl -I https://ttspa.docs.isaackogan.com/sdks/python/curl -I https://ttspa.docs.isaackogan.com/sdks/pythoncurl -I https://ttspa.docs.isaackogan.com/missing/curl -I https://ttspa.docs.isaackogan.com/openapi/tiktok-shop.openapi.yamlExpect a 200, a 307 redirect to the trailing-slash form, a 404 and a 200, in that order. Then:
- open the site and check the SDK sections and the API reference;
- search for “shop cipher”;
- check that the canonical link in the page head uses the custom domain.