Please note that this is Work In Progress. Feel free to open issues, contribute or give feedback.
- Docker
- Docker Compose
- Prisma CLI (
npm install -g prisma
) - Node and NPM
- Install dependencies:
npm install
- Launch the Postgres database and Prisma server:
docker-compose up -d
- Deploy your models to Prisma and generate the client:
prisma generate && prisma deploy
- Run the API for development:
npm run dev
- Access the playground of your Graphql API at http://localhost:4000
- Prisma as an ORM
- GraphQL Modules
- Authentication: using GraphQL Shield or as a GraphQL module
The backend is organized into GraphQL modules More information in this Medium post
Each module merges its types and resolvers in order to export a GraphQLModule
instance. These modules are then imported and merged into a single GraphQLModule
module in the file src/api/modules/index.js
. This object holds, among others, the schema
and context
which are fed to the ApolloServer
instance in src/api/index.js
GraphQL modules offers extensibility of your code base and forces/helps you organize your SDL types by domain/feature rather than by type.
TODO
This project contains two more branches with additional features compared to the backend:
graphql-shield
: authentication implemented using the GraphQL shield packagenuxt-frontend
: minimal frontend built using Nuxt with Auth0 authentication configured. Its purpose is to give a working example of the front side of authentication
In order to keep the graphql-shield
and nuxt-frontend
branches in sync with the master
branch, all modifications related to the backend must be implemented first in the master
branch then merged into the branch in question. Only then can additional modifications of the backend, specific to that branch, be added.
Please use the alias npm run commit
for Commitizen friendly commits.
NodeJS best practices checklist:
- 1.5 Use environment aware, secure and hierarchical config
Using the [node-config] package with Webpack. See
- Clean datasources
- Documentation and references
- GrahQL CLI scaffolding support