Hacker News new | ask | show | jobs
by ecjhdnc2025 706 days ago
> Who would torture themselves like that?

It's not really torture. I do. I have built a private federation API in a system where there's a "mothership" service that needs to talk to individual websites.

Those websites are WordPress at the moment but they may be Magento, PrestaShop or whatever in the future.

GraphQL means I can template the API calls used to keep them in sync with the mothership. It's awesome.

I also use it for the frontend/backend connection of a couple of admin APIs and an intranet app.

Nuxt frontends, Laravel/Lighthouse headless backends. The only pain point is the unnecessarily complex Apollo stuff in the client, but that gives you really nice smart queries in Nuxt 2; it may not be that crucial in Vue 3/Nuxt 3.

1 comments

> that gives you really nice smart queries in Nuxt 2; it may not be that crucial in Vue 3/Nuxt 3.

It's even better with Vue 3 (or Vue 2 with the composition API anyway), especially when you combine it with graphql-codegen. Smart queries become just another composable, no `this.$apollo` to be seen. Got that going with API Platform on the backend myself, which has really nice integration with symfony, though it speaks only a bare-bones dialect of graphql as opposed to Lighthouse with all its crazy directives. No persisted queries either, but it's an internal app with bandwidth to burn.

Been eying wp-graphql for my one wordpress project. From my dabbling with it, the DX feels a lot nicer than the WP REST api, though I'm sure you know that's an awfully low bar to clear.

> especially when you combine it with graphql-codegen.

I did not know about this, thank you.

> Been eying wp-graphql for my one wordpress project. From my dabbling with it, the DX feels a lot nicer than the WP REST api, though I'm sure you know that's an awfully low bar to clear.

Yes on both scores. There's a reasonably useful Woocommerce binding:

https://github.com/wp-graphql/wp-graphql-woocommerce

Which is what I was using for the federated storefronts, with the API locked down so it could only be accessed from a back-office client I hooked up with a Laravel worker. At the time it was very early days, but wp-graphql has quite a sane interaction with the hooks/actions model, so it's not awfully difficult to add/patch/override the things you need.