Skip to content

Memory Adapter

npm versionChangelog

@feathersjs/memory is a service adatper for in-memory data storage that works on all platforms. It is normally not used to store data on a production server but can be useful for data that isn't persistent and to e.g. cache data in browser or React Native applications.

$ npm install --save @feathersjs/memory


The memory adapter implements the common database adapter API and querying syntax.



import { MemoryService } from '@feathersjs/memory'

type Message = {
  id: number
  text: string

type MessageData = Pick<Message, 'text'>

class MyMessageService extends MemoryService<Message, MessageData> {}

app.use('messages', new MyMessageService({}))


The following options are available:

  • id (optional, default: 'id') - The name of the id field property.
  • startId (optional, default: 0) - An id number to start with that will be incremented for every new record (unless it is already set).
  • store (optional) - An object with id to item assignments to pre-initialize the data store
  • events (optional) - A list of custom service events sent by this service
  • paginate (optional) - A pagination object containing a default and max page size
  • allow (optional) - A list of additional query parameters to allow
  • multi (optional) - Allow create with arrays and update and remove with id null to change multiple items. Can be true for all methods or an array of allowed methods (e.g. [ 'remove', 'create' ])

Released under the MIT License.