Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
1–10 of 12 posts
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#2We use Hasura[1] to generate the realtime GraphQL API on Postgres automatically. The CLI tool's work then mostly boils down to 2 things, which we do in phases:
1. Phase I: We migrate firebase data nodes to Postgres tables in a fairly naive way. We setup automatic IDs and parent-child tables and set up relationships between the tables. This gives you a write-many type GraphQL API on postgres. Realtime GraphQL with subscriptions and live-queries replaces firebase realtime
2. Phase II: As an optional next step, we try to normalise data by detecting overlapping data between tables. We delete "subset" tables and set up relationships to the superset table.
I've written up a blogpost with more details here: https://blog.hasura.io/firebase2graphql-moving-from-firebase...
[1] https://github.com/hasura/graphql-engine , https://hasura.io
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#3E.g. If a new item is added to the list, will it appear in the list in real-time? Also, if an item's property is changed so that its position in the list changes, will this update the list in real-time as well?
If so, how does it prevent over-fetching?
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#4Do real-time subscriptions also work on sorted, filtered lists? E.g. If a new item is added to the list, will it appear in the list in real-time? Also, if an item's property is changed so that its position in the list changes, will this update the list in real-time as well? If so, how does it prevent over-fetching?
> ... prevent over-fetching
This is handled server side. Subscriptions are more like 'live queries'. The server sends the data to the client only when the result set for the given 'live-query' changes.
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#5Do real-time subscriptions also work on sorted, filtered lists? E.g. If a new item is added to the list, will it appear in the list in real-time? Also, if an item's property is changed so that its position in the list changes, will this update the list in real-time as well? If so, how does it prevent over-fetching?
Yes they work with filters, ordering etc. > ... prevent over-fetching This is handled server side. Subscriptions are more like 'live queries'. The server sends the data to the client only when the result set for the given 'live-query' changes.
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#6How does it get notified by PostgreSQL when the result of a query changes, since AFAIK PostgreSQL has no such built-in functionality? (it works if other apps change the database, right?)
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#7Is this Hasura GraphQL Engine open source? What's the business model? Are there any features missing if you don't pay anything? How does it get notified by PostgreSQL when the result of a query changes, since AFAIK PostgreSQL has no such built-in functionality? (it works if other apps change the database, right?)
[0]: https://hasura.io/
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#8Is this Hasura GraphQL Engine open source? What's the business model? Are there any features missing if you don't pay anything? How does it get notified by PostgreSQL when the result of a query changes, since AFAIK PostgreSQL has no such built-in functionality? (it works if other apps change the database, right?)
I dug into the code a bit and think it all happens here: https://github.com/hasura/graphql-engine/blob/master/server/... Which if my fledgling Haskell is correct digs into the subscription to find the sources and then adds a trigger on them.
On a related note, I've been very impressed with the Hasura GraphQL server. In particular how the authentication works with a JWT token and it's access restrictions seem pretty well thought out and flexible.
I have not yet used it in production but :fingers-crossed: it performs as well there as it has in testing and development
Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#9Re: Show HN: Firebase2graphql – Migrate from Firebase to GraphQL on Postgres
#10How do you secure this data in Hasura? The article does not seem to mention security.