{"id":23299021,"url":"https://github.com/mcnamee/graphql-server-boilerplate","last_synced_at":"2025-08-22T03:32:57.565Z","repository":{"id":42355445,"uuid":"175349718","full_name":"mcnamee/graphql-server-boilerplate","owner":"mcnamee","description":"A boilerplate NodeJS GraphQL server, built on GraphQL-Yoga and Prisma","archived":false,"fork":false,"pushed_at":"2023-01-23T22:24:23.000Z","size":1717,"stargazers_count":9,"open_issues_count":18,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T22:08:04.527Z","etag":null,"topics":["boilerplate","graphql","graphql-yoga","nodejs","prisma","prisma-client"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcnamee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-13T05:03:37.000Z","updated_at":"2023-10-01T21:19:35.000Z","dependencies_parsed_at":"2023-02-02T21:01:31.446Z","dependency_job_id":null,"html_url":"https://github.com/mcnamee/graphql-server-boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mcnamee/graphql-server-boilerplate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcnamee%2Fgraphql-server-boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcnamee%2Fgraphql-server-boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcnamee%2Fgraphql-server-boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcnamee%2Fgraphql-server-boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcnamee","download_url":"https://codeload.github.com/mcnamee/graphql-server-boilerplate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcnamee%2Fgraphql-server-boilerplate/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271579450,"owners_count":24784252,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-22T02:00:08.480Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["boilerplate","graphql","graphql-yoga","nodejs","prisma","prisma-client"],"created_at":"2024-12-20T08:14:00.114Z","updated_at":"2025-08-22T03:32:57.066Z","avatar_url":"https://github.com/mcnamee.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GraphQL Server Boilerplate\n\nA boilerplate GraphQL server with:\n\n- [GraphQL Yoga](https://github.com/prisma/graphql-yoga) for a Scalable GraphQL server (based on based on Apollo Server \u0026 Express)\n- [Prisma](https://www.prisma.io/) for a GraphQL database ORM (running on MySQL)\n- [GraphQL Playground](https://github.com/prisma/graphql-playground)\n- [Nodemon](https://github.com/remy/nodemon) to automatically restart the server when code changes are made\n- [Dotenv](https://github.com/motdotla/dotenv) to handle environment variables\n- JWT Authentication built in\n- Example models for Users and Posts\n\n---\n\n## Requirements\n\n- Node, NPM and *Yarn*\n- Prisma CLI installed globally - `yarn global add prisma`\n- Docker and Docker Compose (installed and running)\n\n---\n\n## Getting Started (local dev)\n\n```sh\n# --- Prisma Server --- #\n\n# 1. Start up a local Prisma Server and DB via Docker (https://bit.ly/2JpRbQf)\ndocker-compose up -d\n\n# 2. Copy `.env.example` to `.env` and add your new DB endpoint and update the keys\ncp .env.example .env \u0026\u0026 nano .env\n\n# 3. Deploy the data models to your local Prisma server\nyarn prisma-deploy-dev\n\n# --- GraphQL Server --- #\n\n# 4. Install dependencies\nyarn install\n\n# 5. Start GraphQL server (runs playground on http://localhost:4000)\nyarn start\n```\n\n---\n\n## Deploying to Production\n\n```sh\n# --- Prisma Server --- #\n\n# 1. Setup a Production Prisma Server\n#    - Heroku - https://bit.ly/2THPbYk\n#    - Digital Ocean - https://bit.ly/2JdM713\n#    - AWS EC2 - https://bit.ly/2TEcces\n#    - AWS Fargate - https://bit.ly/2FdFGqV\n\n# 2. Add the respective Environment variables to .env.prod\ncp .env.example .env.prod \u0026\u0026 nano .env.prod\n\n# 3. Deploy the data models to the production Prisma server\nyarn prisma-deploy-prod\n\n# --- GraphQL Server --- #\n\n# 4. Deploy the GraphQL Server to\n#    - Now.sh - https://bit.ly/2HvNXrC\n#    - Heroku - https://bit.ly/2FcIbtl\n#    - OR Serverless AWS Lambda (does not support subscriptions):\n\n# First setup an AWS IAM user to get your keys - https://bit.ly/2TJDcsq\nexport AWS_ACCESS_KEY_ID=\u003csecret\u003e\nexport AWS_SECRET_ACCESS_KEY=\u003csecret\u003e\nyarn graphql-deploy-serverless\n\n# 5. Add the environment variables from .env.prod\n#    - For AWS Lambda:\n#      - Login to the AWS console \u003e Lambda and browse to the function/s\n#      - Add each of the variables from `.env` in the 'Environment variables' section of each function\n```\n\n---\n\n## Commands\n\n|| Command | Description |\n| --- | --- | --- |\n| **Prisma Server** |\n|| `yarn prisma-start` | **Starts** the local Prisma server and database |\n|| `yarn prisma-stop` | **Stops** the local Prisma server and database |\n|| `yarn prisma-deploy-dev` | **Deploys** Prisma server to using `.env` |\n|| `yarn prisma-deploy-prod` | **Deploys** Prisma server to using `.env.prod` |\n| **GraphQL Server** |\n|| `yarn graphql-start` | **Starts** the GraphQL-Yoga server |\n|| `yarn graphql-start-debug` | **Starts** the GraphQL-Yoga server in debug mode |\n|| `yarn graphql-deploy-serverless` | **Deploys** GraphQL server to Serverless (Lambda) |\n| **Tests** |\n|| `yarn test` | **Tests** GraphQL server |\n\n---\n\n## File Structure\n\n```\n/prisma/                # Prisma database service configuration\n    /generated/         # Generated files from the `prisma generate` command\n    /datamodel.prisma   # Defines the database structure (written in GraphQL SDL)\n    /prisma.yml         # The root configuration file for your Prisma database service\n    /seed.graphql       # The database seed\n/src/                   # The source files for your GraphQL server\n    /Helpers/           # Helper functions\n    /Resolvers/         # All Resolvers for the application schema\n        /Models/        # Updates to data model queries (eg. adding a property to a response)\n        /Mutation/      # Custom mutations (eg. sign up, login...)\n        /Query/         # Custom queries (eg. me)\n        /Subscription/  # Define the data that can be subscribed to\n    /index.js           # The entry point for your GraphQL server\n    /schema.graphql     # The schema defining the API exposed to client applications\n```\n\n---\n\n## Available Queries \u0026 Mutations\n\n### User / Authentication\n\n\u003cdetails\u003e\u003csummary\u003eSign Up\u003c/summary\u003e\n\u003cp\u003e\n\n```\nmutation {\n  signup(\n    email: \"zeus@examples.com\"\n    password: \"secret42\"\n    firstName: \"Zeus\"\n    lastName: \"Zellot\"\n  ) {\n    token\n    user {\n      id\n      firstName\n      lastName\n      email\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eLogin\u003c/summary\u003e\n\u003cp\u003e\n\n```\nmutation {\n  login(\n    email: \"zeus@examples.com\"\n    password: \"secret42\"\n  ) {\n    token\n    user {\n      email\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eUpdate My Account\u003c/summary\u003e\n\u003cp\u003e\n\n```\nmutation {\n  updateUser(\n    email: \"zeus@example.com\"\n    firstName: \"Jane\"\n    lastName: \"Doe\"\n    password: \"123Abc123Abc\"\n  ) {\n    id\n    firstName\n    lastName\n    email\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eMe\u003c/summary\u003e\n\u003cp\u003e\n\n*Requires `\"Authorization\": \"Bearer ...\"` header*\n\n```\nquery {\n  me {\n    id\n    firstName\n    lastName\n    email\n    posts {\n      title\n      published\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eForgot Password (send password reset email)\u003c/summary\u003e\n\u003cp\u003e\n\n```\nmutation {\n  forgotPassword(\n    email: \"alice@prisma.io\"\n  ) {\n    message\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eReset Password (using token from email)\u003c/summary\u003e\n\u003cp\u003e\n\n```\nmutation {\n  resetPassword(\n    resetToken: \"v0db287br2atjvfsrc4wl\"\n    password: \"secret42\"\n  ) {\n    token\n    user {\n      id\n      name\n      email\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eVerify Email (using token from email)\u003c/summary\u003e\n\u003cp\u003e\n\n```\nmutation {\n  verifyEmail(\n    emailVerifiedToken: \"v0db287br2atjvfsrc4wl\"\n  ) {\n    id\n    name\n    email\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n### Post\n\n\u003cdetails\u003e\u003csummary\u003eCreate a (draft) Post\u003c/summary\u003e\n\u003cp\u003e\n\n*Requires `\"Authorization\": \"Bearer ...\"` header*\n\n```\nmutation {\n  createDraft(\n    title: \"New Draft Post\"\n    content: \"Hello new post that's not posted yet\"\n  ) {\n    id\n    title\n    content\n    author {\n      firstName\n      lastName\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eList Posts - List of All Published Posts\u003c/summary\u003e\n\u003cp\u003e\n\n```\nquery {\n  listPosts {\n    id\n    title\n    content\n    author {\n      firstName\n      lastName\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eList Posts - List of My Drafted Posts\u003c/summary\u003e\n\u003cp\u003e\n\n*Requires `\"Authorization\": \"Bearer ...\"` header*\n\n```\nquery {\n  listDraftPosts {\n    id\n    title\n    content\n    author {\n      firstName\n      lastName\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eRead a Post\u003c/summary\u003e\n\u003cp\u003e\n\n```\nquery {\n  post(id: \"cjt74m7fy06at0b18gk07p7ks\") {\n    id\n    title\n    content\n    author {\n      firstName\n      lastName\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eUpdate a Post (one of my draft Posts to be Published)\u003c/summary\u003e\n\u003cp\u003e\n\n*Requires `\"Authorization\": \"Bearer ...\"` header*\n\n```\nmutation {\n  publish(id: \"cjt6q05lh2qi70b45gkux1gfv\") {\n    id\n    title\n    content\n    published\n    author {\n      firstName\n      lastName\n    }\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eDelete a Post (one that I own)\u003c/summary\u003e\n\u003cp\u003e\n\n*Requires `\"Authorization\": \"Bearer ...\"` header*\n\n```\nmutation {\n  deletePost(id: \"cjt6q6des2shk0b45gtusvd9d\") {\n    id\n    title\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003eSubscribe to new Posts (not supported by Lambda yet)\u003c/summary\u003e\n\u003cp\u003e\n\n```\nsubscription {\n  feedSubscription {\n    id\n    title\n  }\n}\n```\n\u003c/p\u003e\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcnamee%2Fgraphql-server-boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcnamee%2Fgraphql-server-boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcnamee%2Fgraphql-server-boilerplate/lists"}