Skip to content

dharunkumar-sh/api-muse

Repository files navigation

🏛️ API Muse

AI-Powered API Documentation Generator Transforming raw codebases into professional, structured API documentation using Large Language Models.

Next.js TypeScript Tailwind CSS Groq License


📖 Overview

API Muse is an intelligent documentation engine that leverages LLMs to parse source code and generate comprehensive API specifications. By analyzing AST (Abstract Syntax Tree) patterns and utilizing the Groq SDK for high-speed inference, API Muse automates the tedious process of writing documentation, ensuring your API docs stay in sync with your implementation.

The system converts raw TypeScript/JavaScript logic into structured formats including OpenAPI/Swagger specs, PDF, and DOCX exports.


✨ Features

  • 🤖 AI-Driven Generation: Automated endpoint description, parameter extraction, and response mapping via Groq LLMs.
  • 🔍 AST Parsing: Utilizes @babel/parser to analyze code structure without executing the source.
  • 📄 Multi-Format Export: Export documentation directly to .pdf, .docx, or .yaml (Swagger).
  • ⚡ High Performance: Optimized for speed using Next.js App Router and Groq's LPU inference.
  • 🎨 Modern UI: A clean, responsive interface built with Tailwind CSS and Framer Motion for smooth interactions.

🛠️ Tech Stack

Layer Technology Purpose
Framework Next.js 14 Full-stack React framework
Language TypeScript Type-safe development
LLM Engine Groq SDK Low-latency AI inference
Parsing Babel (@babel/parser) Static analysis of source code
Styling Tailwind CSS Utility-first styling
Exports jsPDF, docx Document generation
Database/Auth Firebase Backend services & user management

🧠 ML Implementation & Model Details

Model Configuration

API Muse utilizes the Groq SDK to interface with high-throughput LLMs. The system employs a "Chain-of-Thought" prompting strategy to ensure technical accuracy in API mapping.

  • Base Model: Llama-3 (via Groq)
  • Context Window: Optimized for code snippet analysis
  • Temperature: 0.2 (Low temperature to ensure deterministic and precise technical output)

📊 Evaluation Metrics

The model's performance is evaluated based on the following criteria:

Metric Description Target
Extraction Accuracy Percentage of correctly identified endpoints/params $> 95%$
Hallucination Rate Frequency of non-existent parameters being generated $< 2%$
Inference Latency Time from code upload to document generation $< 3s$
Schema Validity Percentage of generated YAMLs that pass Swagger validation $100%$

📂 Dataset & Training

While the application uses pre-trained LLMs, the prompt engineering was refined using a curated dataset of:

  • OpenAPI Specification v3.0 reference docs.
  • Synthetic Code-to-Doc pairs (TypeScript $\rightarrow$ Swagger YAML).
  • Public API benchmarks for structural validation.

🚀 Getting Started

Prerequisites

  • Node.js 18.x or higher
  • A Groq Cloud API Key
  • Firebase Project credentials

Installation

  1. Clone the repository

    git clone https://github.com/dharunkumar-sh/api-muse.git
    cd api-muse
  2. Install dependencies

    npm install
  3. Environment Setup Create a .env.local file in the root directory:

    GROQ_API_KEY=your_groq_api_key_here
    NEXT_PUBLIC_FIREBASE_API_KEY=your_firebase_key
    NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=your_project.firebaseapp.com
    # Add other Firebase config variables...
  4. Run the development server

    npm run dev

    Visit http://localhost:3000 to view the application.


💻 Usage

  1. Upload/Paste Code: Input your TypeScript/JavaScript controller or route files.
  2. Analysis: The system parses the code via Babel to extract function signatures and types.
  3. Generation: The AI analyzes the extracted metadata to write descriptions and examples.
  4. Export: Select your desired format (PDF, Word, or YAML) to download the final documentation.
// Example of the type of code API Muse parses:
export const getUser = async (req, res) => {
  const { id } = req.params;
  // ... logic
  return res.status(200).json({ user });
};
// Result: Generates GET /user/:id with 200 OK response schema.

🖼️ Screenshots

(Placeholders for project visuals)

  • [Dashboard View]
  • [Code Analysis Screen]
  • [Exported PDF Sample]

🤝 Contributing

Contributions are welcome! Please follow these steps:

  1. Fork the Project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your Changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

📜 License

This project is currently unlicensed. Please contact the author for usage permissions.

About

AI Powered API Document Generator Application

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors