{"id":402632,"date":"2023-09-28T05:45:35","date_gmt":"2023-09-28T05:45:35","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=402632"},"modified":"2026-02-23T08:21:36","modified_gmt":"2026-02-23T08:21:36","slug":"how-to-build-nextjs-theme-in-magento-2","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/","title":{"rendered":"How to Build a NextJs Theme in Magento 2 (Adobe Commerce)"},"content":{"rendered":"\n<p>NextJS Theme in Magento 2 opens the way to building a modern and powerful eCommerce storefront.<\/p>\n\n\n\n<p> In this blog, we will take you through the step-by-step process of creating a NextJs theme using the <a href=\"https:\/\/webkul.com\/blog\/graphql-implementation-in-magento2\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 GraphQL<\/a> API.<\/p>\n\n\n\n<p> By combining Magento 2 with NextJs, you can unlock a fast, scalable, and engaging shopping experience for your customers.<\/p>\n\n\n\n<p>You might also want to check the <a href=\"https:\/\/webkul.com\/nextjs-development-services\/\" target=\"_blank\" rel=\"noreferrer noopener\">Nextjs development services<\/a> to aid your developmental progress. <\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Magento 2 GraphQL API Overview<\/h4>\n\n\n\n<p>Magento 2 is a popular <a href=\"https:\/\/bagisto.com\/en\/\" target=\"_blank\" rel=\"noreferrer noopener\">open-source e-commerce<\/a> platform that introduced GraphQL API support for client-side technologies like ReactJS and NextJS.<\/p>\n\n\n\n<p> In this blog, we will work with the GraphQL API endpoints to build the NextJS theme.<\/p>\n\n\n\n<p>Basically, GraphQL is a query language for APIs that provides the power to ask for exactly what they need and nothing more. <\/p>\n\n\n\n<p>To access the GraphQL endpoints provided by Magento 2, simply enter the URL&nbsp;http:\/\/&lt;magento2-server&gt;\/graphql&nbsp;in the Chrome browser&#8217;s address bar.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Creating the NextJs project using Magneto 2.<\/h4>\n\n\n\n<p><strong>Step 1: Project Setup<\/strong> &#8211; In this first step, we need to set up the NextJs project. You can follow this&nbsp;<a href=\"https:\/\/webkul.com\/blog\/project-setup-next-js\/\" target=\"_blank\" rel=\"noreferrer noopener\">setup nextjs project<\/a>&nbsp;blog.<\/p>\n\n\n\n<p>For CSS UI, you can use the <a href=\"https:\/\/webkul.com\/blog\/how-to-use-tailwind-css-in-next-js\/\" target=\"_blank\" rel=\"noreferrer noopener\">Tailwind CSS<\/a> dependencies for a good Experience within the NextJs Project.<\/p>\n\n\n\n<p><strong>Step 2: Set up the Apollo client-<\/strong> We will need Apollo client dependencies that help you with both <a href=\"http:\/\/webkul.com\/blog\/how-to-implement-magento-graphql-apis-with-nextjs-react\/\" target=\"_blank\" rel=\"noreferrer noopener\">Apollo Client<\/a> and GraphQl API.<\/p>\n\n\n\n<p>Apollo Client is a state management library used to fetch, cache, and update application data.<\/p>\n\n\n\n<p><strong>Step 3: Global Variable Setup<\/strong> &#8211; We\u2019re going to create a file&nbsp;named .env in the root directory and add the following code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">MAGENTO_ENDPOINT=http:\/\/&lt;magento2-server&gt;\/graphql<\/pre>\n\n\n\n<p><strong>Step 4: Export Global Variable &#8211; <\/strong>We need to define the global variable in the next.config.js file. otherwise, you can not use this variable at the front end. So write the following code.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/\/------------next.config.js-----------\/\/\n\n\/** @type {import(&#039;next&#039;).NextConfig} *\/\nconst nextConfig = {\n  env: {\n    MAGENTO_ENDPOINT: process.env.MAGENTO_ENDPOINT,\n  },\n  reactStrictMode: true,\n};\n\nmodule.exports = nextConfig;<\/pre>\n\n\n\n<p><strong>Step 5: Create the GraphQl Fil<\/strong>e.<\/p>\n\n\n\n<p>Create <code>product.graphql<\/code> in <code>components\/graphql\/<\/code>. Add the GraphQL query code to fetch product data from the API response.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/\/-------------components\/graphql\/product.graphql-------------\/\/\n\nquery ProductQuery($filters: ProductAttributeFilterInput) {\n  products(filter: $filters) {\n    items {\n      id\n      name\n      sku\n      description{\n        html\n      }\n      short_description{\n        html\n      }\n      image {\n        disabled\n        label\n        position\n        url\n      }\n      rating_summary\n      media_gallery{\n        url\n        position\n        label\n        disabled\n      }\n    }\n  }\n}<\/pre>\n\n\n\n<p><strong>Step 6: Create a Route file to Display the Product<\/strong> &#8211; We\u2019re going to create a&nbsp;file&nbsp;named [urlKey].js in pages\/product\/[urlKey].js.<\/p>\n\n\n\n<p>In this blog, we are using the <a href=\"https:\/\/webkul.com\/blog\/getstaticprops-vs-getserversideprops-next-js-data-fetching\/\" target=\"_blank\" rel=\"noreferrer noopener\">Static Site Generation (SSG)<\/a> feature of Next.js. SSG generates HTML pages at build time, which are then reused for every request.<\/p>\n\n\n\n<p>GetStaticPaths is an async function that generates the paths to pre-render based on products.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\nimport PRODUCT_QUERY from &#039;..\/..\/components\/graphql\/Product.graphql&#039;;\n\nexport async function getStaticPaths() {\n  let paths = &#091;];\n  const { data } = await client.query({\n      query: PRODUCT_QUERY,\n      variables: { filters: {}, pageSize: 12 },\n    });\n    const products = data?.products?.items || &#091;];\n    paths = products.map((product) =&gt; ({\n      params: { urlKey: product?.url_key || &#039;404&#039; },\n    }));\n  \n  return { paths, fallback: &#039;blocking&#039; };\n}<\/pre>\n\n\n\n<p>GetStaticProp is also an async function that generates data at the build time of generated path by the getStaticPaths function.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">export async function getStaticProps({ params }) {\n  const { data } = await client.query({\n    query: PRODUCT_QUERY,\n    variables: { filters: { url_key: { eq: params?.urlKey } } },\n  });\n  const product = data?.products?.items?.&#091;0] || null;\n\n  if (!isValidObject(product) || !product.sku) {\n    return {\n      notFound: true,\n    };\n  }\n\n  return {\n    props: {\n      product: product,\n    },\n    revalidate: 60, \n  };\n}<\/pre>\n\n\n\n<p>GraphQl API response <\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"675\" data-id=\"402951\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png\" alt=\"final-image\" class=\"wp-image-402951\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-300x169.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-250x141.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-768x432.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1536x864.png 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image.png 1600w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n<\/figure>\n\n\n\n<p>Final Code and UI Design According to the API Response.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">\/\/---------------pages\/product\/&#091;urlkey].js-----------\/\/\n\nimport Image from &#039;next\/image&#039;;\nimport { useState } from &#039;react&#039;;\nimport PRODUCT_QUERY from &#039;..\/..\/components\/graphql\/Product.graphql&#039;;\n\nconst Product = ({ product }) =&gt; {\n  const { thumbnail, price_range, sku } = product;\n  const &#091;addtocart, setAddtocart] = useState(1);\n  const add = () =&gt; {\n    setAddtocart(addtocart + 1);\n  };\n  const sub = () =&gt; {\n    addtocart &gt; 1 &amp;&amp; setAddtocart(addtocart - 1);\n  };\n\n  return (\n    &lt;div class=&quot;grid grid-cols-5 gap-4 w-&#091;85%] mx-auto my-5&quot;&gt;\n      &lt;div className=&quot;col-span-2 border border-1 border-solid border-slate-400 rounded&quot;&gt;\n        &lt;Image src={thumbnail?.id} width={500} height={500} \/&gt;\n      &lt;\/div&gt;\n      &lt;div className=&quot;col-span-3 mx-10&quot;&gt;\n        &lt;div className=&quot;&quot;&gt;\n          &lt;div display=&quot;grid&quot;&gt;\n            &lt;p className=&quot;font-&#091;500] text-&#091;2.5rem]&quot;&gt;{product.name || &#039;&#039;}&lt;\/p&gt;\n            &lt;div className=&quot;flex justify-between &quot;&gt;\n              &lt;p className=&quot;text-price&quot; sx={{ paddingTop: 1.5 }}&gt;\n                &lt;span className=&quot;font-semibold&quot;&gt;\n                  $ {price_range?.minimum_price?.regular_price?.value}\n                &lt;\/span&gt;\n\n                &lt;s className=&quot;pl-4 italic font-light text-fadedText&quot;&gt;\n                  {price_range?.discount?.amount_off}\n                &lt;\/s&gt;\n              &lt;\/p&gt;\n              &lt;p variant=&quot;body1&quot; className=&quot;mt-7&quot;&gt;\n                Sku : {sku}\n              &lt;\/p&gt;\n            &lt;\/div&gt;\n            &lt;div className=&quot;flex&quot;&gt;\n              &lt;button\n                onClick={sub}\n                aria-label=&quot;increment&quot;\n                className=&quot;text-white w-10 rounded-l h-8 border-0 cursor-pointer bg-secondary hover:bg-brand hover:contrast-75&quot;\n              &gt;\n                -\n              &lt;\/button&gt;\n              &lt;input\n                max={6}\n                type=&quot;text&quot;\n                className=&quot;relative w-14 border-&#091;1px] border-gray flex items-center px-3 font-semibold text-center text-gray-700   outline-none cursor-default -z-10 readonly focus:outline-none text-md hover:text-black focus:text-black md:text-base&quot;\n                min={1}\n                value={addtocart}\n                id=&quot;quantity&quot;\n                placeholder=&quot;0&quot;\n              \/&gt;\n\n              &lt;button\n                aria-label=&quot;increment&quot;\n                className=&quot;text-white w-10 h-8 rounded-r border-0 cursor-pointer bg-secondary hover:bg-brand hover:contrast-75&quot;\n                onClick={add}\n              &gt;\n                +\n              &lt;\/button&gt;\n            &lt;\/div&gt;\n\n            &lt;p className=&quot;pt-3 text-hoverEffect text-&#091;16px] &quot;&gt;\n              {product.short_description?.html ||\n                &#039;&#039;}\n            &lt;\/p&gt;\n          &lt;\/div&gt;\n\n          &lt;button\n            color=&quot;secondary&quot;\n            variant=&quot;contained&quot;\n            className=&quot;w-full py-4 mx-auto&quot;\n            type=&quot;submit&quot;\n          &gt;\n            Add to cart\n          &lt;\/button&gt;\n        &lt;\/div&gt;\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n  );\n};\n\nexport default Product;\n\nexport async function getStaticPaths() {\n  let paths = &#091;];\n  const { data } = await client.query({\n      query: PRODUCT_QUERY,\n      variables: { filters: {}, pageSize: 12 },\n    });\n    const products = data?.products?.items || &#091;];\n    paths = products.map((product) =&gt; ({\n      params: { urlKey: product?.url_key || &#039;404&#039; },\n    }));\n  \n  return { paths, fallback: &#039;blocking&#039; };\n}\n\nexport async function getStaticProps({ params }) {\n  const { data } = await client.query({\n    query: PRODUCT_QUERY,\n    variables: { filters: { url_key: { eq: params?.urlKey } } },\n  });\n  const product = data?.products?.items?.&#091;0] || null;\n\n  if (!isValidObject(product) || !product.sku) {\n    return {\n      notFound: true,\n    };\n  }\n\n  return {\n    props: {\n      product: product,\n    },\n    revalidate: 60, \n  };\n}<\/pre>\n\n\n\n<p>You can see the result on&nbsp;http:\/\/localhost:3000<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"551\" data-id=\"402949\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/screenshot_1695823348593-1200x551.png\" alt=\"screenshot_1695823348593\" class=\"wp-image-402949\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/screenshot_1695823348593-1200x551.png 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/screenshot_1695823348593-300x138.png 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/screenshot_1695823348593-250x115.png 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/screenshot_1695823348593-768x353.png 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/screenshot_1695823348593.png 1509w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n<\/figure>\n\n\n\n<p>Start your <a href=\"https:\/\/webkul.com\/magento2-headless-development\/\" target=\"_blank\" rel=\"noreferrer noopener\">Magento 2 Headless Development<\/a> with Webkul.<\/p>\n\n\n\n<p>Happy Coding!!<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>NextJS Theme in Magento 2 opens the way to building a modern and powerful eCommerce storefront. In this blog, we will take you through the step-by-step process of creating a NextJs theme using the Magento 2 GraphQL API. By combining Magento 2 with NextJs, you can unlock a fast, scalable, and engaging shopping experience for <a href=\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":545,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1173,9121,13575,6357,1],"tags":[],"class_list":["post-402632","post","type-post","status-publish","format-standard","hentry","category-api-2","category-magento-2","category-next-js","category-react-js","category-uncategorized"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Build a NextJs Theme in Magento 2 (Adobe Commerce) - Webkul Blog<\/title>\n<meta name=\"description\" content=\"We will start a journey to build a nextJs Theme in Magento 2. When we combine Magento 2 with ReactJS then makes you one of the most powerful e-commerce platforms.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build a NextJs Theme in Magento 2 (Adobe Commerce) - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"We will start a journey to build a nextJs Theme in Magento 2. When we combine Magento 2 with ReactJS then makes you one of the most powerful e-commerce platforms.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\" \/>\n<meta property=\"og:site_name\" content=\"Webkul Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/webkul\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-09-28T05:45:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-23T08:21:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png\" \/>\n<meta name=\"author\" content=\"Abhishek Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@webkul\" \/>\n<meta name=\"twitter:site\" content=\"@webkul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Abhishek Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\"},\"author\":{\"name\":\"Abhishek Kumar\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/9df44e99abf7df96a2c30b30fe20a4b9\"},\"headline\":\"How to Build a NextJs Theme in Magento 2 (Adobe Commerce)\",\"datePublished\":\"2023-09-28T05:45:35+00:00\",\"dateModified\":\"2026-02-23T08:21:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\"},\"wordCount\":452,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png\",\"articleSection\":[\"API\",\"Magento 2\",\"next js\",\"react js\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\",\"name\":\"How to Build a NextJs Theme in Magento 2 (Adobe Commerce) - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png\",\"datePublished\":\"2023-09-28T05:45:35+00:00\",\"dateModified\":\"2026-02-23T08:21:36+00:00\",\"description\":\"We will start a journey to build a nextJs Theme in Magento 2. When we combine Magento 2 with ReactJS then makes you one of the most powerful e-commerce platforms.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image.png\",\"width\":1600,\"height\":900,\"caption\":\"final-image\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Build a NextJs Theme in Magento 2 (Adobe Commerce)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/webkul.com\/blog\/#website\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"name\":\"Webkul Blog\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/webkul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/webkul.com\/blog\/#organization\",\"name\":\"WebKul Software Private Limited\",\"url\":\"https:\/\/webkul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png\",\"width\":380,\"height\":380,\"caption\":\"WebKul Software Private Limited\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/webkul\/\",\"https:\/\/x.com\/webkul\",\"https:\/\/www.instagram.com\/webkul\/\",\"https:\/\/www.linkedin.com\/company\/webkul\",\"https:\/\/www.youtube.com\/user\/webkul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/9df44e99abf7df96a2c30b30fe20a4b9\",\"name\":\"Abhishek Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5dab3b6807a6aa05fa5ad733392108c9f4ca765e4051f2e20687e10133f461e5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5dab3b6807a6aa05fa5ad733392108c9f4ca765e4051f2e20687e10133f461e5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g\",\"caption\":\"Abhishek Kumar\"},\"description\":\"Abhishek Kumar, a skilled software engineer, specializes in crafting immersive digital experiences. With a focus on frontend development, he excels in creating headless themes . Proficient in JavaScript and next.js, Abhishek's expertise adds a unique and dynamic dimension to any project, ensuring a seamless and engaging user journey.\",\"url\":\"https:\/\/webkul.com\/blog\/author\/abhishekkumar-mg121\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Build a NextJs Theme in Magento 2 (Adobe Commerce) - Webkul Blog","description":"We will start a journey to build a nextJs Theme in Magento 2. When we combine Magento 2 with ReactJS then makes you one of the most powerful e-commerce platforms.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/","og_locale":"en_US","og_type":"article","og_title":"How to Build a NextJs Theme in Magento 2 (Adobe Commerce) - Webkul Blog","og_description":"We will start a journey to build a nextJs Theme in Magento 2. When we combine Magento 2 with ReactJS then makes you one of the most powerful e-commerce platforms.","og_url":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2023-09-28T05:45:35+00:00","article_modified_time":"2026-02-23T08:21:36+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png","type":"","width":"","height":""}],"author":"Abhishek Kumar","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Abhishek Kumar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/"},"author":{"name":"Abhishek Kumar","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/9df44e99abf7df96a2c30b30fe20a4b9"},"headline":"How to Build a NextJs Theme in Magento 2 (Adobe Commerce)","datePublished":"2023-09-28T05:45:35+00:00","dateModified":"2026-02-23T08:21:36+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/"},"wordCount":452,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png","articleSection":["API","Magento 2","next js","react js"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/","url":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/","name":"How to Build a NextJs Theme in Magento 2 (Adobe Commerce) - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image-1200x675.png","datePublished":"2023-09-28T05:45:35+00:00","dateModified":"2026-02-23T08:21:36+00:00","description":"We will start a journey to build a nextJs Theme in Magento 2. When we combine Magento 2 with ReactJS then makes you one of the most powerful e-commerce platforms.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2023\/09\/final-image.png","width":1600,"height":900,"caption":"final-image"},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-build-nextjs-theme-in-magento-2\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Build a NextJs Theme in Magento 2 (Adobe Commerce)"}]},{"@type":"WebSite","@id":"https:\/\/webkul.com\/blog\/#website","url":"https:\/\/webkul.com\/blog\/","name":"Webkul Blog","description":"","publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/webkul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/webkul.com\/blog\/#organization","name":"WebKul Software Private Limited","url":"https:\/\/webkul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2021\/08\/webkul-logo-accent-sq.png","width":380,"height":380,"caption":"WebKul Software Private Limited"},"image":{"@id":"https:\/\/webkul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/webkul\/","https:\/\/x.com\/webkul","https:\/\/www.instagram.com\/webkul\/","https:\/\/www.linkedin.com\/company\/webkul","https:\/\/www.youtube.com\/user\/webkul\/"]},{"@type":"Person","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/9df44e99abf7df96a2c30b30fe20a4b9","name":"Abhishek Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5dab3b6807a6aa05fa5ad733392108c9f4ca765e4051f2e20687e10133f461e5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5dab3b6807a6aa05fa5ad733392108c9f4ca765e4051f2e20687e10133f461e5?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Fmike.png&r=g","caption":"Abhishek Kumar"},"description":"Abhishek Kumar, a skilled software engineer, specializes in crafting immersive digital experiences. With a focus on frontend development, he excels in creating headless themes . Proficient in JavaScript and next.js, Abhishek's expertise adds a unique and dynamic dimension to any project, ensuring a seamless and engaging user journey.","url":"https:\/\/webkul.com\/blog\/author\/abhishekkumar-mg121\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/402632","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/users\/545"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=402632"}],"version-history":[{"count":68,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/402632\/revisions"}],"predecessor-version":[{"id":527588,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/402632\/revisions\/527588"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=402632"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=402632"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=402632"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}