Skip to content
/ MockGen Public

Instantly generate mock REST APIs powered by LLMs (GPT/Gemini). Just describe your endpoint—MockGen does the rest. Docker-ready, fast, and open source.

Notifications You must be signed in to change notification settings

Mo-Ko/MockGen

Repository files navigation

MockGen Logo

MockGen: AI-Powered REST & GraphQL Mock API Generator

Describe an API in plain English, and get a live, stateful, and mockable REST or GraphQL server in seconds.
Powered by FastAPI, Vue.js, Docker, and your choice of OpenAI's GPT or Google's Gemini.

MIT License GitHub Issues Last Commit GitHub Stars


🚀 What is MockGen?

MockGen is an open-source tool that uses Large Language Models (LLMs) to generate fully functional mock APIs from a simple text description. It instantly creates schemas and deploys live endpoints for both REST (OpenAPI) and GraphQL. The vision is to create truly intelligent, stateful mock servers for developers who need to simulate a backend that doesn't exist yet.


✨ Core Features

  • AI-Powered Schema Generation: Instantly create OpenAPI (REST) and SDL (GraphQL) schemas using GPT or Gemini.
  • Dynamic Mock Endpoints: The generated endpoints are live and interactive from the moment they are created.
  • Service-Oriented Architecture: A clean backend design separates concerns into services, routers, and configuration for maximum maintainability.
  • Modern Frontend Stack: The Vue.js frontend is professionally structured with a dedicated API service layer and Pinia for state management.
  • Unified FastAPI Backend: A high-performance Python backend serves both the API mocks and the frontend application on a single port.
  • Dockerized: A multi-stage Dockerfile provides a simple setup for the entire stack.
  • CI/CD Ready: Includes a GitHub Actions workflow for linting, testing, and building.

🏁 Getting Started

Local Development (Recommended Method)

For the best experience and to access dynamically generated APIs, it is recommended to run the frontend and backend services separately.

1. Start the Backend (FastAPI):

# Navigate to the backend directory
cd backend

# Create and activate a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: `venv\Scripts\activate`

# Install dependencies with Poetry
pip install poetry
poetry install

# Configure your environment (add AI API keys)
cp .env.example .env
nano backend/.env

# Run the development server
uvicorn mockapi.main:app --reload

The backend will be available at http://localhost:8000.

2. Start the Frontend (Vue.js):

# In a new terminal, navigate to the frontend directory
cd frontend

# Install dependencies and run the server
npm install
npm run dev

Access the MockGen UI at http://localhost:5173.

Docker Compose

Note: Docker Compose now loads environment variables from backend/.env and sets APP_ROOT=/app inside the container. Healthchecks use curl.

# This will build and run the services. Dynamic endpoint support is being improved.
docker-compose up --build

📚 In-Depth Documentation

  • Architecture.md: A deep dive into the project's structure and data flow.
  • Configuration.md: How to configure the application using environment variables and Pydantic settings.
  • LLM-Integration.md: Details on the AI prompting strategy and future plans with LangChain.

📝 License

This project is licensed under the MIT License. See the LICENSE file for details.


🤝 Contributing & Issues

Contributions, issues, and feature requests are welcome! Please check the issues page for ongoing work.


🙏 Author

Created by Mohsin Kokab

About

Instantly generate mock REST APIs powered by LLMs (GPT/Gemini). Just describe your endpoint—MockGen does the rest. Docker-ready, fast, and open source.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published