Skip to content

palash32/api-auto-doc

Repository files navigation

API Auto-Documentation Platform

AI-powered API documentation generator that automatically scans repositories, discovers endpoints, and creates beautiful, interactive documentation.

CI Status License PRs Welcome

πŸ—οΈ Architecture Overview

This platform follows a microservices architecture organized as a monorepo, enabling independent scaling, technology-specific optimizations, and improved maintainability.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              FRONTEND                                   β”‚
β”‚                         (Next.js 14 / React 18)                        β”‚
β”‚                          http://localhost:3000                          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                     β”‚
                                     β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                            API GATEWAY                                  β”‚
β”‚                    (Node.js / Express / TypeScript)                     β”‚
β”‚                          http://localhost:8000                          β”‚
β”‚         β€’ Authentication & JWT                                          β”‚
β”‚         β€’ Rate Limiting & Security                                      β”‚
β”‚         β€’ Request Routing                                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
             β”‚                                           β”‚
             β–Ό                                           β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      SCANNER SERVICE       β”‚              β”‚        AI SERVICE          β”‚
β”‚     (Go / Gin Framework)   β”‚              β”‚     (Python / FastAPI)     β”‚
β”‚    http://localhost:3001   β”‚              β”‚    http://localhost:3002   β”‚
β”‚                            β”‚              β”‚                            β”‚
β”‚  β€’ Git Repository Cloning  β”‚              β”‚  β€’ Gemini AI Integration   β”‚
β”‚  β€’ Identifier-First Scan   β”‚              β”‚  β€’ Doc Generation          β”‚
β”‚  β€’ Multi-Framework Support β”‚              β”‚  β€’ Endpoint Analysis       β”‚
β”‚  β€’ Pattern Detection       β”‚              β”‚                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Features

  • πŸ” Automatic API Discovery - Scans GitHub repositories to find API endpoints
  • ⚑ Identifier-First Scanning - Optimized two-stage scanning (5-20% files processed)
  • 🎯 Multi-Framework Support - Python, JavaScript, TypeScript, Go, Java, C#
  • πŸ€– AI-Powered Documentation - Uses Gemini AI to generate comprehensive docs
  • 🎨 Beautiful UI - Glass-morphism design with dark mode
  • πŸ” GitHub OAuth - Secure authentication with GitHub
  • πŸ“Š Health Monitoring - Track API health and uptime
  • πŸ§ͺ API Playground - Test endpoints directly in the browser
  • πŸ‘₯ Team Collaboration - Invite team members and manage access
  • πŸ’³ Billing & Plans - Stripe-ready subscription management

πŸ› οΈ Tech Stack

Microservices Architecture

Service Technology Port Description
Frontend Next.js 14, React 18, TypeScript, TailwindCSS 3000 User interface
Gateway Node.js, Express, TypeScript 8000 API Gateway, Auth, Routing
Scanner Go, Gin Framework 3001 Repository scanning, endpoint detection
AI Python, FastAPI, Gemini API 3002 AI documentation generation

Supporting Infrastructure

Component Technology
Database PostgreSQL 16
Cache Redis
Auth GitHub OAuth, JWT
Deployment Docker, Docker Compose, Vercel, Render

πŸ“ Project Structure

api-auto-doc/
β”œβ”€β”€ frontend/                    # Next.js 14 Frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/                # App router pages
β”‚   β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”‚   β”œβ”€β”€ lib/                # Utilities & API clients
β”‚   β”‚   └── hooks/              # Custom React hooks
β”‚   └── package.json
β”‚
β”œβ”€β”€ services/                    # Microservices
β”‚   β”œβ”€β”€ gateway/                # API Gateway (Node.js/Express)
β”‚   β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”‚   β”œβ”€β”€ routes/         # API route handlers
β”‚   β”‚   β”‚   └── middleware/     # Auth, rate limiting, logging
β”‚   β”‚   └── package.json
β”‚   β”‚
β”‚   β”œβ”€β”€ scanner/                # Scanner Service (Go)
β”‚   β”‚   β”œβ”€β”€ cmd/server/         # Entry point
β”‚   β”‚   β”œβ”€β”€ internal/
β”‚   β”‚   β”‚   β”œβ”€β”€ scanner/        # Core scanning logic
β”‚   β”‚   β”‚   └── handlers/       # HTTP handlers
β”‚   β”‚   └── go.mod
β”‚   β”‚
β”‚   └── ai/                     # AI Service (Python/FastAPI)
β”‚       β”œβ”€β”€ app/
β”‚       β”‚   β”œβ”€β”€ routes/         # API endpoints
β”‚       β”‚   └── services/       # Gemini AI integration
β”‚       └── requirements.txt
β”‚
β”œβ”€β”€ docs/                        # Documentation
β”‚   β”œβ”€β”€ architecture/           # Architecture docs
β”‚   └── api/                    # API reference
β”‚
β”œβ”€β”€ docker-compose.yml          # Local development orchestration
β”œβ”€β”€ .env.example                # Environment template
└── start.ps1                   # Windows quick start script

πŸš€ Quick Start

Prerequisites

  • Node.js >= 20.x
  • Go >= 1.21
  • Python >= 3.11
  • Docker & Docker Compose (optional)
  • GitHub OAuth App credentials
  • Google Gemini API key

Option 1: Start All Services Manually

# Clone repository
git clone https://github.com/palash32/api-auto-doc.git
cd api-auto-doc

# Copy environment file
cp .env.example .env
# Edit .env with your credentials (GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET, GEMINI_API_KEY)

# Terminal 1 - Scanner Service (Go)
cd services/scanner
go build -o scanner.exe ./cmd/server
./scanner.exe
# Running on http://localhost:3001

# Terminal 2 - Gateway Service (Node.js)
cd services/gateway
npm install
npm run dev
# Running on http://localhost:8000

# Terminal 3 - AI Service (Python) [Optional]
cd services/ai
pip install -r requirements.txt
uvicorn app.main:app --host 0.0.0.0 --port 3002
# Running on http://localhost:3002

# Terminal 4 - Frontend (Next.js)
cd frontend
npm install
npm run dev
# Running on http://localhost:3000

Option 2: Docker Compose

# Clone and start all services
git clone https://github.com/palash32/api-auto-doc.git
cd api-auto-doc

# Configure environment
cp .env.example .env
# Edit .env with your credentials

# Start all services
docker-compose up -d

# Access the platform
open http://localhost:3000

πŸ” Scanner Service - Identifier-First Strategy

The Go-based scanner implements an efficient two-stage scanning approach:

Stage 1: Pre-filtering (Fast)

  • Quickly scans files for API framework indicators
  • Filters out ~80-95% of non-API files
  • Supports patterns for multiple frameworks

Stage 2: Deep Extraction (Targeted)

  • Only processes files that passed Stage 1
  • Extracts endpoint details: method, path, line number
  • Multi-framework regex patterns

Supported Frameworks

Language Frameworks
Python FastAPI, Flask, Django
JavaScript/TypeScript Express, NestJS, Fastify
Go Gin, Echo, Fiber, net/http
Java Spring Boot (@GetMapping, @PostMapping)
C# ASP.NET ([HttpGet], [Route])

Performance

  • Typical scan: Only 5-20% of files processed
  • Real-time progress logging
  • Git repository cloning with authentication

πŸ§ͺ Testing

# Scanner Service Tests (Go)
cd services/scanner
go test -v ./internal/scanner/...

# Gateway Service Tests (Node.js)
cd services/gateway
npm test

# Frontend Tests (React)
cd frontend
npm test

πŸ” GitHub OAuth Setup

  1. Go to https://github.com/settings/developers
  2. Create a new OAuth App:
    • Homepage URL: http://localhost:3000
    • Callback URL: http://localhost:8000/api/auth/github/callback
  3. Copy Client ID and Client Secret to your .env file

See GITHUB_OAUTH_SETUP.md for detailed instructions.

🚒 Deployment

Production Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                    β”‚   Cloudflare    β”‚
                    β”‚   (CDN/SSL)     β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                             β”‚
              β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
              β”‚                             β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚      Vercel       β”‚      β”‚       Render         β”‚
    β”‚    (Frontend)     β”‚      β”‚     (Services)       β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                               β”‚   β”‚    Gateway    β”‚  β”‚
                               β”‚   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                               β”‚   β”‚    Scanner    β”‚  β”‚
                               β”‚   β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€  β”‚
                               β”‚   β”‚      AI       β”‚  β”‚
                               β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                         β”‚
                               β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                               β”‚   Neon/Supabase   β”‚
                               β”‚   (PostgreSQL)    β”‚
                               β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Deploy Commands

# Frontend to Vercel
cd frontend
vercel deploy --prod

# Services to Render
# Use render.yaml for Blueprint deployment

πŸ“š Documentation

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

πŸ“„ License

This project is licensed under the MIT License - see LICENSE file.

πŸ™‹ Support


Built with ❀️ - Microservices Architecture v2.0

About

AI-powered API documentation platform

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published