This codebase is a boiler plate for GraphQL using TypeScript and MongoDB. It is built using Apollo Server and TypeScript. It also uses Codegen to generate types for GraphQL queries and mutations. It uses MongoDB as the database and and Mocha as the testing framework.
To get started, you will need to create a .env
file in the root directory of this project. This file will contain the environment variables as declared in envs.ts
, this file serves as the single source of truth for environment variables. As a result the use of process.env
outside of this file is discouraged.
To run this project locally, you will need to have a local instance of MongoDB and redis running. You can do this by either installing MongoDB locally or by running a docker container. To run a docker container, run the following command:
docker run -d -p 27017:27017 --name node-gql-boilerplate mongo
Once you have a local instance of MongoDB running, you can run the following commands to start the project:
yarn install
To generate graphql types after making changes to the schema, run the following command:
yarn generate
To run the project in development mode, run the following command:
yarn dev
yarn build && yarn start
yarn docker:build && yarn docker:run
yarn test
yarn docker:test
Built with ❤️ by Babatunde Koiki