Engine and theme
The code is an npm workspaces monorepo with two layers.
Engine
Section titled “Engine”@magenxcommerce/engine is pure TypeScript and React, with no CSS and no visual opinions:
- the Apollo client and its setup;
- Magento GraphQL queries and types, one folder per feature under
src/features/; - cart, wishlist and auth context providers;
- tax-aware price selectors, HTML sanitising, recently-viewed products and cookie consent;
- the server-only agentic-commerce handlers (UCP and ACP) under
@magenxcommerce/engine/agentic/*.
It is published to npm. A shop pins the engine to an exact version, and releases move the pin, so a build always uses the engine its shop was tested with.
A shop is self-contained: pages, components, UI primitives and one config file, all inside apps/<shop>/. See Create a shop.
Config injection
Section titled “Config injection”Engine code never imports a config file. The shop passes its config once, at the root layout:
import config from "#config"; // apps/theme/magenx.config.ts
<EngineConfigProvider config={config}> <ApolloWrapper> <AuthProvider> <CartProvider> <WishlistProvider>{children}</WishlistProvider> </CartProvider> </AuthProvider> </ApolloWrapper></EngineConfigProvider>Client components read it with hooks:
const { store, features, cms } = useEngineConfig();const { brand, layout } = useThemeConfig(); // same object, wider typeServer components import #config directly.