Skip to content

rjdmacedo/federated-nexus-prisma-subgraph-template

Repository files navigation

Federated Subgraph using Prisma and Nexus

All Contributors

contributions welcome styled with prettier renovate badge Donate

This starter project makes creating Apollo Federated subgraphs with Prisma.io and GraphQL Nexus a breeze.

Usage

Usage

git clone https://github.com/RafaelMLMacedo/federated-nexus-prisma-subgraph-template.git YOUR_FOLDER_NAME
cd YOUR_FOLDER_NAME

yarn install

Create a .env and a prisma.env

$ cp .env.example .env
$ cp prisma/.env.example prisma/.env

Start coding! package.json and entry files are already set up for you, so don't worry about linking to your main file, typings, etc. Just keep those files with the same name.

Features

  • Zero-setup. After running yarn install things will set up for you 😉
  • Postgres database out of the box
  • Tests, coverage and interactive watch mode using Jest
  • Prettier and TSLint for code formatting and consistency
  • Docs automatic generation and deployment to gh-pages, using TypeDoc
  • Automatic types (*.d.ts) file generation
  • docker-compose.yml deploys a postgres database to persist your development data without hassle.
  • Using Commitizen and Husky (for the git hooks)

NPM scripts

  • yarn preinstall: Checks if you're using yarn or NPM. If you're using NPM, an error is thrown
  • yarn prepare: Installs (husky hooks)
  • yarn clean: Deletes the ./generated folder
  • yarn lint: Lints the code to improve consistency
  • yarn build: Deletes the ./generated folder, generates Prisma and Nexus typings and executes the TypeScript tsc
  • yarn dev: Starts a server on port 4001 (if no other value for SERVER_PORT is provided on ./.env file)
  • dev:type:check: Checks for TypeScript errors on the fly, watching you're changes.
  • yarn database:compose: Runs the docker-compose up -d that deploys the postgres database
  • yarn prisma:migrate:dev: Create migrations from your Prisma schema, apply them to the database, generate artifacts (e.g. Prisma Client)
  • yarn prisma:migrate:deploy: If there are any changes locally and the database, prisma will deploy your changes to the database.
  • yarn prisma:migrate:reset: Reset your database and apply all migrations
  • yarn generate: Generates Prisma artifacts and
  • yarn test: Jest runs your *.(spec|test).(ts|tsx|js) as the chosen suite to develop with confidence.

Semantic commits 🚓

From now on, you'll need to use npm run commit, which is a convenient way to create conventional commits.

Follow conventional commit messages

Git Hooks 🎣

There is already set a pre-commit hook for formatting your code with Prettier 💅

Contributors ✨

Thanks goes to these wonderful people (emoji key):

This project follows the all-contributors specification. Contributions of any kind welcome!