DEV Community

Peakline Studio
Peakline Studio

Posted on

How I Built an AI That Generates README Files and API Docs from Any GitHub Repo

Every developer has been there: you've built something great, but writing the documentation feels like a second project. README files go stale, API references never get written, and onboarding new contributors is painful.

I built Code Documentation Generator to solve this — a single POST request that returns production-ready Markdown documentation for any public GitHub repo.

What it does

Send a GitHub repo URL, get back structured Markdown documentation. That's it.

Three output formats:

  • Full documentation — README + API reference + usage examples, all in one
  • README only — project overview, installation, usage, contributing guide
  • API reference — every function/class/method documented with parameters and return types

It uses Claude AI under the hood to actually understand your code, not just parse it. So the output reads like a human wrote it.

The API (one request)

curl -X POST https://code-docs-api.peakline-ops.workers.dev/v1/generate \
  -H "Content-Type: application/json" \
  -d '{
    "repo_url": "https://github.com/your-org/your-repo",
    "ref": "main"
  }'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "ok": true,
  "format": "full",
  "repo": "your-org/your-repo",
  "ref": "main",
  "documentation": "# Your Project\n\n..."
}
Enter fullscreen mode Exit fullscreen mode

That's the entire integration. Pipe the documentation field wherever you need it — your wiki, your CMS, a GitHub Action that commits docs on every push.

How it works under the hood

  1. Fetches the repo tree from GitHub's API
  2. Reads source files (filtering out node_modules, build artifacts, etc.)
  3. Sends code + structure to Claude Sonnet with a format-specific prompt
  4. Returns structured Markdown

Everything runs on Cloudflare Workers — globally distributed, sub-100ms cold starts, no servers to maintain.

Results are cached in D1 (Cloudflare's edge SQLite) for 24 hours, so repeated requests for the same repo/ref are instant.

Use cases I've seen

Keep docs in sync with code — run it in CI on every merge to main, commit the output to your repo. No more stale READMEs.

Onboard contributors faster — new devs can generate up-to-date docs for any unfamiliar module before diving in.

Document OSS dependencies — sometimes a library you depend on has terrible docs. Generate your own.

API documentation for internal tools — your company's internal utilities deserve docs too.

Available on RapidAPI

The API is now listed on RapidAPI: Code Documentation Generator

Free tier: 5 requests/month to try it out
Pro ($9/mo): for regular use
Ultra ($29/mo): for teams and CI pipelines

Direct link: https://rapidapi.com/peaklineops/api/code-documentation-generator

Or hit the endpoint directly — no account needed for the free tier (IP-based, 5 requests/month).

What's next

  • GitHub Action wrapper (document your repo on every push with zero config)
  • Support for private repos via GitHub token
  • Webhook trigger (push to a branch → docs auto-update)

Would love feedback from anyone who tries it. What formats are most useful? What's missing?


Built with Cloudflare Workers + D1 + Claude API. Stack is ~300 lines of TypeScript.

Top comments (0)