graphile / starter

Opinionated SaaS quick-start with pre-built user account and organization system for full-stack application development in React, Node.js, GraphQL and PostgreSQL. Powered by PostGraphile, TypeScript, Apollo Client, Graphile Worker, Graphile Migrate, GraphQL Code Generator, Ant Design and Next.js
https://graphile-starter.herokuapp.com
Other
1.74k stars 219 forks source link

Accessing multiple databases through postgraphile #225

Closed KrishnaPG closed 3 years ago

KrishnaPG commented 3 years ago

Summary

This starter template has created users in an app specific database during the setup, which is great. This users and related tables are used for auth etc., which is fine. However, I have another database (with its own set of tables) that I would like to additionally get access to through the postgraphile.

Wondering if that is possible, and if so how to go about it?

Additional context

Would like to keep the users database separate and also need to have access to additional databases exposed through postgraphile. Would like to know what is the best way to achieve that, using this template? Is it possible?

benjie commented 3 years ago

PostGraphile is designed for a single database; using two databases causes messy and expensive joining of data, multiple SQL queries, higher latency and is just plain undesirable. If you must do that there are solutions out there like GraphQL Mesh, schema stitching, etc; but they are well beyond the scope of this repo. Good luck 👍