This site is not affiliated with or endorsed by Vercel, Inc. Read the docs, then deploy or run each experiment yourself.
AI

Codebase README Lab

Paste a file tree and snippets - draft README sections downloadable as markdown.

Run this experiment yourself

Demos are not embedded on this site. Deploy a standalone copy on Vercel or run the experiment app locally.

Local development

cd apps/experiments/codebase-readme-lab
pnpm install
pnpm dev

Then open http://localhost:3010.

This is an experimental demo. Use it as a starting point for your own projects.

Codebase README Lab drafts README sections from a pasted file tree and code snippets via generateObject. toMarkdown assembles a downloadable README.md. The prompt instructs the model not to invent APIs outside the paste. No AI keys - 503.

Features

  • Tree + snippets – two textareas with samples.
  • Sectioned draft – overview, features, getting started, structure, config, scripts.
  • Download markdown – client-side file download.
  • Honest unavailable state.

Server Reference

POST /api/readme

{ "tree": "...", "snippets": "..." }

At least one of tree or snippets is required.

Success (200)

{
  "title": "my-app",
  "overview": "…",
  "features": ["Health route"],
  "gettingStarted": "pnpm install && pnpm dev",
  "projectStructure": "…",
  "configuration": "DATABASE_URL optional",
  "scripts": ["pnpm dev"],
  "provider": "ai-gateway"
}
StatusCause
503No AI provider
400Both inputs empty

Implementation Details

clampReadme + toMarkdown live in logic.ts for testable assembly without the model.

Use Cases

  • Bootstrap READMEs for small apps.
  • Teach grounded doc generation.
  • Export markdown into repos.

Limitations

  • Will miss context not pasted.
  • No git history awareness.
  • No auth / rate limits.

Use in your project

Copy toMarkdown and the download helper; persist drafts to Blob if needed.

Deployment

Deploy on Vercel

Local Development

cd apps/experiments/codebase-readme-lab
pnpm install
pnpm dev

Configuration

VariableRequiredPurpose
AI_GATEWAY_API_KEYYes (or OPENAI_API_KEY)Preferred provider
OPENAI_API_KEYNoFallback
AI_MODELNoModel override

Vercel / Next.js Features Used

  • AI SDK generateObject
  • Vercel AI Gateway
  • Route Handlers
  • Zod

Next Steps

On this page