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.

// How to Import Any OpenAPI/Swagger YAML

1Go to Mock APIs → Create Mock API
2Click "Import OpenAPI"
3Paste a URL (e.g. https://petstore3.swagger.io/api/v3/openapi.json) or upload a .yaml / .json file
4All endpoints, resources, schemas, and relationships are auto-created
5Click "Generate Data" on each resource → Faker.js fills realistic sample data
6Your REST API is live immediately — call it via curl or from your frontend
supported-spec-urls.txtplaintext
# 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 machine
01

Stripe Checkout Flow

Mock APIWebhook

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

1Create a Mock API → click "Import OpenAPI" → paste the YAML spec below
2Resources auto-created: products, prices, checkout_sessions
3Click "Generate Data" on each resource — fake products, prices, and sessions appear
4Go to Webhooks → Create Webhook
5Set Target URL to your app's endpoint: https://yourapp.com/api/stripe/webhook
6Paste the webhook payload template below (exact Stripe event format)
7Click "Test Fire" → your app receives an HTTP POST identical to what Stripe sends
8Your frontend calls the mock API for products/checkout — your backend receives webhook events. Full flow tested.
stripe-mock-spec.yamlyaml
openapi: "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 }
webhook-payload-template.jsonjson
{
  "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" }
    }
  }
}
test-your-api.shbash
# 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 send
02

GitHub PR Notification Bot

FunctionWebhook

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

1Go to Functions → Create Function
2Paste the github-pr-handler.js code below
3Click "Publish"
4Go to APIs → Create API → add route: POST /github/webhook → select your function
5Go to Webhooks → Create Webhook
6Set Target URL: https://moqapi.dev/api/invoke/{projectId}/fn/github-pr-handler
7Paste the PR payload template below
8Click "Test Fire" → your function receives the PR event, parses it, logs the Slack-formatted output
github-pr-handler.jstypescript
// 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 } };
};
github-pr-webhook-payload.jsonjson
{
  "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
  }
}
03

E-Commerce Backend POC

Mock APIYAML Import

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

1Go to Mock APIs → Create Mock API → click "Import OpenAPI"
2Paste the e-commerce YAML spec below
3All 4 resources auto-created: users, products, orders, items. Relationships auto-detected from nested paths.
4Click "Generate Data" on each resource (25 records each)
5Point your frontend to the mock API base URL — full CRUD works instantly
6Test nested routes: /orders/1/items, embedding: /orders/1?_embed=items
ecommerce-spec.yamlyaml
openapi: "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 }
test-endpoints.shbash
# 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"}'
04

Webhook Relay & Transform

FunctionWebhookGateway

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

1Go to Functions → Create Function → paste the relay function below
2Click "Publish"
3Go to APIs → Create API → add route: POST /relay/incoming → select the function
4Go to Webhooks → Create Webhook — create two: one for Slack, one for Discord. Set their target URLs and payloads.
5Point the external service (GitHub, Stripe, etc.) to: https://moqapi.dev/api/invoke/{projectId}/fn/relay
6Every incoming event hits your function → transforms → fans out to both Slack and Discord
webhook-relay.jstypescript
// 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) }
  };
};
05

API Gateway Prototype

Mock APIFunctionGateway

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

1Import your planned API spec (YAML) → all endpoints auto-created as a Mock API
2Click "Generate Data" — 50+ records per resource
3Go to Functions → Create Function → paste the auth validator below
4Click "Publish"
5Go to APIs → Create API → add route: POST /auth/validate → select the function
6Share the base URL with stakeholders — mock data endpoints + auth validation, all working
auth-validator.jstypescript
// 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'
    }
  };
};
test.shbash
# 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=10
06

Slack Slash Command Bot

Mock APIFunctionGateway

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

1Create a Mock API with a tickets resource (fields: title, status, assignee, priority)
2Generate 20+ tickets with varied statuses
3Go to Functions → Create Function → paste the slash command handler below
4Click "Publish"
5Go to APIs → Create API → add route: POST /slack/commands → select the function
6In Slack App settings: set Request URL to https://moqapi.dev/api/invoke/{projectId}/fn/slack-command
7Type /tickets open in Slack → function queries your mock tickets → returns formatted list
slack-command.jstypescript
// 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}`
    }
  };
};
07

Multi-Service Status Dashboard

Mock APIFunctionCronWebhook

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

1Create a Mock API with a services resource (fields: name, status, latency_ms, region)
2Add records manually: auth-service: healthy, payment-api: degraded, search-service: down
3Go to Functions → Create Function → paste the health checker below
4Click "Publish"
5Go to Cron Jobs → Create Cron Job → schedule: */5 * * * * (every 5 min) → select the function
6Go to Webhooks → Create Webhook → target: your Slack webhook URL → set alert payload
7Every 5 min the function checks service statuses and the webhook alerts on failures
health-checker.jstypescript
// 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 }
  };
};
08

Scheduled Email Report Pipeline

Mock APIFunctionCronWebhook

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

1Create a Mock API → import a spec with orders + users resources
2Generate 100+ orders with varied statuses (pending, completed, cancelled)
3Go to Functions → Create Function → paste the report aggregator below
4Click "Publish"
5Go to Cron Jobs → Create Cron Job → schedule: 0 9 * * 1-5 (weekdays at 9 AM)
6Go to Webhooks → Create Webhook → target: your email API (SendGrid, Mailgun, etc.)
7Every morning the function aggregates order stats and the webhook pushes the report
daily-report.jstypescript
// 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
      }
    }
  };
};
09

Data Migration Dry Run

Mock API ×2FunctionYAML Import

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

1Create Mock API #1 ("Legacy") → import your old API spec or add resources manually
2Generate Data in the Legacy mock — this represents your current production data
3Create Mock API #2 ("New") → import your target spec (new schema, renamed fields, etc.)
4Go to Functions → Create Function → paste the migration function below
5The function reads from Legacy → transforms field names/types → POSTs to New
6Click "Test" → verify the data appears correctly in Mock API #2
7Iterate on the mapping logic until the migration is perfect — then apply the same transforms to your real migration script
data-migration.jstypescript
// 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 }
  };
};
10

Mobile App Backend Prototype

Mock APIFunctionGatewayWebhookCron

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

1Import your mobile app's planned API spec → all endpoints auto-created as a Mock API
2Generate Data — names, avatars, posts, comments, all realistic
3Go to Functions → Create Function → paste the mock login function below
4Click "Publish" → go to APIs → Create API → add route: POST /auth/login
5Share the base URL with your iOS/Android devs — they can start building immediately
6Go to Webhooks → Create Webhook → Slack notification when testing starts
7Go to Cron Jobs → schedule a function to refresh test data daily
mock-auth-login.jstypescript
// 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
    }
  };
};
mobile-dev-workflow.shbash
# 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 CaseMockFuncHookCronGate
Stripe Checkout
GitHub PR Bot
E-Commerce POC
Webhook Relay
API Gateway Proto
Slack Command Bot
Status Dashboard
Email Reports
Data Migration
Mobile Backend