ai-doc-generator
v1.0.1
Published
Generate backend project documentation from source code using Gemini.
Maintainers
Readme
AI Doc Generator
Generate backend project documentation from source code using Gemini.
This CLI scans a Node.js/TypeScript project, detects routes/tables, sends context to Gemini, and writes docs into a docs/ folder.
What It Generates
docs/api-testing-guide.mddocs/database-schema.mddocs/project-overview.md
Features
- Scans
*.jsand*.tsfiles - Ignores common heavy folders (
node_modules,.git,dist,build,coverage) - Detects Express-style routes
- Detects database table hints
- Uses Gemini to generate markdown docs
Requirements
- Node.js 18+ (recommended)
- A Gemini API key
Install
npm i -g ai-doc-generatorUser Flow
- Open terminal in your backend project.
- Run:
docgen .- On first run (if no saved config and no
GEMINI_API_KEYis set), the CLI asks for:- Gemini API key
- Gemini model (default:
gemini-2.5-flash)
- After successful run, credentials are saved to your user profile and reused automatically.
- If
GEMINI_API_KEYis set in environment variables, that value is used and also cached for future runs. - Generated docs are written to:
docs/api-testing-guide.mddocs/database-schema.mddocs/project-overview.md
Run against another folder:
docgen "D:\path\to\your-project"How It Works
- Scan project files
- Extract routes (
get,post,put,patch,delete) - Extract table hints
- Send code + analysis context to Gemini
- Save output markdown files in
docs/
Troubleshooting
models/... not found- Use a current model (prompt or env var), for example:
GEMINI_MODEL=gemini-2.5-flash
- Very slow on large projects
- Exclude generated folders and large artifacts
- Run against a smaller subfolder first
- No files found
- Ensure you are pointing to the correct target path
Development
Run directly during development:
node bin/docgen.js .Main files:
bin/docgen.js- CLI entrysrc/index.js- workflow orchestrationsrc/scanner/scanFiles.js- file discoverysrc/ai/generateDocs.js- Gemini generationsrc/writer/saveDoc.js- writes markdown files
