--- title: AI REST API Generator emoji: πŸ€– colorFrom: blue colorTo: purple sdk: docker app_port: 7860 pinned: false license: mit --- # πŸ€– AI REST API Generator **AI REST API Generator** is a developer-focused tool that automatically generates **Django REST Framework backends** using AI or manual configuration. It converts high-level requirements into a fully structured, runnable Django project with CRUD APIs, serializers, views, URLs, and settings. 🚧 **Status:** Under active development πŸ“§ **Contact:** [harshadhole04@gmail.com](mailto:harshadhole04@gmail.com) --- ## ✨ Features * ⚑ **AI-Powered Backend Generation** * Generate Django REST APIs from natural language prompts * Automatically infers models, fields, and relationships * 🧱 **Manual Model Builder** * Define models, fields, relationships (One-to-One, One-to-Many) * Full control without AI if preferred * 🧩 **Schema-Driven Architecture** * JSON Schema validation before code generation * Auto-fixes common schema issues safely * πŸ“¦ **Complete Django Project Output** * Models, serializers, views, URLs * JWT authentication support * Database configuration (SQLite / PostgreSQL) * Static & media configuration * πŸ“₯ **One-Click Download** * Generated backend is zipped and ready to run * 🧠 **Pluggable LLM Support** * OpenAI * Groq * Easy to extend for other providers --- ## πŸ—οΈ Architecture Overview ``` Streamlit UI ↓ Pipeline Orchestrator ↓ LLM (Model Prompt / Spec Generation) ↓ Schema Validation (JSON Schema) ↓ Django Code Generator ↓ Ready-to-run Django REST Project ``` --- ## πŸš€ How It Works 1. **Input** * Project name & description * Choose AI-generated models or manual models * Select database and authentication * Provide LLM provider and API key 2. **Validation** * Generated spec is validated against a strict JSON schema * Automatic normalization and safe fixes applied 3. **Generation** * Django project is created in an isolated run directory * Apps, models, serializers, views, URLs, settings generated 4. **Output** * Project is zipped * Download instantly from the UI --- ## πŸ–₯️ Running Locally ### 1️⃣ Clone the Repository ```bash git clone https://github.com/harshadSH/ai-rest-api-generator.git cd ai-rest-api-generator ``` ### 2️⃣ Create Virtual Environment ```bash python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate ``` ### 3️⃣ Install Dependencies ```bash pip install -r requirements.txt ``` ### 4️⃣ Run the Streamlit App ```bash streamlit run app.py ``` --- ## πŸ“‚ Generated Project Structure ``` project_name/ β”œβ”€β”€ manage.py β”œβ”€β”€ project_name/ β”‚ β”œβ”€β”€ settings.py β”‚ β”œβ”€β”€ urls.py β”‚ └── wsgi.py β”œβ”€β”€ core/ β”‚ β”œβ”€β”€ models.py β”‚ β”œβ”€β”€ serializers.py β”‚ β”œβ”€β”€ views.py β”‚ β”œβ”€β”€ urls.py β”‚ └── admin.py β”œβ”€β”€ requirements.txt └── README.md ``` --- ## πŸ›‘οΈ Authentication * Supports **JWT Authentication** * All CRUD endpoints can be protected * Easily extendable to session-based auth --- ## πŸ§ͺ Validation & Reliability * Strict JSON Schema enforcement * Deterministic naming conventions * Auto-correction of: * Database engine names * Model and field naming * Missing required fields * Prevents invalid or unsafe Django code generation --- ## 🌍 Deployment This project is suitable for: * Local development * Docker-based deployment * Cloud hosting (AWS, Azure, GCP, Railway, Render) ⚠️ Note: Production hardening (rate limiting, monitoring, secrets management) should be added as per deployment needs. --- ## πŸ“œ License This project is licensed under the **MIT License**. You are free to use, modify, and distribute it with attribution. --- ## πŸ‘¨β€πŸ’» Author **Harshad Hole** Bachelor of Engineering – Artificial Intelligence & Data Science πŸ“§ Email: **[harshadhole04@gmail.com](mailto:harshadhole04@gmail.com)** --- ## ⭐ Why This Project Matters * Solves repetitive backend boilerplate * Demonstrates real-world use of LLMs in software engineering * Combines AI + validation + deterministic code generation * Strong portfolio-grade project for AI / Backend / Full-Stack roles --- If you want, I can also: * Write a **β€œProject Motivation”** section * Optimize README for **Hugging Face Spaces** * Add badges (Python, Django, MIT, AI) * Review it from a recruiter’s perspective Just tell me πŸ‘