repliear icon indicating copy to clipboard operation
repliear copied to clipboard

Serverless App demo.

Open ghost opened this issue 2 years ago • 7 comments

Is it possible to get a SvelteKit (or NextJS, Nuxt ) PostgreSQL / Supabase demo?

ghost avatar May 12 '22 18:05 ghost

Also a GraphQL example would be cool.

ghost avatar May 20 '22 13:05 ghost

GraphQL and Replicache don't really go together. The Replicache sync protocol takes the spot that GraphQL usually does.

aboodman avatar May 20 '22 17:05 aboodman

Interesting. For example, I used FaunaDB for an application and I interact with it using GraphQL. Does this mean that I cannot use Replicache for offline real time syncing?

ghost avatar May 20 '22 19:05 ghost

You would need to put an application server in front of fauna (perhaps a lambda would do) to implement the Replicache push and pull endpoints. See: https://doc.replicache.dev/how-it-works#the-big-picture. This is fairly easy to do. Additionally for each Replicache mutator (https://doc.replicache.dev/how-it-works#push) you need to implement the corresponding mutation code for Fauna. Most apps don't have a very large number of mutators so this isn't a big deal.

aboodman avatar May 20 '22 20:05 aboodman

Most people find Replicache easier to use than GraphQL 😂 so they don't really mourn the loss. Once you have sync setup you can kind of forget the server exists much of the time and program entirely on the client.

aboodman avatar May 20 '22 20:05 aboodman

You would need to put an application server in front of fauna (perhaps a lambda would do) to implement the Replicache push and pull endpoints. See: https://doc.replicache.dev/how-it-works#the-big-picture. This is fairly easy to do. Additionally for each Replicache mutator (https://doc.replicache.dev/how-it-works#push) you need to implement the corresponding mutation code for Fauna. Most apps don't have a very large number of mutators so this isn't a big deal.

Okay but as far as I understood these docs, it would be possible in my situation. Is this correct?

I could implement pull and push endpoints and then just run graphql queries instead of sql on the server side.

ghost avatar May 20 '22 20:05 ghost

Yep, you could do that.

aboodman avatar May 23 '22 03:05 aboodman