Re:Show HN: Firebase2graphql – Migrate from Firebase to Grap...
by tango12 on Monday October 08, 2018 @08:31AM
(#18166807)
Hi HN!
We wrote this CLI to explore migrating from Firebase to Postgres as easily as possible.
We 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.
We 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