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 clone
npm i
- Copy
.env.example
to.env
- Maintain DB url in prisma file (see this section why)
docker-compose up
npm run migrate
to apply DB schema- (Optional)
npm run seed
to 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! 👋🏻