bagisto/graphql-api
GraphQL API for Bagisto e-commerce: expose catalog, cart, checkout, customer, and storefront data through a flexible GraphQL schema. Build headless storefronts and modern clients that query exactly what they need, powered by Laravel and Bagisto.
Architecture fit. This is a Bagisto module, not a general-purpose Laravel GraphQL server. It sits on top of Bagisto core, is built on Lighthouse, and exposes separate shop and admin SDL schemas whose resolvers bind directly to Bagisto repositories and services for pricing, tax, promotions, and stock. The fit is therefore binary: if Bagisto is the commerce platform, this package removes schema design, resolver implementation, token auth, and the cart/checkout mutation surface from the critical path — months of work the team would otherwise design, build, and defend in review. If Bagisto is not the platform, the package has no product value to weigh. Treat this as a go/no-go gate, not a scoring exercise.
Integration feasibility. High, conditional on version alignment. Install is composer require bagisto/graphql-api, publish the provider, migrate, and link storage; the endpoint defaults to /graphql. Prerequisites are a working Bagisto storefront (Laravel 10/11, PHP 8.x, MySQL/Postgres, Redis) confirmed before touching GraphQL. The package ships a GraphiQL tool for schema exploration and publishes config/lighthouse.php, which is where route, middleware, guards, and query depth/complexity are configured. Pin the package major to the Bagisto core major — they ship and upgrade together. Use ^2.3.2 or newer; earlier 2.3.x releases had a broken GraphiQL install command and namespace.
Technical risk. Ranked by impact:
composer update fix — v2.3.2 contained both a GraphiQL install-command repair and a GDPR module fix. Upgrade package and core in lockstep, every time.addToCart and placeOrder loses the cart with no user-facing error. Silent, and easy to miss in QA.first: 10000) is a trivial DoS vector on a public commerce graph; depth/complexity limits must be set from day one, not after launch.Key questions for the product decision.
Stack fit. Laravel 10/11 + Bagisto 2.3.x + Lighthouse + MySQL/Postgres + Redis, with a CDN in front of cacheable catalog reads. Clients are generated from introspection with graphql-codegen — never hand-written, never regenerated on a developer laptop. Server-side commerce rules stay authoritative; any pricing or tax logic appearing in the storefront is a defect.
Migration path. Sequential and deliberately boring:
/graphql resolves behind CORS and auth middleware.products(first: 5) and createCart, then chain addToCart, addCustomerAddress, and checkout mutations until payloads are sensible.php artisan lighthouse:validate-schema plus an SDL diff into CI. Fail the build on unintended schema change.@dataloader on relations the landing and category pages actually traverse, and set max_query_complexity / max_query_depth before the first client is pointed at it.Compatibility discipline. Pin both bagisto/graphql-api and Bagisto core in composer.json, upgrade together, and read release notes before every bump. Contract tests that execute the five or six canonical queries the storefront depends on, re-run on each upgrade, are cheaper than finding drift in production. Keep shop and admin schemas in separate client configs; expose the admin schema only behind an appropriate guard.
Sequencing across the roadmap. The first client is the expensive one; each subsequent channel (mobile app, PWA, partner/B2B portal, kiosk) is materially cheaper because it consumes one contract rather than a bespoke endpoint set. That reframes channel expansion from "N integrations" to "one contract, N clients" — a roadmap-shaping decision. Because clients are generated from a typed schema, small product bets (mobile pilot, price-list portal, a loyalty field added via a Lighthouse @field and a resolver calling Bagisto services) ship without touching the monolith. Extend above the schema; anything requiring edits inside vendor/ is a signal to rethink, since forks make the next upgrade a merge conflict.
Maintenance. Ongoing cost is dominated by lockstep upgrades with Bagisto core, not by the GraphQL layer itself. Expect 0.25–0.5 FTE for upgrades, SDL diffs, contract-test upkeep, and periodic upstream fixes. Every Bagisto bump is a potential resolver break; the SDL diff in CI is the early-warning system. Recent releases (v2.3.2, August 2025) are a favorable signal of active maintenance, but there is exactly one maintainer organization behind it.
Support. MIT license, no SLA, small community, zero dependents. Support is internal by definition. Mitigate by reading and documenting the resolver behavior you depend on, keeping a short written record of schema assumptions, and treating upstream contribution as a planned activity rather than an escalation path that may not exist.
Scaling. Three levers, all needed before launch:
config/lighthouse.php from day one.Failure modes to design against.
| Symptom | Likely cause | Mitigation |
|---|---|---|
| Cart vanishes between add and checkout | Token expiry, no user-facing error | Explicit session lifetime, proactive refresh, visible "cart expired" state |
Mutation returns null |
Wrong guard on the Lighthouse route (shop vs. admin) | Separate client configs, guard audit in review |
Cannot query field "X" after upgrade |
SDL changed | Re-introspect, regenerate client, SDL diff gate |
| 401s in a working dev environment | Authorization missing from Access-Control-Allow-Headers |
Explicit CORS config; never copy local CORS to prod |
| p95 collapse under moderate load | N+1 fan-out on catalog graph | Dataloader, then profile again |
| Stack traces or SQL in responses | Lighthouse debug mode enabled outside local | Environment-gated config, checked in deploy review |
Ramp-up. The team needs GraphQL fluency — resolver-level performance, schema diffing, cache tagging — and Lighthouse conventions help but do not substitute for reading this package's source. Plan for a learning curve on the first client and a much shorter one on the second. Keep the Blade storefront deployed as a fallback until a peak cycle has run headless, and staff the checkout workstream (payments, 3DS, webhook idempotency, short-lived stock reservations) honestly in the quarter plan. The trade is fair — months of schema and resolver work skipped in exchange for owning the operational surface — but only if the FTE is actually allocated.
How can I help you explore Laravel packages today?