Newsletter
Join the Community
Subscribe to our newsletter for the latest news and updates
A JSON database with Models, Schemas, and a flexible querying interface that powers Hexo.

A quick and easy way to generate markup for mailto links without having to worry about the annoying formatting.
Warehouse is a Node.js JSON database library with Models, Schemas, and a flexible querying interface, and it acts as the data layer for the Hexo static site generator.
Warehouse is a schema-based JSON database for Node.js, distributed as the warehouse npm package. It accepts JavaScript objects as documents through a model's insert method, and returns a Promise that resolves to the stored object. The library is maintained by the Hexo organization and is written in JavaScript with TypeScript type declarations.
Date.now for timestamps.Post.insert(...) returns a Promise, enabling async/await usage.lib/models written as Warehouse schemas and schema types../test/scripts and a coverage status badge from Coveralls.Warehouse is for Node.js developers who need a lightweight schema layer for JSON data without running a separate database server. It is also for Hexo plugin authors who want to define custom content models or schema types, and for maintainers of static site generator projects that need structured data storage.
The README shows a basic workflow: create a Database instance, register a model with a schema (for example, posts with title and created), then call Post.insert with a document containing a title property. The result is returned as a Promise, which you can log or chain with other operations.
Run npm install warehouse in an existing Node.js project. This installs the library from the npm registry.
In version 3, the constructor changed from a function declaration to a class declaration or class expression. Derived classes must also use class syntax, so custom SchemaType definitions need to be rewritten as classes.
The API documentation is hosted at https://hexojs.github.io/warehouse/. The README also links to model and SchemaType examples in the Hexo source repository.
Yes, Warehouse powers Hexo's internal data layer. Hexo's model definitions in lib/models are built on Warehouse, and the README links to those files as examples.
