Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. GraphQL
  3. graphql-normalizr

graphql-normalizr

MITJavaScript

A lightweight library that normalizes nested GraphQL responses into flat, key-value objects for efficient client-side caching.

GitHubGitHub
196 stars14 forks0 contributors

What is graphql-normalizr?

GraphQL Normalizr is a JavaScript library that normalizes nested GraphQL API responses into flat, key-value objects for efficient client-side caching. It solves the problem of persisting GraphQL data in state management libraries like Redux or Apollo Client by converting deeply nested structures into normalized collections, enabling faster data access and updates.

Target Audience

Frontend developers working with GraphQL APIs who need to cache responses in client-side state management systems like Redux, Apollo Client, or custom Flux stores.

Value Proposition

Developers choose GraphQL Normalizr for its lightweight, configurable approach to normalization without heavy dependencies, offering fine-grained control over entity mapping, ID fields, and connection handling while maintaining performance.

Overview

Normalize GraphQL responses for persisting in the client cache/state

Use Cases

Best For

  • Caching GraphQL responses in Redux stores for efficient state updates
  • Integrating GraphQL data with Apollo Client's local cache management
  • Handling Relay-style connections and paginated data in client caches
  • Optimizing performance in applications with deeply nested GraphQL queries
  • Building custom state management solutions that require normalized data structures
  • Preparing GraphQL data for offline persistence or real-time updates

Not Ideal For

  • Projects using Apollo Client or Relay with built-in caching, where additional normalization could cause conflicts or redundancy
  • GraphQL APIs that lack consistent `__typename` or `id` fields and cannot be modified server-side
  • Applications with simple, flat data structures where normalization adds complexity without performance gains
  • Teams needing server-side data processing or normalization outside of JavaScript environments

Pros & Cons

Pros

Automatic Normalization

Efficiently flattens nested GraphQL responses into key-value stores using `__typename` and `id` fields, as shown in the TL;DR transformation example, enabling faster cache lookups.

Highly Configurable

Supports custom ID keys, entity naming, field ignoring, and GraphQL connections through a comprehensive config object, such as `idKey: 'uid'` or `useConnections: true`, allowing tailored integration.

Query Augmentation

Automatically adds required `__typename` and `id` fields to GraphQL queries if missing, via the `parse` or `addRequiredFields` methods, simplifying client-side setup without modifying server queries.

Performance Optimizations

Includes optional caching to prevent re-normalization of unchanged data, improving efficiency for scenarios like polling or repeated queries, as noted in the caching configuration.

Cons

Breaking Changes

Version 2.x introduced changes to entity name casing that require manual configuration adjustments, as highlighted in the migration guide, which can be a hurdle for upgrades.

Configuration Complexity

With numerous options like typeMap, ignore, lists, and casing, the setup can be overwhelming and error-prone for developers not needing fine-grained control, increasing initial time investment.

Dependency on GraphQL Meta Fields

Relies on `__typename` and `id` fields being present or augmentable, which may not be feasible if the GraphQL server doesn't support these or if queries are static and unmodifiable.

Frequently Asked Questions

Quick Stats

Stars196
Forks14
Contributors0
Open Issues0
Last commit2 years ago
CreatedSince 2018

Tags

#graphql#frontend-tooling#javascript-library#javascript#apollo-client#data-normalization#state-management#redux

Built With

J
JavaScript

Included in

GraphQL15.0k
Auto-fetched 10 hours ago

Related Projects

PrismaPrisma

Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

Stars47,614
Forks2,538
Last commit19 hours ago
BitBit

AI-powered development workspaces with reusable components, architectural clarity and zero overhead.

Stars18,473
Forks964
Last commit1 day ago
AmplicationAmplication

Amplication brings order to the chaos of large-scale software development by creating Golden Paths for developers - streamlined workflows that drive consistency, enable high-quality code practices, simplify onboarding, and accelerate standardized delivery across teams.

Stars16,012
Forks1,544
Last commit2 months ago
graphql-code-generatorgraphql-code-generator

A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.

Stars11,264
Forks1,401
Last commit10 hours 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