Skip to content

feat: Add Relay-compatible GraphQL endpoint#927

Draft
google-labs-jules[bot] wants to merge 10 commits intomasterfrom
feat/add-graphql-endpoint
Draft

feat: Add Relay-compatible GraphQL endpoint#927
google-labs-jules[bot] wants to merge 10 commits intomasterfrom
feat/add-graphql-endpoint

Conversation

@google-labs-jules
Copy link
Copy Markdown
Contributor

This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at /graphql and currently exposes a contacts query. This query follows Relay conventions, providing a node interface for global object identification and a connection-based model for lists.

Key features of this implementation include:

  • Use of graphql-relay to ensure compliance with Relay specifications.
  • Integration of dataloader to prevent the N+1 problem by batching and caching data requests.
  • A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.

PR created automatically by Jules for task 14209361552567519475

This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query. This query follows Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
@google-labs-jules
Copy link
Copy Markdown
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query. This query follows Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query. This query follows Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query. This query follows Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
@hawkrives hawkrives marked this pull request as ready for review October 6, 2025 18:53
@hawkrives
Copy link
Copy Markdown
Member

Didn't realize that would automatically request a review from all three of us, sorry!

I've been playing with https://relay.dev at work, and I'm really appreciating the "declarative data fetching" nature of relay. I'd like to try adding a graphql endpoint to CCC, even if we never use it in the app.

This PR just adds an endpoint for contacts, but it's a start!

hawkrives
hawkrives previously approved these changes Oct 6, 2025
This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query. This query follows Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
- Use of Zod for type-safe resolution in the `nodeDefinitions`.
This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query and a `dictionary` query. These queries follow Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
- Use of Zod for type-safe resolution in the `nodeDefinitions`.
- A refactored and scalable type resolution system for the `node` interface.
hawkrives
hawkrives previously approved these changes Oct 6, 2025
hawkrives
hawkrives previously approved these changes Oct 6, 2025
drewvolz
drewvolz previously approved these changes Oct 6, 2025
Comment thread source/ccc-server/graphql.ts Outdated

type KnownGraphQLTypeNames = 'Contact' | 'DictionaryDefinition'

const ContactSchema = z.object({
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we extracted other schemas to their own files but should be okay

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I figure we can figure out the desired file structure for these later, but … eh, lemme split them out now.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine, we're making gradual changes and can polish later

This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query and a `dictionary` query. These queries follow Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- A modular and scalable architecture with GraphQL types, utilities, and schema assembly separated into their own files.
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
- Use of Zod for type-safe resolution in the `nodeDefinitions`.
This commit introduces a new Relay-compatible GraphQL endpoint to the server.

The new endpoint is available at `/graphql` and currently exposes a `contacts` query and a `dictionary` query. These queries follow Relay conventions, providing a `node` interface for global object identification and a connection-based model for lists.

Key features of this implementation include:
- A modular and scalable architecture with GraphQL types, utilities, and schema assembly separated into their own files.
- Use of `graphql-relay` to ensure compliance with Relay specifications.
- Integration of `dataloader` to prevent the N+1 problem by batching and caching data requests.
- A Test-Driven Development (TDD) approach, with integration tests that verify the endpoint's functionality, including fetching lists and single nodes.
- A custom `URL` scalar type for the `image` field in the `Contact` type.
- Use of Zod for type-safe resolution in the `nodeDefinitions`.
@hawkrives hawkrives marked this pull request as draft October 8, 2025 01:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants