Use Cases — Prototype, Test Integrations & Validate Ideas
Combine Mock APIs, Edge Functions, and Webhooks to prototype, test integrations, and validate ideas — without writing a single line of backend code.
// Jump to use case
// How to Import Any OpenAPI/Swagger YAML
https://petstore3.swagger.io/api/v3/openapi.json) or upload a .yaml / .json file# Works with any public OpenAPI 3.x or Swagger 2.0 URL:
https://petstore3.swagger.io/api/v3/openapi.json
https://api.example.com/v1/openapi.yaml
https://raw.githubusercontent.com/OAI/OpenAPI-Specification/main/examples/v3.0/petstore.yaml
# Or upload a local .yaml / .yml / .json file from your machineStripe Checkout Flow
Mock Stripe's payment API to test your frontend checkout without real charges. Create a webhook to simulate Stripe's checkout.session.completed callback hitting your server.
Step-by-Step
products, prices, checkout_sessionshttps://yourapp.com/api/stripe/webhookopenapi: "3.0.0"
info:
title: Stripe Mock
version: "1.0"
paths:
/products:
get: { summary: List products }
post: { summary: Create product }
/products/{id}:
get: { summary: Get product }
/prices:
get: { summary: List prices }
/prices/{id}:
get: { summary: Get price }
/checkout/sessions:
post: { summary: Create checkout session }
get: { summary: List sessions }
/checkout/sessions/{id}:
get: { summary: Get session }
components:
schemas:
Product:
properties:
name: { type: string }
description: { type: string }
active: { type: boolean }
price: { type: number }
Price:
properties:
unit_amount: { type: integer }
currency: { type: string }
product_id: { type: string }
CheckoutSession:
properties:
payment_status: { type: string }
customer_email: { type: string }
amount_total: { type: integer }
currency: { type: string }
status: { type: string }{
"type": "checkout.session.completed",
"data": {
"object": {
"id": "cs_test_a1b2c3",
"payment_status": "paid",
"customer_email": "alice@example.com",
"amount_total": 4999,
"currency": "usd",
"metadata": { "order_id": "ord_123" }
}
}
}# Your frontend points here instead of api.stripe.com:
curl https://moqapi.dev/api/invoke/{projectId}/products-api/products
curl https://moqapi.dev/api/invoke/{projectId}/products-api/checkout/sessions
# The webhook delivers the exact same JSON Stripe would sendGitHub PR Notification Bot
Simulate GitHub's webhook payload for pull request events. Test your notification pipeline end-to-end: GitHub webhook → your function → formatted output (or forward to Slack).
Step-by-Step
github-pr-handler.js code belowPOST /github/webhook → select your functionhttps://moqapi.dev/api/invoke/{projectId}/fn/github-pr-handler// Processes GitHub PR webhook events
// Bind to: POST /github/webhook in API Gateway
export const handler = async (event) => {
const payload = event.body;
const action = payload.action; // opened, closed, merged
const pr = payload.pull_request;
const slackMsg = {
text: `PR ${action}: ${pr.title} by ${pr.user.login}`,
blocks: [{
type: "section",
text: {
type: "mrkdwn",
text: `*<${pr.html_url}|${pr.title}>*\n` +
`${pr.user.login} · ${pr.base.ref} ← ${pr.head.ref}\n` +
`+${pr.additions} -${pr.deletions} (${pr.changed_files} files)`
}
}]
};
return { statusCode: 200, body: { processed: action, slack_payload: slackMsg } };
};{
"action": "opened",
"pull_request": {
"title": "Add payment processing module",
"html_url": "https://github.com/acme/app/pull/42",
"user": { "login": "alice" },
"base": { "ref": "main" },
"head": { "ref": "feature/payments" },
"additions": 340,
"deletions": 12,
"changed_files": 8
}
}E-Commerce Backend POC
Full e-commerce API in 2 minutes. Import the spec, generate data, and your React / Vue / mobile app has a working backend with users, products, orders, and nested order items — with relationships auto-wired.
Step-by-Step
users, products, orders, items. Relationships auto-detected from nested paths./orders/1/items, embedding: /orders/1?_embed=itemsopenapi: "3.0.0"
info:
title: E-Commerce API
version: "1.0"
paths:
/users:
get: { summary: List users }
post: { summary: Create user }
/users/{id}:
get: { summary: Get user }
delete: { summary: Delete user }
/products:
get: { summary: List products }
post: { summary: Create product }
/products/{id}:
get: { summary: Get product }
/orders:
get: { summary: List orders }
post: { summary: Create order }
/orders/{id}:
get: { summary: Get order }
/orders/{orderId}/items:
get: { summary: List order items }
post: { summary: Add item to order }
components:
schemas:
User:
properties:
name: { type: string }
email: { type: string }
avatar: { type: string }
Product:
properties:
title: { type: string }
price: { type: number }
category: { type: string }
stock: { type: integer }
image: { type: string }
Order:
properties:
user_id: { type: string }
total: { type: number }
status: { type: string }
OrderItem:
properties:
order_id: { type: string }
product_id: { type: string }
quantity: { type: integer }
price: { type: number }# After import + data generation:
curl /api/invoke/mock/<api-id>/products
curl /api/invoke/mock/<api-id>/products/1
curl /api/invoke/mock/<api-id>/orders/1?_embed=items
curl -X POST /api/invoke/mock/<api-id>/orders \
-H "Content-Type: application/json" \
-d '{"user_id":"1","total":99.99,"status":"pending"}'Webhook Relay & Transform
Receive a webhook from any service, transform the payload with an edge function, then fan-out to Slack + Discord + your internal API simultaneously.
Step-by-Step
POST /relay/incoming → select the functionhttps://moqapi.dev/api/invoke/{projectId}/fn/relay// Incoming webhook → transform → fan-out to Slack + Discord
// Bind to: POST /relay/incoming
export const handler = async (event) => {
const incoming = event.body;
// Normalize the payload
const notification = {
source: incoming.source || 'unknown',
event: incoming.event || incoming.action || 'event',
summary: incoming.message || incoming.description || JSON.stringify(incoming).slice(0, 200),
timestamp: new Date().toISOString()
};
// Fan-out targets
const targets = [
{
url: 'https://hooks.slack.com/services/T00/B00/xxx',
body: { text: `[${notification.source}] ${notification.event}: ${notification.summary}` }
},
{
url: 'https://discord.com/api/webhooks/123/abc',
body: { content: `**${notification.source}** — ${notification.event}\n${notification.summary}` }
}
];
const results = await Promise.allSettled(
targets.map(t => fetch(t.url, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(t.body)
}))
);
return {
statusCode: 200,
body: { relayed_to: results.length, statuses: results.map(r => r.status) }
};
};API Gateway Prototype
Present a working API to stakeholders — full REST endpoints with sample data, proper HTTP methods, and custom auth logic. Share the URL, let them hit it from Postman.
Step-by-Step
POST /auth/validate → select the function// Bind to POST /auth/validate in API Gateway
export const handler = async (event) => {
const { api_key } = event.body;
// Mock validation — always approve keys starting with "sk_"
const valid = api_key && api_key.startsWith('sk_');
return {
statusCode: valid ? 200 : 401,
body: {
valid,
plan: valid ? 'pro' : null,
rate_limit: valid ? 1000 : 0,
message: valid ? 'API key valid' : 'Invalid API key'
}
};
};# Validate API key (edge function)
curl -X POST /api/invoke/fn/<api-id>/auth/validate \
-H "Content-Type: application/json" \
-d '{"api_key":"sk_test_abc123"}'
# Fetch data (mock API)
curl /api/invoke/mock/<mock-api-id>/users
curl /api/invoke/mock/<mock-api-id>/products?limit=10Slack Slash Command Bot
Build a Slack slash command handler that queries your mock API for data and returns formatted results. Type /tickets open → see live ticket data.
Step-by-Step
tickets resource (fields: title, status, assignee, priority)POST /slack/commands → select the functionhttps://moqapi.dev/api/invoke/{projectId}/fn/slack-command/tickets open in Slack → function queries your mock tickets → returns formatted list// Handles /tickets slash command from Slack
// Bind to: POST /slack/commands
export const handler = async (event) => {
const { text, user_name } = event.body;
const status = text || 'open';
// Replace with your project ID and mock API base path
const MOCK_BASE = 'https://moqapi.dev/api/invoke/{projectId}/tickets-api';
const res = await fetch(`${MOCK_BASE}/tickets`);
const allTickets = await res.json();
// Filter by status
const tickets = allTickets.filter(t =>
t.status?.toLowerCase() === status.toLowerCase()
);
const lines = tickets.slice(0, 5).map(t =>
`• *${t.title}* — ${t.status} (assigned: ${t.assignee})`
).join('\n');
return {
statusCode: 200,
body: {
response_type: 'in_channel',
text: `*${status} tickets* (showing ${Math.min(5, tickets.length)} of ${tickets.length}):\n${lines}`
}
};
};Multi-Service Status Dashboard
Mock multiple microservice health endpoints. A cron job checks them every 5 minutes and fires a Slack webhook when anything is "down" — full monitoring pipeline, zero infrastructure.
Step-by-Step
services resource (fields: name, status, latency_ms, region)auth-service: healthy, payment-api: degraded, search-service: down*/5 * * * * (every 5 min) → select the function// Checks service health from mock API data
// Schedule: */5 * * * * (every 5 minutes)
export const handler = async (event) => {
// Replace with your project ID and mock API base path
const MOCK_BASE = 'https://moqapi.dev/api/invoke/{projectId}/services-api';
const res = await fetch(`${MOCK_BASE}/services`);
const services = await res.json();
const down = services.filter(s =>
s.status === 'down' || s.status === 'degraded'
);
if (down.length > 0) {
const alert = down.map(s =>
`⚠️ ${s.name} (${s.region}): ${s.status} — ${s.latency_ms}ms`
).join('\n');
return {
statusCode: 200,
body: { alert: true, message: alert, down_count: down.length }
};
}
return {
statusCode: 200,
body: { alert: false, message: 'All services healthy', checked: services.length }
};
};Scheduled Email Report Pipeline
Aggregate data from your mock API, build a daily summary, and push it to an email service webhook every weekday at 9 AM — entirely automated reporting pipeline.
Step-by-Step
orders + users resources0 9 * * 1-5 (weekdays at 9 AM)// Aggregates order data from mock API
// Schedule: 0 9 * * 1-5 (weekdays at 9 AM)
export const handler = async (event) => {
// Replace with your project ID and mock API base path
const BASE = 'https://moqapi.dev/api/invoke/{projectId}/orders-api';
const [ordersRes, usersRes] = await Promise.all([
fetch(`${BASE}/orders`),
fetch(`${BASE}/users`)
]);
const orders = await ordersRes.json();
const users = await usersRes.json();
const totalRevenue = orders.reduce((sum, o) => sum + (o.total || 0), 0);
const pending = orders.filter(o => o.status === 'pending').length;
const completed = orders.filter(o => o.status === 'completed').length;
return {
statusCode: 200,
body: {
report: {
date: new Date().toISOString().split('T')[0],
total_orders: orders.length,
total_users: users.length,
revenue: '$' + totalRevenue.toFixed(2),
pending_orders: pending,
completed_orders: completed
}
}
};
};Data Migration Dry Run
Simulate migrating data between two different API schemas. Import your old API spec as one mock, your new spec as another, and write a function that maps between them — validate the migration logic before touching real data.
Step-by-Step
// Reads from Legacy mock → transforms → writes to New mock
export const handler = async (event) => {
// Replace with your project ID and mock API base paths
const LEGACY = 'https://moqapi.dev/api/invoke/{projectId}/legacy-api';
const NEW_API = 'https://moqapi.dev/api/invoke/{projectId}/new-api';
// Read from legacy
const res = await fetch(`${LEGACY}/customers`);
const old = await res.json();
// Transform: legacy "fullname" → new "first_name" + "last_name"
const migrated = old.map(c => ({
first_name: c.fullname?.split(' ')[0] || '',
last_name: c.fullname?.split(' ').slice(1).join(' ') || '',
email: c.email_address, // field renamed
phone: c.tel || null, // field renamed
tier: c.vip ? 'premium' : 'standard' // boolean → enum
}));
// Write to new API
const results = await Promise.allSettled(
migrated.map(m => fetch(`${NEW_API}/customers`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(m)
}))
);
const success = results.filter(r => r.status === 'fulfilled').length;
return {
statusCode: 200,
body: { migrated: success, failed: old.length - success, total: old.length }
};
};Mobile App Backend Prototype
Give your mobile team a working API on day 1. Import the planned spec, generate realistic data, add mock auth, and schedule notifications when new data is generated. Uses every moqapi feature.
Step-by-Step
POST /auth/login// Mock login — always returns a JWT for development
// Bind to: POST /auth/login
export const handler = async (event) => {
const { email, password } = event.body;
if (!email || !password) {
return { statusCode: 400, body: { error: 'Email and password required' } };
}
// Always succeed in mock mode
const mockToken = 'eyJhbGciOiJIUzI1NiJ9.' +
btoa(JSON.stringify({ sub: email, iat: Date.now(), exp: Date.now() + 86400000 })) +
'.mock-signature';
return {
statusCode: 200,
body: {
token: mockToken,
user: {
email,
name: email.split('@')[0],
avatar: 'https://api.dicebear.com/7.x/avataaars/svg?seed=' + email
},
expires_in: 86400
}
};
};# 1. Login (edge function via API Gateway)
curl -X POST /api/invoke/fn/<api-id>/auth/login \
-H "Content-Type: application/json" \
-d '{"email":"dev@app.com","password":"test123"}'
# 2. Fetch mock data (Mock API)
curl /api/invoke/mock/<mock-api-id>/posts
curl /api/invoke/mock/<mock-api-id>/users/1
curl /api/invoke/mock/<mock-api-id>/posts/1?_embed=comments// Feature Combination Cheatsheet
| Use Case | Mock | Func | Hook | Cron | Gate |
|---|---|---|---|---|---|
| Stripe Checkout | ✓ | — | ✓ | — | — |
| GitHub PR Bot | — | ✓ | ✓ | — | — |
| E-Commerce POC | ✓ | — | — | — | — |
| Webhook Relay | — | ✓ | ✓ | — | ✓ |
| API Gateway Proto | ✓ | ✓ | — | — | ✓ |
| Slack Command Bot | ✓ | ✓ | — | — | ✓ |
| Status Dashboard | ✓ | ✓ | ✓ | ✓ | — |
| Email Reports | ✓ | ✓ | ✓ | ✓ | — |
| Data Migration | ✓ | ✓ | — | — | — |
| Mobile Backend | ✓ | ✓ | ✓ | ✓ | ✓ |