Aurelia package for indexedDB?

Seems like something that would be a good fit with the Aurelia philosophy and ecosystem, given the wide (and growing) browser support for indexedDB.

The existing indexedDB api is pretty clunky. It would be nice to have some functionality in Aurelia to facilitate storing/retrieving component state.

In particular, this would be useful for building PWAs.

There is no need to have an Aurelia specific library to handle this. In Aurelia you have access to plain old JavaScript and there are already dozens of libraries built on top of indexedDB and what you use will vary by requirements.

PouchDB comes as default with an indexedDB adapter. If you want something more minimal which is a nice abstraction over the less than great default API, I would recommend dexie.js.


Well I mean you could say all the same stuff about XMLHttpRequest, but Aurelia still has its HTTP package right?

I’m just thinking it might be nice to have an indexedDB package configured and tested specifically for Aurelia.

There is aurelia-fetch, but I’m not aware of any reason why you’d now use it over the official standardised and polyfilled fetch API.

I’ve used Dexie.js, localForage and idb with Aurelia and they all worked with with zero special configuration and no extra testing was required. What functionality would Aurelia specific wrappers for these add?

Aurelia specific libraries only make sense for reusable code and components and where deeper integration is required with Aurelia.

1 Like

Hmm ok, very convincing. I appreciate your thorough reply to my idle speculation :).

1 Like

Reasons for the fetch-client abstraction by Aurelia would be the whole Interceptor story (e.g retry-interceptor). So the only reason for an indexedDB plugin would be for additional features or better testing by providing easier means for mocking/stubbing parts.

Until then I think it’s as @timfish said, just use whatever is out there as there isn’t clear benefit to something custom built.


Pretty much everyone uses idb for working with IndexedDB. I use it myself with Aurelia and haven’t had any issues. Since I use TypeScript I made a wrapper class around it and exposed simple async methods. Would recommend.

1 Like