OWASP / OWASP/Nest

Consolidate Duplicate `apolloClient.ts` Files

Open
#4,006 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement question
Dominant language
Python
Stars
450
Forks
709
Avg merge
22h 59m
Merged PRs (30d)
91

Description

Consolidate duplicate apolloClient.ts into a single source of truth

Overview

There are currently two separate apolloClient.ts files in the codebase:

  • server/apolloClient.ts
  • utils/helpers/apolloClient.ts

(Please adjust paths if slightly different.)


Problem

Having multiple Apollo Client setup files can lead to:

  • Configuration drift
  • Confusion about which client instance should be used
  • Inconsistent behavior if updates are applied to one file but not the other
  • Increased maintenance overhead

Over time, this increases the risk of subtle bugs related to caching, authentication headers, or link configuration.


Proposed Solution
  • Review both implementations
  • Consolidate them into a single shared Apollo Client configuration
  • Move the unified file to a clear shared location (e.g., src/lib/apolloClient.ts)
  • Update all imports throughout the codebase to reference the consolidated file
  • Remove the redundant implementation after migration

Expected Impact
  • Reduced code duplication
  • Improved maintainability
  • Consistent Apollo Client configuration across the frontend
  • Easier future enhancements and debugging

Type: Refactor / Code Quality Improvement
Difficulty: Easy (Good First Issue)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing server/apolloClient.ts and utils/helpers/apolloClient.ts, adjusting the paths if the files differ. Search the codebase for imports of both implementations and identify a suitable shared location for the unified client. Done means all imports use one configuration and the redundant implementation is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
graphql, typescript
Domain
frontend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.