Apollo Client
Industry-leading GraphQL client with normalized caching for TypeScript and React
Repository Health
Technical Analysis
Apollo Client is a comprehensive GraphQL client for TypeScript, JavaScript, React, Vue, Angular, and other frameworks, providing everything an application needs to fetch, cache, and update data from a GraphQL API. Its centerpiece is a normalized, in-memory cache that automatically keeps every query and mutation result consistent — updating any component observing affected data as soon as a mutation or subscription changes it, without manual cache-busting.
Beyond data fetching, Apollo Client bundles a link-based network layer (for batching, retries, auth, and error handling), optimistic UI helpers, local-state management, and official React hooks (useQuery, useMutation, useSubscription) that integrate cache state directly into component render cycles. It’s maintained by Apollo GraphQL and is one of the two dominant GraphQL client choices (alongside Relay) for production JavaScript applications.
What You Get
- A normalized in-memory cache (
InMemoryCache) that deduplicates and keeps entities consistent across every query/mutation - React hooks (
useQuery,useMutation,useSubscription,useLazyQuery) with built-in loading/error state - A composable
ApolloLinknetwork layer for auth headers, batching, retries, and error handling - Optimistic UI updates and automatic cache updates after mutations
- Local-state management for combining client-only state with remote GraphQL data in the same cache
- Official bindings/adapters beyond React, plus first-class TypeScript types generated from your schema
Common Use Cases
- Fetching and caching data from a GraphQL API in a React (or Vue/Angular) single-page application
- Building optimistic UI flows where mutations update the interface instantly before server confirmation
- Keeping multiple components in sync automatically when shared data changes via mutations or subscriptions
- Combining local client-only state (UI flags, drafts) with server data through the same query/cache layer
Under The Hood
Architecture The client is organized around src/core/ (including QueryManager.ts at ~1,840 lines, the central orchestrator that tracks in-flight queries, deduplicates requests, and notifies observers of cache changes) and src/cache/inmemory/inMemoryCache.ts (~610 lines), which implements the normalized cache using object identity fields (id/__typename by default, or custom keyFields) to store every entity once regardless of how many queries touched it. src/link/ implements the Apollo Link architecture — a chain-of-responsibility pattern where each link (HTTP, retry, error, auth) can inspect or transform the operation before passing it to the next link, terminating in an HTTP link that performs the actual network request. src/react/ layers hooks and context providers on top of this core, subscribing components to cache changes so useQuery results update reactively, while src/local-state/ and src/masking/ implement client-only fields and fragment data masking respectively. Tech Stack TypeScript, published as @apollo/client (a scoped package superseding the legacy unscoped apollo-client), with graphql as a peer dependency and Zen Observable/RxJS-adjacent observables internally for the subscription/link pipeline; the monorepo uses a private root package with per-target build outputs (CJS, ESM) under dist/. Code Quality Test coverage is extensive with 136+ .test.ts files under src/, covering the cache, query manager, links, and React hooks individually, backed by CI (CircleCI badge in the README) and a documented issue triage/community process (Discourse community link). API Design The hook-based API (useQuery(GET_ITEMS)) is deliberately close to native GraphQL syntax and requires minimal boilerplate to get a query rendering with loading/error handling, though correctly configuring cache normalization (keyFields, type policies) for complex schemas is where the learning curve rises.
Used by 13 apps in this directory
Amplication
Developer Tools · AI Code Assistants · Automation
Create production-ready backend services with your organization's standards baked in — generating NestJS, Prisma, and GraphQL code that you own and control.
Authgear
Authentication
Open-source, self-hostable authentication platform with passkeys, biometric login, SSO, MFA, and GraphQL admin API — a full Auth0/Clerk/Firebase alternative for SaaS and mobile apps.
GitLab
Devops · Developer Tools
The complete DevOps platform that unifies Git hosting, CI/CD, issue tracking, and security scanning into a single self-hostable application.
HeyForm
Forms Surveys · No Code Platforms
Open-source conversational form builder with AI generation, conditional logic, and 30+ integrations — self-host with full data ownership.
highlight.io
Developer Tools · Analytics · Monitoring
Open-source full-stack monitoring that unifies session replay, error tracking, logging, and distributed tracing so you can stop context-switching between tools.
KeystoneJS
CMS · Developer Tools
The superpowered headless CMS for developers built with GraphQL and React
MLflow
AI Development · Monitoring
The open source AI engineering platform for debugging, evaluating, monitoring, and optimizing production LLMs and agents at scale.
Parse Server
Developer Tools · Databases
Self-hosted Backend-as-a-Service for Node.js with REST, GraphQL, real-time Live Query, cloud code, and pluggable adapters for any infrastructure.
Payload CMS
Developer Tools · Blogging · CMS
The open-source, Next.js-native headless CMS that lives inside your /app folder and gives you a full TypeScript backend instantly.