AI-Powered API Documentation Generator Transforming raw codebases into professional, structured API documentation using Large Language Models.
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.
- 🤖 AI-Driven Generation: Automated endpoint description, parameter extraction, and response mapping via Groq LLMs.
- 🔍 AST Parsing: Utilizes
@babel/parserto 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.
| 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 |
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)
The model's performance is evaluated based on the following criteria:
| Metric | Description | Target |
|---|---|---|
| Extraction Accuracy | Percentage of correctly identified endpoints/params | |
| Hallucination Rate | Frequency of non-existent parameters being generated | |
| Inference Latency | Time from code upload to document generation | |
| Schema Validity | Percentage of generated YAMLs that pass Swagger validation |
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.
- Node.js 18.x or higher
- A Groq Cloud API Key
- Firebase Project credentials
-
Clone the repository
git clone https://github.com/dharunkumar-sh/api-muse.git cd api-muse -
Install dependencies
npm install
-
Environment Setup Create a
.env.localfile 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...
-
Run the development server
npm run dev
Visit
http://localhost:3000to view the application.
- Upload/Paste Code: Input your TypeScript/JavaScript controller or route files.
- Analysis: The system parses the code via Babel to extract function signatures and types.
- Generation: The AI analyzes the extracted metadata to write descriptions and examples.
- 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.(Placeholders for project visuals)
[Dashboard View][Code Analysis Screen][Exported PDF Sample]
Contributions are welcome! Please follow these steps:
- Fork the Project.
- Create your Feature Branch (
git checkout -b feature/AmazingFeature). - Commit your Changes (
git commit -m 'Add some AmazingFeature'). - Push to the Branch (
git push origin feature/AmazingFeature). - Open a Pull Request.
This project is currently unlicensed. Please contact the author for usage permissions.