Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. REST
  3. FakeRest

FakeRest

MITTypeScriptv4.2.0

A browser library that intercepts AJAX calls to mock a REST server based on JSON data for client-side testing.

GitHubGitHub
455 stars50 forks0 contributors

What is FakeRest?

FakeRest is a browser library that intercepts AJAX calls to mock a REST API server based on JSON data. It allows developers to test JavaScript REST clients, such as single-page applications, without requiring a real backend server by faking HTTP requests and responses. The library supports full CRUD operations, advanced querying, and middleware for simulating server-side logic.

Target Audience

Frontend and full-stack developers building and testing REST client applications, particularly those working on single-page apps who need to mock API responses during development or testing.

Value Proposition

Developers choose FakeRest for its seamless integration with popular mocking libraries like MSW, fetch-mock, and Sinon.js, its realistic simulation of REST API behaviors including filtering and embedding, and its flexible middleware system for custom server logic.

Overview

Patch fetch/XMLHttpRequest to fake a REST API server in the browser, based on JSON data.

Use Cases

Best For

  • Testing REST client applications without a backend server
  • Mocking API responses during frontend development
  • Simulating server-side behaviors like authentication and validation in tests
  • Creating realistic API mocks for single-page application demos
  • Integrating with existing testing setups using MSW, fetch-mock, or Sinon.js
  • Developing and debugging JavaScript applications with fake REST data

Not Ideal For

  • Projects requiring server-side mocking or Node.js environments
  • Teams using non-REST APIs like GraphQL or gRPC
  • Developers seeking a zero-dependency, standalone mocking library

Pros & Cons

Pros

Realistic REST Simulation

Supports full CRUD operations, advanced filtering with operators like _gt and _lte, and embedding of related resources, mimicking a real backend with detailed query parameters.

Flexible Library Integration

Provides adapters for MSW, fetch-mock, and Sinon.js, allowing seamless integration with popular mocking setups in JavaScript projects, as shown in the README examples.

Customizable Middleware System

Enables simulation of server-side behaviors such as authentication checks, validation, and response delays through a chainable middleware API, with built-in functions like withDelay.

Configurable Data Handling

Allows customization of identifier fields (e.g., for MongoDB) and primary key generation via options like identifierName and getNewId, adapting to various API structures.

Cons

Browser-Only Limitation

Patches browser APIs like fetch and XMLHttpRequest, making it unsuitable for server-side testing, Node.js environments, or projects requiring mock servers outside the browser.

External Dependency Overhead

Requires installation and setup of third-party libraries like MSW or Sinon, adding complexity and maintenance compared to all-in-one solutions that work out of the box.

In-Memory Data Persistence

Mock data is stored in memory and lost on page refresh, which can be inconvenient for long-running development sessions or demos needing persistent state without extra setup.

Frequently Asked Questions

Quick Stats

Stars455
Forks50
Contributors0
Open Issues0
Last commit7 days ago
CreatedSince 2015

Tags

#rest#single-page-app#client#rest-api#msw#api-mocking#browser-testing#frontend#testing#mock#test#sinon#javascript#fetch

Built With

J
JavaScript

Included in

REST3.9k
Auto-fetched 10 hours ago

Related Projects

json-serverjson-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)

Stars75,566
Forks7,289
Last commit1 month ago
DuckRailsDuckRails

Development tool to mock API endpoints quickly and easily - NOT MAINTAINED

Stars1,711
Forks105
Last commit5 months ago
Request BasketsRequest Baskets

HTTP requests collector to test webhooks, notifications, REST clients and more ...

Stars421
Forks64
Last commit1 year ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub