Skip to content

ALFMOB-330: Set up BFF GraphQL networking and schema sync workflow#72

Open
khoinguyen-mindera wants to merge 4 commits into
mainfrom
ALFMOB-330-bff-graphql-networking
Open

ALFMOB-330: Set up BFF GraphQL networking and schema sync workflow#72
khoinguyen-mindera wants to merge 4 commits into
mainfrom
ALFMOB-330-bff-graphql-networking

Conversation

@khoinguyen-mindera
Copy link
Copy Markdown
Contributor

Ticket

ALFMOB-330

Summary

  • Align iOS dev endpoint with BFF default port (localhost:3000); replace placeholder PreProd/Prod URLs with explicit TBD markers.
  • Add Alfie/scripts/sync-bff-schema.sh — pulls latest Alfie-BFF, copies its src/schema.gql into BFFGraph/CodeGen/Schema/schema.graphqls, runs Apollo codegen. Read-only with respect to the BFF repo.
  • Replace the 5 hand-curated schema-*.graphqls files with the single BFF-synced schema.graphqls.
  • Make Apollo codegen non-interactive (--allow-network-connections all in run-apollo-codegen.sh).
  • Document the local-dev loop in Docs/GraphQL.md (run local BFF, point the app, sync schema, regenerate types); trim the stale GraphQL section in README.md to a pointer.

Screenshot

Copilot AI review requested due to automatic review settings May 20, 2026 06:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Sets up a BFF-owned GraphQL workflow in Alfie iOS by consolidating the schema into a single committed file, adding a schema sync script, and updating documentation and local endpoint defaults to support a “sync schema → run Apollo codegen” loop.

Changes:

  • Aligns the dev API endpoint to the BFF default local port (localhost:3000) and replaces PreProd/Prod URLs with explicit TBD placeholders.
  • Adds sync-bff-schema.sh and makes Apollo CLI install non-interactive via SwiftPM --allow-network-connections all.
  • Replaces multiple hand-maintained schema-*.graphqls fragments with a single committed schema.graphqls, and updates docs to match the new workflow.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
README.md Updates the GraphQL section to point to the new workflow doc and committed schema location.
Docs/GraphQL.md Documents local BFF usage, schema sync, and query/codegen workflow.
Alfie/scripts/sync-bff-schema.sh Adds a script to update the committed schema from the Alfie-BFF repo and run codegen.
Alfie/scripts/run-apollo-codegen.sh Makes Apollo CLI install non-interactive by pre-allowing network connections.
Alfie/AlfieKit/Sources/BFFGraph/CodeGen/Schema/schema.graphqls Introduces the single, synced schema file used by Apollo codegen.
Alfie/AlfieKit/Sources/BFFGraph/CodeGen/Schema/schema-search.graphqls Removes the previous hand-curated schema fragment.
Alfie/AlfieKit/Sources/BFFGraph/CodeGen/Schema/schema-products.graphqls Removes the previous hand-curated schema fragment.
Alfie/AlfieKit/Sources/BFFGraph/CodeGen/Schema/schema-navigation.graphqls Removes the previous hand-curated schema fragment.
Alfie/AlfieKit/Sources/BFFGraph/CodeGen/Schema/schema-brand.graphqls Removes the previous hand-curated schema fragment.
Alfie/AlfieKit/Sources/BFFGraph/CodeGen/Schema/schema-base.graphqls Removes the previous hand-curated base schema fragment.
Alfie/Alfie/Service/ApiEndpointService.swift Updates default endpoints (dev port alignment + TBD placeholders).
Comments suppressed due to low confidence (1)

Alfie/Alfie/Service/ApiEndpointService.swift:45

  • dev now points to localhost:3000, but the committed GraphQL operations / generated API still target the older schema (product, productListing, suggestion, etc.). Given the new synced schema defines different query fields, Debug builds will likely fail against a BFF running on :3000 until operations + BFFClientService are migrated to the new schema (or the dev endpoint remains on the legacy port during the transition).
    // Local dev: aligned with the BFF default port. BFFClientService appends `graphql` /
    // `config/webviews` to this base, so it must stay an origin root (trailing slash, no path).
    case dev = "http://localhost:3000/"
    // TODO: Real PreProd/Prod BFF environment URLs are not provisioned yet — these are

Comment thread Alfie/Alfie/Service/ApiEndpointService.swift Outdated
Comment thread Alfie/Alfie/Service/ApiEndpointService.swift Outdated
Comment on lines +136 to +140
type Query {
productDetails(handle: String!, platform: String!, productMetafields: [MetafieldIdentifierInput!], variantMetafields: [MetafieldIdentifierInput!]): OmniProduct
productList(after: String, collectionHandle: String!, filters: ProductFilterInput, limit: Int! = 25, platform: String, sort: ProductSortEnum! = NEWEST): ProductListResponse!
searchProducts(after: String, filters: ProductFilterInput, limit: Int! = 10, platform: String, searchTerm: String!, sort: ProductSortEnum! = NEWEST): ProductListResponse!
}
Comment thread Alfie/scripts/sync-bff-schema.sh
Comment thread Docs/GraphQL.md Outdated
silvaricMindera

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

@silvaric silvaric left a comment

Choose a reason for hiding this comment

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

lgtm

@silvaric silvaric requested review from silvaricMindera and removed request for silvaricMindera May 21, 2026 11:34
Copy link
Copy Markdown
Contributor

@amccall-mindera amccall-mindera left a comment

Choose a reason for hiding this comment

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

Reviewed in the context of this being a setup ticket for an epic migrating mock backend → BFF, where the goal is keeping the repo compilable while subsequent tickets migrate queries/converters per feature. Generated Swift in BFFGraph/API/ is committed, so Swift builds stay green even though committed .graphql operations no longer match the new schema — re-running codegen will fail until those queries are migrated, which is expected for this stage.

A handful of smaller things below.

// explicit TBD placeholders. Replace once the real environments exist.
case preProd = "https://preprod.bff.tbd.invalid/"
case prod = "https://prod.bff.tbd.invalid/"
case custom = "https://api-preview-000.localhost:3000/"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Was the api-preview-000.localhost host intentional, or a leftover from the old :4000 placeholder? For a Debug-menu custom-endpoint prefill, a plain http://localhost:3000/ (or empty) would be less misleading.

type VariantOption {
name: String!
value: String!
} No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Minor: file ends without a trailing newline (BFF's src/schema.gql doesn't terminate). The sync script could printf '\n' >> after the copy to normalise this on every sync.

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.

5 participants