{"id":18614754,"url":"https://github.com/andrewjbateman/next-apollo-graphql","last_synced_at":"2026-04-18T04:33:23.624Z","repository":{"id":39962506,"uuid":"250543007","full_name":"AndrewJBateman/next-apollo-graphql","owner":"AndrewJBateman","description":":clipboard: Next.js app using graphQL with Apollo to retrieve API data.","archived":false,"fork":false,"pushed_at":"2024-05-02T03:56:09.000Z","size":3369,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T01:12:33.188Z","etag":null,"topics":["apollo-graphql","graphql","next12","nextjs","postgresql-database","react","react17","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/AndrewJBateman.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":"2020-03-27T13:34:25.000Z","updated_at":"2023-12-16T15:31:52.000Z","dependencies_parsed_at":"2024-11-07T03:40:53.825Z","dependency_job_id":null,"html_url":"https://github.com/AndrewJBateman/next-apollo-graphql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AndrewJBateman/next-apollo-graphql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnext-apollo-graphql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnext-apollo-graphql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnext-apollo-graphql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnext-apollo-graphql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndrewJBateman","download_url":"https://codeload.github.com/AndrewJBateman/next-apollo-graphql/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndrewJBateman%2Fnext-apollo-graphql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31956995,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"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":["apollo-graphql","graphql","next12","nextjs","postgresql-database","react","react17","typescript"],"created_at":"2024-11-07T03:26:49.709Z","updated_at":"2026-04-18T04:33:23.602Z","avatar_url":"https://github.com/AndrewJBateman.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :zap: Next Apollo GraphQL\n\n* A Next.js React app using Apollo GraphQL to get data from an API.\n* **Note:** to open web links in a new window use: _ctrl+click on link_\n\n![GitHub repo size](https://img.shields.io/github/repo-size/AndrewJBateman/next-apollo-graphql?style=plastic)\n![GitHub pull requests](https://img.shields.io/github/issues-pr/AndrewJBateman/next-apollo-graphql?style=plastic)\n![GitHub Repo stars](https://img.shields.io/github/stars/AndrewJBateman/next-apollo-graphql?style=plastic)\n![GitHub last commit](https://img.shields.io/github/last-commit/AndrewJBateman/next-apollo-graphql?style=plastic)\n\n## :page_facing_up: Table of contents\n\n* [:zap: Next Apollo GraphQL](#zap-next-apollo-graphql)\n  * [:page\\_facing\\_up: Table of contents](#page_facing_up-table-of-contents)\n  * [:books: General Info](#books-general-info)\n  * [:camera: Screenshots](#camera-screenshots)\n  * [:signal\\_strength: Technologies](#signal_strength-technologies)\n  * [:floppy\\_disk: Setup](#floppy_disk-setup)\n  * [:computer: Code Examples](#computer-code-examples)\n  * [:clipboard: Status \\\u0026 To-Do List](#clipboard-status--to-do-list)\n  * [:clap: Inspiration](#clap-inspiration)\n  * [:file\\_folder: License](#file_folder-license)\n  * [:envelope: Contact](#envelope-contact)\n\n## :books: General Info\n\n* Previously displayed data from the [Netlify fruits API](https://fruits-api.netlify.app/graphql) but this is no longer live. [The API](https://github.com/Franqsanz/fruits-api/blob/main/readme.md) is now down.\n* Next.js is for server-rendered react apps. It has automatic code splitting, simple page-based routing, built-in CSS support and hot reloading. Every component file in the pages folder is treated as a page.\n* Apollo Client used to fetch data using GraphQL.\n* GraphQL only return the data requested. Data only served from a single end-point. Lots of companies use it. GraphQL makes tasks more complex and there are possible performance issues that would not occur using REST with a web cache.\n* Tailwind CSS added to Next.js\n* Picsum API random photo is displayed\n* Latest Next/Image optimisation used so image downloaded as Webp format and automatically sized. This is a major advantage over non-optimised Images.\n* Converted to Progressive Web App (PWA).\n* Custom Document file ./pages/_document.js created to override and extend default Document. It injects meta tags into every page\n\n## :camera: Screenshots\n\n![Example screenshot](./imgs/list.png).\n\n## :signal_strength: Technologies\n\n* [Node.js v18](https://nodejs.org/) javascript runtime using the [Chrome V8 engine](https://v8.dev/).\n* [React v18](https://reactjs.org/) Javascript library.\n* [GraphQL v16](https://github.com/graphql/graphql-js)\n* [Apollo v3](https://www.apollographql.com/) GraphQL implementation data graph layer\n* [Next v13](https://nextjs.org/) minimalist framework for rendering react apps on the server. Only v12.2.2 works, higher version causes errors.\n* [Next with Apollo v5](https://www.npmjs.com/package/next-with-apollo) to save coding time\n* [Apollo Client v3](https://www.npmjs.com/package/apollo-client) caching GraphQL client to UI components can fetch data via GraphQL. More documentation [here](https://apollographql.com/docs/react/).\n* [Picsum API image](https://picsum.photos/images). No API key required, image size can be specified in url\n\n## :floppy_disk: Setup\n\n* `npm run codegen` to run codegen to generate output to `generated/index.tsx`\n* `npm run dev` runs the app in the development mode. Open [http://localhost:3000](http://localhost:3000) to view it in the browser.\n* `npm run build` builds the app for production to the `build` folder. It correctly bundles React in production mode and optimizes the build for the best performance. The build is minified and the filenames include the hashes.\n\n## :computer: Code Examples\n\n* `withApollo` function to return instance of Apollo client\n\n```tsx\nconst withApollo = nextWithApollo(\n\n  ({ initialState, headers }) =\u003e {\n    return new ApolloClient({\n      ssrMode: typeof window === \"undefined\",\n      link: new HttpLink({\n        uri: \"https://rickandmortyapi.com/graphql\",\n      }),\n      headers: {\n        ...(headers as Record\u003cstring, string\u003e),\n      },\n      cache: new InMemoryCache().restore(initialState || {}),\n    });\n  },\n  {\n    // eslint-disable-next-line react/display-name\n    render: ({ Page, props }) =\u003e {\n      // eslint-disable-next-line react-hooks/rules-of-hooks\n      const router = useRouter();\n      return (\n        \u003cApolloProvider client={props.apollo}\u003e\n          \u003cPage {...props} {...router} /\u003e\n        \u003c/ApolloProvider\u003e\n      );\n    },\n  }\n);\n```\n\n## :clipboard: Status \u0026 To-Do List\n\n* Status: Working\n* To-Do: Update sitemap, robots files. Add styles\n\n## :clap: Inspiration\n\n* [TomDoesTech: Apollo Client (3) in Next.js (10) with TypeScript \u0026 GraphQL Code Generator](https://www.youtube.com/watch?v=4yDrtFUbUzo\u0026t=415s)\n* [How to Loop in React JSX](https://stackabuse.com/how-to-loop-in-react-jsx/)\n\n## :file_folder: License\n\n* N/A\n\n## :envelope: Contact\n\n* Repo created by [ABateman](https://github.com/AndrewJBateman), email: gomezbateman@yahoo.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnext-apollo-graphql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewjbateman%2Fnext-apollo-graphql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewjbateman%2Fnext-apollo-graphql/lists"}