Free mock API service for testing and development
A modern, schema-driven alternative to JSONPlaceholder
🌐 Live: https://www.mockly.codes
📚 Docs: https://www.mockly.codes/docs
🎮 Playground: https://www.mockly.codes/playground
🤖 AI-readable: https://www.mockly.codes/llms.txt
- 🚀 Schema-Driven — Add new endpoints by creating a JSON schema. Zero code changes needed.
- 🎯 100+ Resources — From users to weather, stocks to movies
- 📂 14 Categories — People, Commerce, Business, Content, Social, Media, Travel, Location, Finance, Food, Education, Sports, Productivity, Reference
- 💡 Realistic Data — Powered by gofakeit with 50+ generators
- ⚡ Fast — Redis + in-memory cache (<1ms responses)
- 🔄 Consistent — Fixed seed ensures reproducible results across restarts
- 🆓 Free Forever — No rate limits, no account required for built-in resources
- 📄 Pagination —
page,limit,offset - 🔀 Sorting —
sort+orderon any field - 🔍 Full-text search —
qwith optionalsearch_fieldstargeting - 🎯 Filtering — Exact, range (
>,<,>=,<=), and substring (~contains,~startsWith,~endsWith) operators - ✂️ Field selection —
fields=id,name,price
- ⏱️ Delay —
?delay=2000simulates slow responses (max 30s) - 🎲 Chaos —
?flakyRate=0.3randomly returns 503s - 🚫 Cache bypass —
?skip_cache=true - 🏢 Multi-tenancy —
X-Tenant-IDheader - 🔐 RBAC —
X-Roleheader - 🔄 Idempotency —
Idempotency-Keyheader - 🔍 Tracing —
X-Request-IDheader
- 🎨 Next.js 16 + React 19, TypeScript, Tailwind CSS
- 🎮 Interactive Playground — Live request/response, 5 utility tools
- 📚 Docs at
/docs— Complete API reference with code examples - 🤖 AI-friendly —
/llms.txtand/llms-full.txtfor LLM tools - 🌐 Hosted on Cloudflare via OpenNext
api-mockly/
├── backend/ # Go API server (chi router, gofakeit)
│ ├── cmd/server/ # Entry point
│ ├── internal/ # Handlers, middleware, schema loader, cache
│ └── Dockerfile # Multi-stage Docker build
├── frontend/ # Next.js 16 website
│ ├── app/ # Pages: /, /docs, /playground, /templates, /resources
│ ├── components/ # React components
│ ├── lib/ # API client, schemas manifest
│ └── wrangler.jsonc # Cloudflare Workers / Pages config
├── shared/ # Source of truth
│ ├── schemas/ # JSON Schema definitions (one file per resource)
│ └── scripts/ # generate-types.js (auto-generates frontend types)
├── Dockerfile # Root-level Docker build (used by Railway)
├── railway.toml # Railway deployment config
└── Makefile # Dev helpers
- Go 1.23+
- Node.js 20+
- pnpm 9+
git clone https://github.com/0xdps/api-mockly.git
cd api-mockly
pnpm installpnpm run devThis runs:
- ✅ Schema generation (
shared/schemas/→frontend/lib/schemas-manifest.ts) - ✅ Go API at http://localhost:8080
- ✅ Next.js site at http://localhost:3000
Or run individually:
# Backend only
make api-dev
# Frontend only
pnpm --filter frontend dev# Built-in resource — no auth
curl "http://localhost:8080/products?limit=5&sort=price&order=asc"
# Search
curl "http://localhost:8080/users?q=alice&limit=5"
# Single item
curl "http://localhost:8080/products/42"
# Schema metadata
curl "http://localhost:8080/products/meta"The backend is a Dockerized Go binary deployed on Railway.
Local build:
# From the repo root (Railway builds from here)
docker build -t api-mockly-backend .
docker run -p 8080:8080 api-mockly-backendDeploy to Railway:
# Install Railway CLI
npm install -g @railway/cli
# Login and link
railway login
railway link # Select your project
# Set environment variables (once)
railway variables set CACHE_MODE=all
railway variables set CACHE_ITEMS_PER_RESOURCE=100
railway variables set CACHE_SEED=42
railway variables set MAX_ITEMS_PER_RESOURCE=1000
# Redis variables (REDIS_HOST, REDIS_PORT, REDIS_PASSWORD) are injected
# automatically when you add a Redis plugin in the Railway dashboard.
# Deploy
railway upRailway uses railway.toml at the repo root which points to Dockerfile.
On every push to trunk, Railway auto-deploys if GitHub integration is enabled.
Required environment variables:
| Variable | Default | Description |
|---|---|---|
PORT |
set by Railway | HTTP listen port |
REDIS_HOST |
— | Auto-set by Redis plugin |
REDIS_PORT |
— | Auto-set by Redis plugin |
REDIS_PASSWORD |
— | Auto-set by Redis plugin |
REDIS_DB |
0 |
Redis database index |
REDIS_TLS_ENABLED |
false |
Set true for external Redis |
CACHE_MODE |
off |
off / local / remote / all |
CACHE_ITEMS_PER_RESOURCE |
100 |
Items to pre-generate per resource |
CACHE_SEED |
42 |
Seed for reproducible data |
MAX_ITEMS_PER_RESOURCE |
1000 |
Max items requestable per resource |
The frontend is a Next.js 16 app deployed to Cloudflare Workers using OpenNext.
Local build:
cd frontend
pnpm build # Compiles Next.js
pnpm exec wrangler pages dev # Preview locally via WranglerDeploy to Cloudflare Pages:
# Install Wrangler (if not already)
pnpm add -g wrangler
# Login
wrangler login
# Build + deploy (run from frontend/)
cd frontend
pnpm build
pnpm exec wrangler pages deploy .open-next/assets --project-name api-mocklyOr using the Workers deploy path (configured in wrangler.jsonc):
cd frontend
pnpm build
pnpm exec wrangler deploywrangler.jsonc is already configured:
- entry:
.open-next/worker.js - assets:
.open-next/assets - compatibility:
nodejs_compatflag, date2026-05-02
CI/CD: Connect the repo to Cloudflare Pages in the dashboard for automatic deployments on push. Set the build command to:
cd frontend && pnpm build
And the output directory to:
frontend/.open-next/assets
Resources are organized into 14 categories:
| Group | Count | Resources |
|---|---|---|
| 🛒 Commerce | 14 | products, orders, payments, coupons, categories, tags, carts, wishlists, promotions, discounts, returns, refunds, shipping, inventory |
| 💼 Business | 12 | companies, organizations, jobs, meetings, invoices, subscriptions, clients, contracts, proposals, departments, vendors, reports |
| 10 | hotels, flights, restaurants, properties, cars, tours, attractions, bookings, destinations, travelguides | |
| 👥 People | 10 | users, contacts, students, players, employees, customers, profiles, authors, instructors, mentors |
| 🎬 Media | 10 | movies, books, albums, videos, images, songs, playlists, photos, audios, streams |
| 💬 Social | 9 | comments, reviews, messages, notifications, testimonials, likes, shares, followers, mentions |
| 📝 Content | 8 | articles, posts, news, podcasts, blogs, tutorials, guides, documents |
| ✅ Productivity | 6 | todos, notes, projects, tasks, tickets, events |
| 🌍 Location | 6 | countries, cities, weather, states, regions, coordinates |
| 💰 Finance | 6 | currencies, stocks, crypto, transactions, accounts, budgets |
| 📚 Reference | 3 | faqs, quotes, languages |
| 🍔 Food | 3 | recipes, ingredients, dishes |
| ⚽ Sports | 2 | matches, teams |
| 🎓 Education | 1 | courses |
All accessible at GET https://api.mockly.codes/{resource}.
Create a JSON schema in shared/schemas/{group}/your-resource.json:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Widget",
"type": "object",
"x-resource": {
"name": "widgets",
"singular": "widget",
"description": "Example widget resource",
"group": "commerce"
},
"properties": {
"id": {
"type": "integer",
"x-generator": "random_int",
"x-generator-params": { "min": 1, "max": 10000 }
},
"name": { "type": "string", "x-generator": "word" },
"price": { "type": "number", "x-generator": "price" },
"in_stock": { "type": "boolean", "x-generator": "bool" }
}
}Then restart the API — GET /widgets is live. Types are auto-generated on the next pnpm build.
See the full generator list in backend/internal/schema/loader.go.
| Layer | Technology |
|---|---|
| API language | Go 1.23 |
| API router | chi v5 |
| Data generation | gofakeit/v7 |
| Database | MesaHub (SQLite-compatible, for user templates) |
| Cache | Redis + in-memory |
| API deployment | Railway (Docker) |
| Frontend framework | Next.js 16 / React 19 |
| Frontend language | TypeScript |
| Styling | Tailwind CSS |
| Frontend adapter | OpenNext for Cloudflare |
| Frontend deployment | Cloudflare Workers / Pages |
| File | Contents |
|---|---|
| mockly.codes/docs | Human-readable full API reference |
| mockly.codes/llms.txt | Concise AI/LLM-readable reference |
| mockly.codes/llms-full.txt | Full API reference for AI code generation |
| backend/API_DOCUMENTATION.md | Raw backend API reference |
| DEPLOYMENT.md | Detailed deployment guide |
| CONTRIBUTING.md | Contribution guidelines |
| CHANGELOG.md | Version history |
Contributions welcome! The easiest contribution is a new schema — no Go knowledge needed.
- Fork the repo
- Add
shared/schemas/{group}/your-resource.json - Run
pnpm run devand testhttp://localhost:8080/your-resource - Open a PR
See CONTRIBUTING.md for full guidelines.
MIT — see LICENSE
- gofakeit — fake data generation
- chi — Go HTTP router
- Next.js — React framework
- OpenNext for Cloudflare — Cloudflare adapter
Made with ❤️ by Devendra Pratap