Prisma1: Offline-first support

Created on 17 Jan 2018  路  10Comments  路  Source: prisma/prisma1

What feature are you missing?

Will prisma eventually offer offline-first / browser / server sync similar to gun.js?

This would be very helpful for developing PWAs

kinfeature

Most helpful comment

I'm reviving this issue to explore more ways how Prisma could make building "offline-first" applications easier. Ideas & use-cases are more than welcome! 馃檶

All 10 comments

We are currently waiting for Apollo Client to mature in this area.

Please track this repository https://github.com/apollographql/apollo-cache-asyncstorage/issues/6

Excellent, thanks @sorenbs

I'll close this issue, please refer to the mentioned one above.

I'm reviving this issue to explore more ways how Prisma could make building "offline-first" applications easier. Ideas & use-cases are more than welcome! 馃檶

Thanks for reopening this @schickling

Here are my thoughts on some offline-first or "similar" libraries I have tested:

Gun.js

Pros:

  • First class offline support, does a great job at syncing data with remote sources
  • Local and remote data can be encrypted

Cons:

  • Limited query engine
  • No support for relationships, join queries nor aggregate queries

Dexie.js

Pros:

Cons:

  • Limited support for relationships and no support of join nor agregate queries

Lovefield

Pros:

  • Amazing performance
  • Excellent query engine, supports relationships, join and aggregate queries
  • Can be used with local sources (IndexedDB) or remote (Firebase) but no other remote adapters are available

Cons:

  • No remote sync, it can use either a local or a remote adapter
  • Even though it's used at Gmail I was recently told by its main maintainer that the project is in maintenance mode and that it is very unlikely that Google will be adding new features (maybe so it doesn't compete with Firebase?)

Nano-SQL

Pros:

  • Great query engine with support for relationships, join queries and offers ways to handle aggregate queries and functions
  • Allows listening to data changes events
  • Multiple adapters for browser and server-side persistence

Cons:

  • No remote sync yet but looks like there is interest and will be implemented

edit: formating

Relevant comment on the state of Apollo offline support:
https://github.com/benseitz/apollo-link-offline/issues/1#issuecomment-371678922

@sorenbs, I'm confused, does the Prisma client use Apollo?

Ok, nevermind, the "Prisma client" name was confusing. The "client" is a client to the Prisma Server, but it also runs server side. If you want something to run client side (browser, React Native, etc..) then you'll want to use something else (like Apollo Client). https://github.com/prisma/prisma-examples/issues/239#issuecomment-442459867

@sebastianmacias Thanks for great list of databases. I'm working now on my side project for providing offline support extension to graphql out of the box.

I have created an issue to check if it is possible to use prisma (and I think it should work great with Prisma and some small wrapper package will be required to support conflict resolution).

https://github.com/graphql-heroes/offix/issues/41

Once that is done Prisma community will have a way to work with offline first workflows out of the box.

I have checked and it works. Project will work with any database of our choice, but it will use single key storage for the moment.

We are planning to improve that as part of the https://github.com/apollographql/apollo-cache-persist package.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

AlessandroAnnini picture AlessandroAnnini  路  3Comments

sedubois picture sedubois  路  3Comments

tbrannam picture tbrannam  路  3Comments

sorenbs picture sorenbs  路  3Comments

marktani picture marktani  路  3Comments