modern-graphql-starter
Introduction
This is a starter project for a modern graphql federation. It is optimized for 1 minute CI/CD, tests included, find out how here. The main principles are:
- Fast iteration: Several sources [1] [2] [3] tell us that iteration speed is the main predictor of developer productivity. This project tries to achieve 1 minute from push to deployment.
- Light dependencies: Each package installed brings benefits, but also costs. This project tries to keep the dependencies to a minimum.
- Testing trophy: A passing test suite should give the engineer a high credence that the code is production ready. This project try to achieve that by inverting the classical testing pyramid, preferring a testing trophy instead.
Read more about the project design here.
Table of Contents
Prerequisites
This project has been tried on linux. It should work on other platforms, but it has not been tested.
- Setup yarn v4, as explained here:
nvm use
corepack enable
corepack prepare yarn@canary --activate
Also copy the .env.example
file to .env
and fill in the values.
cp infra/.env.example infra/.env
You need a modern docker version to run this, check more here.
Installation
yarn install
Running the app
Start the lint with:
yarn lint:setup
Start the app with:
yarn dev:watch
Then visit:
- http://localhost:4000/graphql: Federation router
- http://localhost:4001/graphql:
ocm-service
graphql instance - https://localhost:8443/:
etl-service
worker
Make sure your schema is updated with:
yarn graphql:generate
Apollo router will automatically pick the changes thanks to hot module reloading.
Testing
Make sure your infra is running with
yarn dev:infra
Then run the tests with:
yarn dev:test
You can also run tests with:
yarn test:all
TODOS
- Use yarn cache in containers