This is a graphQL backend boilerplate based on prisma2, typescript and graphql-nexus.
For more information on prisma, check their project. This boilerplate is based on the nexus-prisma examples.
git clonenpm i- Copy
.env.exampleto.env - Maintain DB url in prisma file (see this section why)
docker-compose upnpm run migrateto apply DB schema- (Optional)
npm run seedto generate test data npm start
This boilerplate assumes a postgres database, which can be created on your local machine with the docker-compose.yml file. Simply run docker-compose up -d.
This boilerplate follows the schema-first approach of prisma and defines a Header and Item entity, with a 1-n relationship. Check ./src/types/ for the specifics on the queries and mutations implemented as examples. You'll also find computed properties and raw SQL database access.
This service is meant to be run in a container. Configuration happens through the .env file (copy from .env.example)
This templates provides a simple mechanism based on graphql-shield to implement authentication and check permissions. Currently, the implementation checks the existence of an "Authentication":"Bearer <any string value>" header for some of the apis.
Check ./permissions/index.ts for more info.
Feel free to reach out here, on my website or on Twitter. I am looking forward to it. Cheers! 👋🏻