About EndpointX

EndpointX is an open-source project available on GitHub.

You can view the source code, report issues, suggest ideas,
or contribute to the project

https://github.com/robnsiov/endpointx

If you find a bug, have an improvement idea, want to help
improve the documentation, or have any feedback, feel free to contact me.

Email: robnsiov@gmail.com

Thank you for supporting open-source development ❤️ .

Ctrl+K

JSON Database

EndpointX includes a fully functional, built-in JSON Database designed for lightweight mock data. It allows your dynamic endpoints to behave like stateful REST APIs without the need to provision or manage external database servers.

You can store any valid JSON structure within this database, making it highly flexible for Frontend Development, Mobile Development, and API Prototyping.

Supported Data Structures

The JSON Database imposes no strict schemas. You have complete freedom over the data shapes you store. Supported JSON data types include:

  • Objects
  • Arrays
  • Nested Objects
  • Strings
  • Numbers
  • Booleans

Because there is no schema enforcement, you must validate incoming data within your endpoint code before writing it to the database.

Accessing the Database

Inside your endpoint runtime, the database is exposed globally via the db object.

To read or write data, you can interact with db as a standard JavaScript object.

Whenever you modify the db object (create, update, or delete data), you must include db in the returned response object. This allows the system to detect that the database has been modified.

Example:

export async function POST() {
  db.users.push({
    name: 'John',
    email: 'john@example.com',
  });
 
  return {
    status: 200,
    db,
    body: {
      message: 'User created successfully',
    },
  };
}

Limitations

Lightweight Mock Data Only

The JSON Database is designed for lightweight mock data and runs inside the same isolated sandbox as your endpoint code. It is optimized for fast prototyping and testing, but it has a strict size limitation.

The maximum supported database size is 2MB. If your db object exceeds this limit, the endpoint execution may fail or crash due to memory constraints.

Avoid storing large datasets or binary data inside the JSON Database.