PostGraphile / PropelAuth Multi-Tenant Starter Example
This repo contains three folders:
- backend - An Express backend using PostGraphile to generate instant GraphQL endpoints based on a Postgres schema. Uses PropelAuth and Postgres Row Level Security for multi-tenant / B2B authentication.
- database - An example DB schema
- frontend - A Next.js (React) application that uses Apollo client to make GraphQL queries and PropelAuth to manage organizations/tenants.
Getting started
A blog post detailing everything in this repo is available here.
To get started, you'll need to first:
- Install and run Postgres. You can do this with a native client or with Docker.
- Hydrate your database. You can either use the example schema in
database/schema.sql
or modify it and use your own. - Set up PropelAuth and update
frontend/.env
andbackend/.env
with yourAUTH_URL
andAPI_KEY
. See the Getting started guide for more information. - Run the frontend
$ yarn dev
- Run the backend
yarn start
And that's it. The frontend is alredy set up with an AuthenticatedApolloProvider
which will automatically include the auth and organization/tenant information on every request.
Questions?
Reach out at support@propelauth.com