{"id":23635428,"url":"https://github.com/adamsoffer/next-apollo-example","last_synced_at":"2025-04-05T09:08:38.081Z","repository":{"id":15493701,"uuid":"78259697","full_name":"adamsoffer/next-apollo-example","owner":"adamsoffer","description":"Next \u0026 Apollo Example","archived":false,"fork":false,"pushed_at":"2023-02-27T16:38:38.000Z","size":2631,"stargazers_count":437,"open_issues_count":9,"forks_count":63,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-04-14T13:13:10.028Z","etag":null,"topics":["apollo","graphql","nextjs","react"],"latest_commit_sha":null,"homepage":"https://next-with-apollo.vercel.app/","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/adamsoffer.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":"2017-01-07T05:04:22.000Z","updated_at":"2023-06-07T12:56:13.000Z","dependencies_parsed_at":"2024-12-28T05:34:24.577Z","dependency_job_id":"4a572960-b478-437a-871e-64940a11e261","html_url":"https://github.com/adamsoffer/next-apollo-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamsoffer%2Fnext-apollo-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamsoffer%2Fnext-apollo-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamsoffer%2Fnext-apollo-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adamsoffer%2Fnext-apollo-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adamsoffer","download_url":"https://codeload.github.com/adamsoffer/next-apollo-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312081,"owners_count":20918344,"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","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","nextjs","react"],"created_at":"2024-12-28T05:34:21.940Z","updated_at":"2025-04-05T09:08:38.041Z","avatar_url":"https://github.com/adamsoffer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next \u0026 Apollo Example [![Build Status](https://travis-ci.org/adamsoffer/next-apollo-example.svg?branch=master)](https://travis-ci.org/adamsoffer/next-apollo-example)\n\nThis example utilizes the [next-apollo](https://www.npmjs.com/package/next-apollo) package which is ideal if you want to tuck away some of the ceremony involved when using Apollo in your Next.js app. It also features my preferred CSS-in-JS solution, [Emotion](https://emotion.sh/).\n\n[Demo](https://next-with-apollo.vercel.app/)\n\n## How to use\n\nInstall it and run\n\n```bash\nnpm install\nnpm run dev\n```\n\nDeploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download))\n\n```bash\nnow\n```\n\n## The idea behind the example\n\nApollo is a GraphQL client that allows you to easily query the exact data you need from a GraphQL server. In addition to fetching and mutating data, Apollo analyzes your queries and their results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run, fetching more results from the server.\n\nIn this simple example, we integrate Apollo seamlessly with Next by wrapping our _pages_ inside a [higher-order component (HOC)](https://facebook.github.io/react/docs/higher-order-components.html). Using the HOC pattern we're able to pass down a central store of query result data created by Apollo into our React component hierarchy defined inside each page of our Next application.\n\nOn initial page load, while on the server and inside `getInitialProps`, we invoke the Apollo method, [`getDataFromTree`](http://dev.apollodata.com/react/server-side-rendering.html#getDataFromTree). This method returns a promise; at the point in which the promise resolves, our Apollo Client store is completely initialized.\n\nThis example relies on [Prisma + Nexus](https://github.com/prisma-labs/nextjs-graphql-api-examples) for its GraphQL backend.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamsoffer%2Fnext-apollo-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadamsoffer%2Fnext-apollo-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadamsoffer%2Fnext-apollo-example/lists"}