Skip to content

Latest commit

Β 

History

History
170 lines (117 loc) Β· 2.55 KB

File metadata and controls

170 lines (117 loc) Β· 2.55 KB

AgetAPI

πŸš€ Repo API Extractor:

An intelligent backend system that scans any GitHub repository and automatically extracts API endpoints along with their request/response schemas.


πŸ”₯ Features

  • πŸ” Automatic API Detection

    • Scans repository files to find REST endpoints
  • 🧠 AI-powered Schema Extraction

    • Uses LLM to infer request/response schemas from code
  • ⚑ Concurrent Processing

    • Multi-threaded schema generation for performance
  • 🧹 Duplicate Removal

    • Ensures unique API endpoints
  • πŸ“‚ Multi-language Ready (Extensible)

    • Designed to support Java, Node.js, Go, etc.

πŸ—οΈ Architecture

GitHub Repo
   ↓
Clone Service
   ↓
File Scanner
   ↓
Endpoint Extractor
   ↓
Code Snippet Extractor
   ↓
LLM (Schema Generator)
   ↓
Structured Output

πŸ› οΈ Tech Stack

  • Java (Spring Boot)
  • LangChain4j / LLM Integration
  • Multithreading (ExecutorService)
  • File System Scanning
  • REST API Parsing

πŸ“¦ Project Structure

service/
 β”œβ”€β”€ ExtractionService.java
 β”œβ”€β”€ SchemaGeneratorService.java
 β”œβ”€β”€ CodeSnippetExtractorService.java
 β”œβ”€β”€ EndpointExtractorService.java
 β”œβ”€β”€ RepoScannerService.java
 └── GitService.java

agent/
 β”œβ”€β”€ RepoAgent.java
 └── RepoTools.java

model/
 β”œβ”€β”€ ApiEndpoint.java
 └── RepositoryStructure.java

πŸš€ How It Works

  1. Provide a GitHub repository URL
  2. System clones the repo
  3. Scans files to detect API endpoints
  4. Extracts relevant code snippets
  5. Uses AI to generate schema
  6. Returns structured API data

πŸ“Œ Example Output

{
  "method": "POST",
  "path": "/jobPost",
  "requestSchema": { ... },
  "responseSchema": { ... }
}

⚠️ Limitations

  • Schema accuracy depends on code clarity
  • Dynamic languages (Node.js) may require heuristics
  • LLM output may need post-processing

▢️ How to Run the Project

1️⃣ Clone the Repository

git clone https://github.com/your-username/repo-name.git
cd repo-name

2️⃣ Build the Project

If using Maven:

mvn clean install

3️⃣ Run the Application

mvn spring-boot:run

OR run directly from your IDE (IntelliJ / Eclipse)


4️⃣ Server Starts At

http://localhost:8080

πŸ“¬ API Testing using Postman

πŸ”Ή Endpoint

POST http://localhost:8080/extract

πŸ”Ή Request Body (JSON)

{
  "repoUrl": "https://github.com/your-username/sample-repo"
}