A web-based management interface for running and managing multiple Mockoon CLI instances.
- 📝 Upload and manage multiple Mockoon configuration files
- 🔄 Start/stop multiple mock API instances
- 🔍 Monitor running instances with health checks
- 🎯 Dynamic port allocation
- 💫 Real-time status updates
- 🔗 Easy access to mock API endpoints
You can easily create and manage your mock APIs using this tool:
-
Create Mock APIs:
- Download and install Mockoon Desktop application
- Design your API endpoints using the intuitive GUI
- Export your configuration as JSON file
- Upload the JSON through Mockoon Manager web interface
-
Access Your Mocks:
- Once uploaded and started, your mock APIs are accessible via
http(s)://your-domain/:port/your-endpoint
- Perfect for sharing mock APIs with your team or accessing them from anywhere
- Useful for development, testing, and demonstrations
- Once uploaded and started, your mock APIs are accessible via
-
Best Practices:
- Give your configuration files descriptive names
- Include version numbers in your config filenames (e.g.,
user-api-v1.json
) - Test your configurations locally in Mockoon Desktop before uploading
- Use the automatic health check endpoint to monitor instance status
- Node.js (v16 or higher)
- PM2 (installed globally)
- Mockoon CLI (installed globally)
- Nginx (for production deployment)
# Install global dependencies
npm install -g pm2 @mockoon/cli
- Clone the repository:
git clone https://github.com/yourusername/mockoon-manager.git
cd mockoon-manager
- Install dependencies for both frontend and backend:
# Install backend dependencies
cd backend
npm install
# Install frontend dependencies
cd ../frontend
npm install
- Configure environment variables:
# Backend (.env)
PORT=3500
UPLOAD_DIR=uploads
CONFIGS_DIR=configs
# Frontend (.env)
VITE_API_URL=/api
- Start the development servers:
# Start backend
cd backend
npm start
# Start frontend (in a new terminal)
cd frontend
npm run dev
- Create necessary directories:
# In backend directory
mkdir -p configs uploads logs
- Configure Nginx:
- Copy the provided
nginx.conf
to your Nginx configuration directory - Update the server_name and SSL certificate paths
- Adjust the proxy_pass IP addresses as needed
- Process Management:
Both frontend and backend use PM2 for process management. The configuration is in their respective
process.json
files:
Backend process.json:
{
"apps": [{
"name": "be-mockoon-manager",
"script": "server.js",
"watch": false,
"env": {
"NODE_ENV": "production"
}
}]
}
Frontend process.json:
{
"apps": [{
"name": "fe-mockoon-manager",
"script": "serve -s dist",
"watch": false,
"env": {
"NODE_ENV": "production"
}
}]
}
- Use the provided
restart.sh
script to manage the application:
chmod +x restart.sh
./restart.sh
The restart script will:
- Safely stop existing Mockoon Manager processes
- Install dependencies
- Build the frontend
- Start both frontend and backend using their PM2 configurations
- Save the PM2 process list for persistence
mockoon-manager/
├── assets/
│ ├── nginx.conf
│ └── preview.png
├── backend/
│ ├── configs/ # Mockoon configuration files
│ ├── uploads/ # Temporary upload directory
│ ├── logs/ # Instance logs
│ └── server.js
├── frontend/
│ ├── src/
│ └── public/
├── restart.sh
└── README.md
- All mock instances run on ports between 9001-9999
- Upload size is limited to 5MB
- Only JSON configuration files are accepted
- Ensure proper file permissions:
chmod 755 backend/configs
chmod 755 backend/uploads
chmod 755 backend/logs
GET /api/health
- Health check endpointGET /api/mock/status
- Get status of all running instancesGET /api/mock/configs
- List available configurationsPOST /api/mock/upload
- Upload new configurationPOST /api/mock/start
- Start a mock instancePOST /api/mock/stop
- Stop a mock instanceDELETE /api/mock/configs/:filename
- Delete configurationGET /api/mock/configs/:filename/download
- Download configuration
GET /:port/healthz
- Health check for specific instanceGET /:port/*
- Access mock API endpoints
- Frontend:
- React 18
- Vite
- TailwindCSS
- Axios
- React Hot Toast
- Lucide React (icons)
- Headless UI
- Backend:
- Node.js
- Express
- Multer (file uploads)
- PM2 (process management)
- Mock Server:
- Mockoon CLI
- Reverse Proxy:
- Nginx
- Each mock instance automatically includes a
/healthz
endpoint - Configuration files are stored in the
backend/configs
directory - Logs are available in the
backend/logs
directory - The application uses polling for status updates (5-second interval)
- Default ports:
- Frontend: 3000 (production)
- Backend: 3500
- Mock instances: 9001-9999
- Ensure your system has sufficient ports available in the 9001-9999 range
- Monitor the logs directory for individual instance logs
- Nginx configuration is crucial for proper routing
- Port Conflicts:
# Check if ports are in use
netstat -tln | grep '3000\|3500\|900'
- Permission Issues:
# Ensure proper ownership
sudo chown -R $USER:$USER backend/configs backend/uploads backend/logs
- PM2 Issues:
# View PM2 logs
pm2 logs
# List PM2 processes
pm2 list
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- 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 licensed under the MIT License with additional disclaimers - see the LICENSE file for details.