Skip to content

JOwen-ster/docs-generator

Repository files navigation

📝 DocsGenerator

Instantly generate comprehensive, context-aware documentation and architectural rundowns for any GitHub repository using AI.

DocsGenerator simplifies the process of understanding complex codebases by leveraging Google Gemini to provide technical summaries of files and directories directly within your browser.


✨ Key Features

  • 🔐 Secure Authentication: Sign in with GitHub to access your public and private repositories.
  • 🌳 Recursive File Tree: Explore repositories with a native-feeling tree view.
  • 🤖 AI-Powered Rundowns: Generate 2-3 sentence summaries and key technical bullets for any file or directory.
  • ⚡ High Performance: Built with Next.js 15/16 and the React Compiler for a snappy user experience.
  • 🌗 Theme Support: Fully functional light and dark modes.

🖼️ Preview

🌗 Dark & Light Mode

Home Dark Mode


Home Light Mode


🛠️ Workflow & Features

Login Page


Repo Selection


File Tree Selection


💻 Generation

Generation Options


AI Generated Rundown


App Flow

App Flow Diagram

🚀 Getting Started

1. Obtain API Keys

You will need the following credentials to run the application:

Key Description Source
GEMINI_API_KEY Google AI Studio Key Google AI Studio
AUTH_GITHUB_ID GitHub OAuth Client ID GitHub Developer Settings
AUTH_GITHUB_SECRET GitHub OAuth Client Secret GitHub Developer Settings
AUTH_SECRET NextAuth Encryption Secret Run pnpm dlx auth secret

Note: When creating your GitHub OAuth App, set the Authorization callback URL to http://localhost:3000/api/auth/callback/github.

2. Configure Environment

Create a .env.local file in the root directory and add your keys:

GEMINI_API_KEY=your_gemini_key
AUTH_GITHUB_ID=your_github_id
AUTH_GITHUB_SECRET=your_github_secret
AUTH_SECRET=your_auth_secret

3. Install & Run

Install project dependencies.

pnpm i

Start the development server

pnpm run dev

Open http://localhost:3000 to see the result.


📂 Directory Structure

Path Description
app/ The main application logic using Next.js App Router.
app/api/ Serverless functions for Auth, GitHub API proxying, and Gemini generation.
app/components/ React components (AppShell, FileTree, FileRundown, etc.).
app/lib/github/ Core utilities for fetching repository trees and blob contents.
auth.ts NextAuth configuration and GitHub provider setup.
public/ Static assets like icons and images.
biome.json Configuration for the Biome linter and formatter.

🛠️ Major Components & API Flow

Component / Path Type Description & UI Flow
AppShell Component The central state hub. It coordinates selecting a repo via RepoSelector, rendering the FileTree, and triggering documentation generation.
FileTree Component A recursive tree UI that allows users to select files and folders. It calculates selection states (checked/indeterminate) and manages bulk selections.
RepoSelector Component Initial entry point that fetches user repositories from /api/repos and allows the user to pick a target project.
FileRundown Component The output display. It shows the AI's summary and technical highlights once the generation process completes.
/api/generate-docs API Route The AI bridge. It takes selected file contents, constructs a context-aware prompt, and sends it to Gemini for JSON-structured rundowns.
/api/tree & /api/blob API Routes Proxy routes that securely fetch the repository structure and raw file contents from GitHub using the user's session token.
tree-fetch.ts Helper Handles recursive tree fetching. It includes logic to handle "truncated" responses from GitHub for large repositories by fetching sub-trees.
url-fetch.ts Helper A resilient fetch wrapper that handles GitHub API versioning, authentication, and automatic retries on rate limits (exponential backoff).

🛠️ Development

  • Linting: pnpm run lint (uses Biome)
  • Formatting: pnpm run format
  • Build: pnpm run build
  • Start a Build: pnpm run start

About

Generate documentation and rundowns using AI

Resources

Stars

Watchers

Forks

Contributors