
Security News
The Hidden Blast Radius of the Axios Compromise
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.
fake-json-api
Advanced tools
A fake API for frontend development with data being stored locally in IndexedDB
A small package that intercepts AJAX requests and responds with data stored locally in IndexedDB. It attempts to fake an actual JSON API.
Install the package:
npm i fake-json-api
or
yarn add fake-json-api
Import it in your code:
import api from 'fake-json-api'
or
const api = require('fake-json-api')
Configure the database:
api.configure({
posts: {
schema: '++id,title,content'
}
})
Uses Dexie.js stores syntax to define the schema
Add some data:
api.loaddata({
posts: [
{ id: 1, title: 'Test post 1', content: 'blah blah blah' },
{ id: 2, title: 'Test post 2', content: 'blah blah blah' }
]
})
Start it intercepting requests:
api.listen()
Make a request:
fetch(/posts)
.then(res => res.json())
.then(data => console.log(res.data))
Available endpoints would be:
/posts/posts/posts/:id/posts/:id/posts/:idWorks with dexie-relationships for relational data. So for example if you want to add users to posts:
api.configure({
posts: {
schema: '++id,title,content,user_id -> users.id',
populate: { user: 'user_id' }
},
user: {
schema: '++id,username',
populate: { posts: 'posts' }
}
})
api.loaddata({
posts: [
{ id: 1, title: 'Test post 1', content: 'blah blah blah', user_id: 1 },
{ id: 2, title: 'Test post 2', content: 'blah blah blah', user_id: 2 }
],
users: [
{ id: 1, username: 'mickyginger' },
{ id: 2, username: 'mattstuddert' }
]
})
Users would now be nested in posts, and each user object would have an array of nested posts.
Available endpoints would be:
GET /posts
POST /posts
GET /posts/:id
PUT /posts/:id
DELETE /posts/:id
GET /users
POST /users
GET /users/:id
PUT /users/:id
DELETE /users/:id
FAQs
A fake API for frontend development with data being stored locally in IndexedDB
We found that fake-json-api demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.

Research
A supply chain attack on Axios introduced a malicious dependency, plain-crypto-js@4.2.1, published minutes earlier and absent from the project’s GitHub releases.

Research
Malicious versions of the Telnyx Python SDK on PyPI delivered credential-stealing malware via a multi-stage supply chain attack.