PHPackages                             neutromelabs/magento2-ssr-graphql - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. neutromelabs/magento2-ssr-graphql

ActiveMagento2-module[API Development](/categories/api)

neutromelabs/magento2-ssr-graphql
=================================

Allows to preload graphql queries at the render time

0.1.2(4mo ago)4131GPL-3.0-or-laterPHP

Since Jul 19Pushed 4mo agoCompare

[ Source](https://github.com/neutrome-labs/magento2-ssr-graphql)[ Packagist](https://packagist.org/packages/neutromelabs/magento2-ssr-graphql)[ RSS](/packages/neutromelabs-magento2-ssr-graphql/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (4)Used By (0)

```
There should not be one to choose between PHP and GraphQL.
Revolutionize your customer's experience with the best from both.

```

Magento 2 SSR GraphQL Module
============================

[](#magento-2-ssr-graphql-module)

Adds SSR GraphQL resolving capabilities to any Magento 2 frontend. Compatible with any theme. Works best with AlpineJS.

Overview
--------

[](#overview)

The idea is to write a normal GraphQL `query`, (which will be used on the frontend via JS,) AND automatically preload it's `response` at the page render, providing JS code with instant `data`/`errors` - without executing the "first" Ajax request.

Then, JS should operate as normal, with the access both to the `query` string, `ssr` data (variables, response) and simplified `fetch()`, to repeat the query, optionally passing new parameters.

Where To Use
------------

[](#where-to-use)

Anywhere on your pages, when the *same* \[available via GraphQL\] content needs to be available to the customer at the page render time (PHP), while could be updated later (JS).

Typical use-cases:

- pagination/lazy-load - the first set of the items could be preloaded at the page render, and paginated later, with the same GraphQL `query` and different `variables`
- double-check - the "Add To Cart" button is rendered if the product is available for sale, and the same query is `refresh`-ed on click, to prevent stock races

How To Use
----------

[](#how-to-use)

Simple example - paginated product list, over GraphQL.

1. The `phtml` view must call the `makeSsrGqlCall(query, variables)` method, from the `NeutromeLabs\SsrGraphql\ViewModel\SsrGraphqlViewModel` view model, which returns JS fragment string representing `object`, to insert into the page html script tag.

```
var ssrGqlExampleObject = ;
renderData(); // some logic to present ssrGqlExampleObject to the customer

```

2. While rendering this page, Magento will resolve the passed query and provide `ssrGqlExampleObject` JS variable with a special SSR GraphQL `object`

```
{
    // indicates, if the response is SSR-generated. true, if no "refresh" calls were made
    fresh: boolean,
    // "current" response data
    data?: object,
     // "current" response errors
    errors?: object[],
    ssr: {
        query: string, // GraphQL query string
        variables: object, // GraphQL variables, passed at the step 1
        response: object, // SSR GraphQL response
    },
    // fetches the same query with the merged variables from the ssr.variables and parameter
    fetch: (variables?: object) => Promise,
    // fetch(), then update the inner data and errors fields with the new response
    refresh: (variables?: object) => Promise,
}

```

3. The data from the JS variable could be presented to the customer right after the page load, with no "loaders" on the screen. Then those data could be updated, without the need to repeat the same GraphQL query again

```
currentPage++;

ssrGqlExampleObject.refresh({
    currentPage: currentPage
}).then(() => {
    renderData();
})

```

See the full example at `https://your-magento-instance.test/ssrgql/example`, and [src/SsrGraphql/view/frontend/templates/example/1.phtml](src/SsrGraphql/view/frontend/templates/example/1.phtml)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance75

Regular maintenance activity

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity32

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~267 days

Total

3

Last Release

133d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bcd3b8a9631d0f2741c846e127cd8e0cd535a78b3a3e30c93965f0c9fb656c68?d=identicon)[theuargb](/maintainers/theuargb)

---

Top Contributors

[![theuargb](https://avatars.githubusercontent.com/u/83121880?v=4)](https://github.com/theuargb "theuargb (4 commits)")

---

Tags

hyva-themesmagento2

### Embed Badge

![Health badge](/badges/neutromelabs-magento2-ssr-graphql/health.svg)

```
[![Health](https://phpackages.com/badges/neutromelabs-magento2-ssr-graphql/health.svg)](https://phpackages.com/packages/neutromelabs-magento2-ssr-graphql)
```

###  Alternatives

[smile/elasticsuite

Magento 2 merchandising and search engine built on ElasticSearch

8044.5M33](/packages/smile-elasticsuite)[graycore/magento2-cors

A Magento 2 module that enables CORS on the GraphQL and REST Apis

99516.1k](/packages/graycore-magento2-cors)[elgentos/module-prismicio

Magento 2 - Prismic.io integration

39112.0k3](/packages/elgentos-module-prismicio)[zepgram/module-rest

Technical module to industrialize API REST call with dependency injection pattern using Guzzle library

1326.2k](/packages/zepgram-module-rest)[yireo/magento2-additional-endpoints-graph-ql

113.0k](/packages/yireo-magento2-additional-endpoints-graph-ql)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
