Type definitions in GraphQL SDL for our database. These types are roughly translated as SQL tables by Prisma.
Prisma configuration file. Learn more about it here.
Initial values that will be loaded in our database by Prisma.
GraphQL schema directives can be defined in this directory. We use them for authentication.
Custom error definitions can be placed here. They should all inherit the default
ApolloError provided in order to keep consistency.
This folder will contain all the GraphQL generated schema. Specifically, our database schema generated by Prisma will be downloaded here and will be consumed by
Express.js middleware is located here. Middleware runs right after a request is received and before GraphQL resolvers start. It is a good place to check authentication tokens.
Every type in our app should have a model that defines all its actions such as
publishItem, etc. This is where most of the DB-interaction logic lives. Ownership checks can be done here.
Contains all the GraphQL resolvers for queries, mutations and subscriptions. Think of resolvers as thin controllers that call actions defined in models.
Our server's API definition (not our database!) lives here in shape of GraphQL SDL. We separate every GraphQL entity in a different file: types, directives, inputs, scalars, etc. The
index.graphql will contain the queries and mutations.
Several utility functions.
Exports the database connection object that can be used in resolvers or any other service.
Manages configurations specific to
apollo-server-express) such as subscriptions, mocks, Apollo engine, etc.
Exports the PubSub implementation for GraphQL subscriptions. By default, an in-memory PubSub is used for development but can be easily updated when scaling the project (Redis, RabbitMQ, etc.).
Main entry point of our server. Connects all the previous pieces and starts the HTTP server.
Configuration for our GraphQL development environment. More info here.