Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Next.js
  3. Next With Apollo

Next With Apollo

MITTypeScript5.3.0

A higher-order component (HOC) that integrates Apollo Client with Next.js for seamless GraphQL data fetching.

GitHubGitHub
761 stars76 forks0 contributors

What is Next With Apollo?

next-with-apollo is a higher-order component (HOC) that integrates Apollo Client with Next.js applications. It simplifies setting up GraphQL data fetching by wrapping pages with ApolloProvider, supporting both client-side and server-side rendering. The library helps developers manage Apollo Client configuration while preserving Next.js optimizations like Automatic Static Optimization.

Target Audience

Next.js developers building applications that require GraphQL data fetching with Apollo Client, especially those needing SSR or static generation support.

Value Proposition

Developers choose next-with-apollo for its straightforward API that reduces boilerplate when combining Apollo Client and Next.js. It offers flexibility in configuration, maintains Next.js performance features by default, and provides clear migration paths across different Next.js versions.

Overview

Apollo HOC for Next.js

Use Cases

Best For

  • Adding Apollo Client to Next.js pages without manual provider setup
  • Implementing server-side rendered GraphQL queries in Next.js applications
  • Wrapping the entire Next.js app with Apollo Provider via _app.js
  • Maintaining Automatic Static Optimization while using Apollo Client
  • Migrating Apollo Client integration across different Next.js versions
  • Configuring Apollo Client with access to SSR context like headers and initialState

Not Ideal For

  • Projects that prioritize maximum static optimization and avoid any server-side rendering for GraphQL queries
  • Teams using data fetching alternatives like React Query or SWR instead of Apollo Client
  • Applications built with Next.js App Router or newer features not covered in the library's version support
  • Developers who prefer to avoid higher-order components in favor of hooks-only setups for Apollo integration

Pros & Cons

Pros

Simplified Apollo Integration

It reduces boilerplate by providing a HOC that automatically wraps pages with ApolloProvider, as shown in the basic setup example using apollo-boost.

SSR Flexibility

Supports optional getDataFromTree configuration for server-side rendering of GraphQL queries, enabling SEO-friendly pages without loading states, detailed in the API section.

Preserves Static Optimization

Maintains Next.js Automatic Static Optimization by default unless explicitly overridden with SSR settings, which the README emphasizes to avoid unnecessary lambda functions.

Version Compatibility Guidance

Offers clear versioning for different Next.js releases, such as specifying v3.4.0 for Next v6-v8, helping developers avoid migration issues.

Cons

SSR Performance Trade-off

Enabling getDataFromTree disables Automatic Static Optimization, turning pages into serverless functions and potentially slowing initial renders, as warned in the README's performance notes.

Manual Error Handling Burden

Errors during SSR are silently ignored unless the onError callback is provided, adding complexity for developers who need robust error management in production.

Dependency on Apollo Stability

The library's utility is tied to Apollo Client's API; breaking changes in Apollo or Next.js may require updates or cause compatibility issues, as seen in the migration guide from version 4.3.0.

Frequently Asked Questions

Quick Stats

Stars761
Forks76
Contributors0
Open Issues25
Last commit2 years ago
CreatedSince 2018

Tags

#data-fetching#graphql#server-side-rendering#nextjs#higher-order-component#react-hooks#apollo-client

Built With

N
Next.js
R
React
N
Node.js
A
Apollo Client

Included in

Next.js11.1k
Auto-fetched 1 day ago

Related Projects

CopilotKitCopilotKit

The Frontend Stack for Agents & Generative UI. React, Angular, Mobile, Slack, and more. Makers of the AG-UI Protocol

Stars38,168
Forks4,758
Last commit1 day ago
next-authnext-auth

Authentication for the Web.

Stars28,367
Forks4,029
Last commit3 months ago
ai-sdkai-sdk

The AI Toolkit for TypeScript. From the creators of Next.js, the AI SDK is a free open-source library for building AI-powered applications and agents

Stars27,439
Forks5,409
Last commit1 day ago
Next SEONext SEO

Next SEO is a plug in that makes managing your SEO easier in Next.js projects.

Stars8,530
Forks465
Last commit2 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub