Works with fetch, Axios, TanStack Query & SWR

Mock API for React

Build your React UI without waiting for the backend. Rest Faker gives you a real REST API with live CRUD endpoints and realistic fake data — call it with fetch, Axios, or TanStack Query just like a production backend.

The React development bottleneck

Waiting on backend

Frontend work stalls when backend endpoints aren't ready. You end up building with hardcoded data that doesn't reflect real API shapes.

MSW setup overhead

Mock Service Worker is powerful but adds configuration, service worker files, and handler boilerplate before you can start building UI.

Not shareable

Local mocks don't work when you share a preview URL. Stakeholders see broken requests instead of the feature you built.

Drop into any React component

Replace your API URL with your Rest Faker endpoint. That's it.

With fetch (useEffect)

import { useState, useEffect } from "react";

const BASE = "https://api.restfaker.dev/api/schema";
const TOKEN = "YOUR_API_TOKEN";

export function UserList() {
  const [users, setUsers] = useState([]);

  useEffect(() => {
    fetch(`${BASE}/users?perPage=10`, {
      headers: { apiToken: TOKEN },
    })
      .then(r => r.json())
      .then(({ data }) => setUsers(data));
  }, []);

  return (
    <ul>
      {users.map(u => (
        <li key={u.id}>{u.name} — {u.email}</li>
      ))}
    </ul>
  );
}

With TanStack Query

import { useQuery, useMutation } from "@tanstack/react-query";

const BASE = "https://api.restfaker.dev/api/schema";
const TOKEN = "YOUR_API_TOKEN";

// Fetch users
export function useUsers() {
  return useQuery({
    queryKey: ["users"],
    queryFn: () =>
      fetch(`${BASE}/users`, {
        headers: { apiToken: TOKEN },
      }).then(r => r.json()),
  });
}

// Create a user
export function useCreateUser() {
  return useMutation({
    mutationFn: (data) =>
      fetch(`${BASE}/users`, {
        method: "POST",
        headers: {
          apiToken: TOKEN,
          "Content-Type": "application/json",
        },
        body: JSON.stringify(data),
      }).then(r => r.json()),
  });
}

With Axios

import axios from "axios";

const api = axios.create({
  baseURL: "https://api.restfaker.dev/api/schema",
  headers: { apiToken: "YOUR_API_TOKEN" },
});

// GET with pagination and sorting
const { data } = await api.get("/products", {
  params: { page: 1, perPage: 20, sort: "price", order: "asc" },
});

// PATCH an existing record
await api.patch(`/products/${id}`, { price: 29.99 });

Everything a React developer needs in a mock API

No CORS Issues

Rest Faker endpoints include the right CORS headers so your React dev server can call them directly.

Persistent State

POST, PATCH, and DELETE actually mutate the data. Your mock API behaves like a real backend.

Instant Data Refresh

Hit regenerate in the dashboard to get fresh records whenever you need a clean state.

Mock Auth Endpoints

Login and token endpoints for testing authentication flows in your React app.

TypeScript Types

Download TypeScript interfaces that match your schema for type-safe API calls.

Shareable URL

The same endpoint works for every team member — no local setup, just a URL.

Why React developers choose Rest Faker

No service worker setup — just a URL, works from day one

CORS headers included — call the API from any React dev server

Realistic data — real names, emails, addresses — not lorem ipsum

Mutations persist — POST and PATCH actually change the data

Works in Vercel previews — the endpoint is live, not localhost

Exportable types — download TypeScript interfaces for your schema

Get a mock API for your React app — free

Live endpoint in 30 seconds. No backend, no credit card, no service worker.