{"id":21758924,"url":"https://github.com/anshul-sonpure/graphql-api-tutorial","last_synced_at":"2026-04-14T06:33:43.957Z","repository":{"id":184427989,"uuid":"671862673","full_name":"Anshul-Sonpure/GraphQL-API-Tutorial","owner":"Anshul-Sonpure","description":"Learn GraphQL for modern APIs. Efficient data fetching \u0026 updates. Compare to REST \u0026 SOAP. Hands-on tutorial building GraphQL API with popular frameworks. Revolutionize app development. Happy coding!","archived":false,"fork":false,"pushed_at":"2023-08-24T08:43:51.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-14T12:41:31.850Z","etag":null,"topics":["api-development","express-graphql","graphql","nodejs"],"latest_commit_sha":null,"homepage":"https://medium.com/@theautobot/mastering-graphql-for-modern-api-development-step-by-step-guide-61c504a45030","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Anshul-Sonpure.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-28T10:07:23.000Z","updated_at":"2023-07-28T11:12:22.000Z","dependencies_parsed_at":"2025-01-26T00:33:15.660Z","dependency_job_id":"aa76beb5-79d6-4a62-83cc-df5207c8fc91","html_url":"https://github.com/Anshul-Sonpure/GraphQL-API-Tutorial","commit_stats":null,"previous_names":["anshul-sonpure/graphql-api-tutorial"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Anshul-Sonpure/GraphQL-API-Tutorial","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anshul-Sonpure%2FGraphQL-API-Tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anshul-Sonpure%2FGraphQL-API-Tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anshul-Sonpure%2FGraphQL-API-Tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anshul-Sonpure%2FGraphQL-API-Tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Anshul-Sonpure","download_url":"https://codeload.github.com/Anshul-Sonpure/GraphQL-API-Tutorial/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Anshul-Sonpure%2FGraphQL-API-Tutorial/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31785677,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-14T02:24:21.117Z","status":"ssl_error","status_checked_at":"2026-04-14T02:24:20.627Z","response_time":153,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["api-development","express-graphql","graphql","nodejs"],"created_at":"2024-11-26T11:24:37.290Z","updated_at":"2026-04-14T06:33:43.942Z","avatar_url":"https://github.com/Anshul-Sonpure.png","language":"JavaScript","readme":"\n## _GraphQL API Tutorial_\n\n### Introduction to GraphQL\n\nGraphQL is a query language and runtime for APIs that was developed by Facebook in 2012 and later released as an open-source project. It provides a more efficient, powerful, and flexible alternative to traditional REST APIs. GraphQL allows clients to request precisely the data they need, and nothing more, making it ideal for building modern web and mobile applications.\n\n### What is GraphQL?\n\nGraphQL is a query language for your API, enabling clients to request the exact data they need and get predictable results. It allows developers to define the structure of the data they want to retrieve and allows them to interact with the API in a more intuitive way.\n\n## Use of GraphQL\n\n- Efficient Data Fetching: Clients can request only the data they need, reducing the amount of data transferred over the network.\n- Single Endpoint: Unlike REST APIs that have multiple endpoints for different resources, GraphQL has a single endpoint for all data requests.\n- Strongly Typed: GraphQL schemas are strongly typed, which enables better tooling, autocompletion, and error checking.\n- Rapid Development: With GraphQL, frontend and backend teams can work independently, as the schema acts as a contract between them.\n- Versioning: Since clients specify the data they need, changes to the API won't break existing clients.\n\n### Benefits of GraphQL over REST and SOAP\n\n- Reduced Overfetching: GraphQL allows clients to request only the fields they need, eliminating overfetching of data.\n- Elimination of Underfetching: Clients can get all the required data in a single request, reducing the number of round trips to the server.\n- No Versioning: Since the schema serves as a contract between clients and the server, there's no need for versioning the API.\n- Introspection: GraphQL provides introspection, allowing clients to discover the schema and available operations.\n- Real-time Updates: GraphQL supports subscriptions, enabling real-time updates from the server.\n\n### Key Concepts of GraphQL\n\n- Schema: A GraphQL schema defines the data structure and types that clients can query. It includes objects, fields, and relationships between them.\n- Query: The query is used to request data from the server. Clients can specify what data they need and the shape of the response they expect.\n- Mutation: Mutations are used to modify data on the server, such as creating, updating, or deleting records.\n- Resolver: Resolvers are functions that define how to fetch the data for each field in a GraphQL schema. They are responsible for retrieving the data from the data source.\n- Subscription: Subscriptions allow clients to receive real-time updates from the server when specific events occur.\n\nThe Endpoint is hosted on Render: Cloud Application Hosting application\u003cbr\u003e \nTo access the endpoint --\u003e https://graphql-api-ppql.onrender.com/graphql\u003cbr\u003e \nFor now we have userdata having firstName,lastName,gender,ipaddress.\nAnd we have \n1. query -- getallUsers, here you can query as per your need.\n2. mutation -- createUser, here you can create a user with your data.\n\n### To Deploy locally\nFirst Clone the repo, and open the workspace in Visual Code. Open Terminal and enter below command:\n```sh\nnpm install express graphql express-graphql\nnpm start\n```\nApplication will start on Port 8085, use the endpoint '/graphql' and you will see the graphql ui.\nNow play around send your queries or mutations.\n\n### Query and Mutation Commands--\nSignUp Query:\nUse this query to simulate a user signUp and get the username and authToken.\n\n```\nmutation {\n  signUp(username: \"AdminUser1\", password: \"Admin@User1\") {\n    username\n    authToken\n  }\n}\n\n```\nThe response will look something like:\n```\n{\n  \"data\": {\n    \"login\": {\n      \"username\": \"AdminUser1\",\n      \"authToken\": \"your-generated-auth-token\"\n    }\n  }\n}\n\n```\nSign-In Query:\nUse this query to simulate a user sign-in with the username and authToken.\n```\nmutation {\n  signIn(username: \"AdminUser1\", authToken: \"your-generated-auth-token\")\n}\n\n```\nThe response will be:\n```\n{\n  \"data\": {\n    \"signIn\": \"Hello, AdminUser1!\"\n  }\n}\n\n```\nTo Query all users:\n```\nquery{\n  getAllUsers{\n    firstName,id\n  }\n}\n```\nTo Create a new user:\n```\nmutation{\n  createUser(firstName:\"Toby\",lastName:\"K\",gender:\"Male\",ipaddress:\"202.123.32.11\")\n  {firstName,id\n    \n  }\n}\n```\nTo Update a User:\n```\nmutation {\n  updateUser(id:24, firstName: \"Denver\") {\n    id\n    firstName\n    lastName\n    email\n    gender\n    ipaddress\n  }\n}\n```\n\nTo Delete a User:\n```\nmutation {\n  deleteUser(id: 1) {\n    id\n    firstName\n    lastName\n    email\n    gender\n    ipaddress\n  }\n}\n```\n\n### _Note_: \nYou can read my article here : https://medium.com/@theautobot/mastering-graphql-for-modern-api-development-step-by-step-guide-61c504a45030\n\nThank You\\\nHappy Coding,\\\nLearn,Code and Earn\\\nStay Safe and Stay Positive :)\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshul-sonpure%2Fgraphql-api-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanshul-sonpure%2Fgraphql-api-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshul-sonpure%2Fgraphql-api-tutorial/lists"}