Skip to content

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🔌 Enterprise API Virtualization Platform

A powerful API virtualization platform for frontend development — create dynamic mock endpoints with configurable responses instantly.

React TypeScript Node.js Express License: MIT


📋 Overview

The Enterprise API Virtualization Platform eliminates frontend-backend coupling during development by providing a sophisticated mock API server with a visual management UI. Teams can define endpoints, configure dynamic responses with templating, add latency simulation, and share API contracts — all without touching backend code.


✨ Features

  • Dynamic Endpoint Generation — Create REST endpoints on the fly with a visual editor
  • 🎛️ Configurable Mock Responses — Define JSON responses with Faker.js templating for realistic data
  • 🔄 Response Scenarios — Configure multiple response scenarios per endpoint (success, error, empty states)
  • ⏱️ Latency Simulation — Simulate slow networks to test loading states and timeouts
  • 📄 OpenAPI / Swagger Import — Auto-generate mocks from existing API specifications
  • 🔁 Request Logging & Replay — View all intercepted requests with full headers and body
  • 🗂️ Collections & Environments — Organize APIs into projects with environment variable support
  • 📤 Export & Share — Export mock API definitions as portable JSON configs
  • 🔗 Proxy Mode — Forward unmatched routes to real APIs for hybrid development

🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│              React Management UI (Frontend)                 │
│  - API Builder  - Response Editor  - Request Monitor        │
└────────────────────────┬────────────────────────────────────┘
                         │ REST
┌────────────────────────▼────────────────────────────────────┐
│               Express.js Control API                        │
│     - Endpoint Registry  - Config Manager  - Auth           │
└────────────────────────┬────────────────────────────────────┘
                         │
┌────────────────────────▼────────────────────────────────────┐
│               Express.js Mock Server                        │
│  - Dynamic Router  - Template Engine  - Proxy Middleware    │
└─────────────────────────────────────────────────────────────┘

🛠️ Tech Stack

Layer Technology
Frontend React 18, TypeScript, Monaco Editor
Backend Node.js, Express.js
Templating Faker.js, Handlebars
Storage SQLite / JSON files
API Specs OpenAPI 3.0, Swagger 2.0
Testing Jest, Supertest

🚀 Getting Started

Prerequisites

  • Node.js >= 20.x
  • npm >= 9.x

Installation

# Clone the repository
git clone https://github.com/<your-username>/enterprise-api-virtualization-platform.git
cd enterprise-api-virtualization-platform

# Install all dependencies
npm install

# Install server dependencies
cd server && npm install

Environment Configuration

Create .env in the root:

REACT_APP_CONTROL_API_URL=http://localhost:4000
REACT_APP_MOCK_SERVER_URL=http://localhost:4001

Create server/.env:

CONTROL_PORT=4000
MOCK_PORT=4001
STORAGE_PATH=./data/endpoints.json

Running Locally

# Start the React UI
npm start

# Start the mock server (in a new terminal)
cd server && npm run dev

📁 Project Structure

enterprise-api-virtualization-platform/
├── public/
├── src/
│   ├── components/
│   │   ├── EndpointBuilder/    # Visual API endpoint editor
│   │   ├── ResponseEditor/     # JSON response + template editor
│   │   ├── RequestMonitor/     # Live request log viewer
│   │   └── common/             # Shared UI components
│   ├── services/
│   │   ├── apiService.ts       # Control API client
│   │   └── importService.ts    # OpenAPI import utilities
│   ├── store/                  # State management
│   ├── types/                  # TypeScript definitions
│   └── utils/
│       └── templateHelpers.ts  # Response templating helpers
├── server/
│   ├── controllers/            # Endpoint CRUD handlers
│   ├── middleware/             # Request interceptors
│   ├── mockEngine/
│   │   ├── router.js           # Dynamic route registration
│   │   ├── templateEngine.js   # Faker.js template processor
│   │   └── proxyHandler.js     # Upstream proxy logic
│   ├── storage/                # Persistence layer
│   └── index.js
└── README.md

🔧 Usage Example

Define a Mock Endpoint

{
  "method": "GET",
  "path": "/api/users/:id",
  "status": 200,
  "delay": 200,
  "response": {
    "id": "{{params.id}}",
    "name": "{{faker.person.fullName}}",
    "email": "{{faker.internet.email}}",
    "createdAt": "{{faker.date.past}}"
  }
}

The Mock Server Responds

{
  "id": "42",
  "name": "Alexandra Müller",
  "email": "a.muller@example.com",
  "createdAt": "2024-08-14T09:23:11.000Z"
}

🔐 Security

  • Optional JWT-based authentication for the control API
  • Endpoint configurations stored locally — no external data sharing
  • CORS policies configurable per endpoint

🧪 Testing

# Run unit tests
npm test

# Run integration tests
npm run test:integration

📄 License

This project is licensed under the MIT License.


👤 Author

MugunthGitHub


⭐ If this project accelerates your development workflow, give it a star!

About

API virtualization platform with dynamic endpoints and configurable mock responses for frontend development. Built with React, TypeScript, Node.js, and Express.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages