You need access to an Erxes SaaS instance and an admin user account.
https://[your-domain].app.erxes.ioYou’ll need an API token to fetch data from Erxes.
https://[your-domain].app.erxes.ioSettings → Apps (Legacy)adminSettings → Business portal → Client Portal✅ Store this token in your environment file as
ERXES_APP_TOKEN.
Before connecting your frontend, make sure your CMS has the necessary content created. Go to your Erxes SaaS domain and create the following:
/about, /contact, etc.⚠️ These entries are required to successfully fetch and display content. If they’re missing, GraphQL queries may return
nullor empty arrays.
You’ll need to install Apollo Client and GraphQL to communicate with the CMS.
npm install @apollo/client graphql
yarn add @apollo/client graphql
Before using Apollo Client, make sure your environment variables are properly set and exposed to the frontend.
// next.config.ts
import type { NextConfig } from "next";
const nextConfig: NextConfig = {
env: {
ERXES_API_URL: "https://[your-domain].app.erxes.io/gateway/graphql",
ERXES_URL: "https://[your-domain].app.erxes.io/gateway",
ERXES_FILE_URL: "https://[your-domain].app.erxes.io/gateway/read-file?key=", // updated to match the domain
ERXES_APP_TOKEN: "", // your copied token earlier
},
images: {
unoptimized: true,
remotePatterns: [
{
protocol: "http",
hostname: "localhost",
port: "4000", // your local development server port
},
{
protocol: "https",
hostname: "[your-domain].app.erxes.io", // updated to match the domain
},
],
},
};
export default nextConfig;
Create a shared Apollo Client instance so your app can communicate with the CMS.
Now your Next.js application is set up to communicate with the Erxes CMS using Apollo Client. You can start querying and mutating data from the CMS in your components.
This documentation is designed for junior or intern developers working with Erxes SaaS as backend. Our stack includes:
Introduction
Welcome to the CMS + Next.js Developer Guide!
Queries
This section provides an overview of how to query and mutate data in the Erxes CMS using Apollo Client in a Next.js application.