What's included • Getting Started • Apollo usage • Testing
- Latest Next.js version with App Router.
- GraphQL Apollo client with @apollo/client-integration-nextjs.
- Works with React Server Components and React Client Components (with or without SSR).
- TypeScript environment.
- Normalize.css included.
- No custom server.
- Testing environment via Vitest and @testing-library/react.
- Configured GraphQL Code Generator.
- Prettier for code formatting.
- ESLint for linting.
- Node.js 18.x or later
- npm (or yarn/pnpm)
- Clone the repository:
git clone git@github.com:nikitowsky/next-advanced-apollo-starter.git
cd next-advanced-apollo-starter- Install dependencies:
npm install- Create a
.env.localfile with your GraphQL endpoint:
# Example URI, use link to your GraphQL API
NEXT_PUBLIC_GRAPHQL_URI=https://graphqlzero.almansi.me/api- Start the development server:
npm run devFor more information, see Next.js documentation.
Generated interfaces for co-located .graphql files. See the example.
To generate TypeScript interfaces based on GraphQL schema and used queries/mutations:
npm run codegenThis project uses Vitest for testing. To run tests:
npm run testFor more about project structure, React Server Components (RSC), React Client Components (RCC), etc., see the official Next.js documentation.