Skip to content

ADR‐004: Integrating gql.tada for GraphQL Queries

Vlas edited this page Feb 9, 2024 · 1 revision

ADR: Integrating gql.tada for GraphQL Queries

Technical Story: This decision focuses on enhancing developer experience and code maintainability by integrating gql.tada for managing GraphQL queries within our projects.

Context and Problem Statement

We're currently exploring options to improve our GraphQL development workflow. gql.tada emerges as a potential solution, offering type-safe GraphQL queries and fragments within the TypeScript environment. This ADR will evaluate its integration feasibility and potential impact on our project.

Decision Drivers

  • Experience: Ease of writing and managing GraphQL queries.
  • Code maintainability: Reusability and clarity of query logic.
  • Type safety: Minimizing runtime errors and ensuring data integrity.

Considered Options

  • Continue with current approach of manual string manipulation.
  • Integrate a GraphQL client library without specific typing features.
  • Integrate gql.tada for typed and component-agnostic queries.

Decision Outcome

Chosen option: "Integrate gql.tada," due to its ability to significantly improve developer experience, code maintainability, and type safety.

Positive Consequences

  • Enhanced Developer Experience: Encourages writing type-safe queries, offers syntax highlighting and autocompletion, and promotes code reusability.
  • Improved Code Maintainability: Separates query logic from components, leading to cleaner and more organized codebase.
  • Reduced Runtime Errors: Enforces type safety, mitigating potential data access issues and improving application stability.

Negative Consequences

  • Potential Migration Effort: Adapting existing queries to the new approach might require some initial effort.

Pros and Cons of the Options

gql.data

  • Good: Enforces type safety, reducing errors and improving data integrity.
  • Good: Promotes code reusability and maintainability through component-agnostic queries.
  • Good: Offers extensive developer tooling for improved productivity and clarity.
  • Bad: Potential migration effort for adapting existing queries.

Links