{"id":545558,"date":"2026-07-02T07:35:10","date_gmt":"2026-07-02T07:35:10","guid":{"rendered":"https:\/\/webkul.com\/blog\/?p=545558"},"modified":"2026-07-02T07:41:18","modified_gmt":"2026-07-02T07:41:18","slug":"how-to-build-ecommerce-in-next-js","status":"publish","type":"post","link":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/","title":{"rendered":"How to build eCommerce in Next.js"},"content":{"rendered":"\n<p>Modern eCommerce websites need to be fast, responsive, and easy to find on search engines.<\/p>\n\n\n\n<p>Next.js helps meet these requirements with built-in performance optimizations, strong SEO support, and flexible rendering options.<\/p>\n\n\n\n<p>In this guide, you&#8217;ll build a <a href=\"https:\/\/bagisto.com\/en\/headless-ecommerce\/\">headless eCommerce<\/a> store using Next.js and Bagisto.<\/p>\n\n\n\n<p>Next.js will power the storefront, while Bagisto will manage products, customers, orders, and other commerce features.<\/p>\n\n\n\n<p>You&#8217;ll install Bagisto, connect it to Next.js using GraphQL, and display real product data in the storefront.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-unset-1\"><img decoding=\"async\" width=\"1200\" height=\"800\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp\" alt=\"ecommerce in nextjs \" class=\"wp-image-546423\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-300x200.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-250x167.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-768x512.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2.webp 1536w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\"><strong><strong>What is eCommerce in Next.js ?<\/strong><\/strong><\/h2>\n\n\n\n<p>Next.js eCommerce uses Next.js to build the storefront\u2014the part of your online store that customers interact with.<\/p>\n\n\n\n<p>The backend manages products, prices, orders, customers, and other store data. The storefront retrieves this data through APIs.<\/p>\n\n\n\n<p>This architecture is known as <strong>headless commerce<\/strong>, where the frontend and backend run independently.<\/p>\n\n\n\n<p>The main advantage is flexibility. You can build a custom storefront without being tied to a traditional eCommerce theme or platform.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Why use Next.js for eCommerce?<\/strong><\/h2>\n\n\n\n<p>Next.js provides the performance, SEO capabilities, and rendering flexibility needed for modern eCommerce applications.<\/p>\n\n\n\n<p>Here are some of the key reasons developers choose it for online stores.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Reason<\/strong><\/td><td><strong>What it means<\/strong><\/td><\/tr><tr><td>Great SEO<\/td><td>Pages render on the server, so search engines can read them easily<\/td><\/tr><tr><td>Fast performance<\/td><td>Built-in optimizations keep load times low<\/td><\/tr><tr><td>Flexible rendering<\/td><td>Choose SSR, SSG, or ISR depending on the page<\/td><\/tr><tr><td>Headless-friendly<\/td><td>Connects cleanly to backends like Bagisto<\/td><\/tr><tr><td>Full design control<\/td><td>Build the storefront exactly how you want it<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>A Quick Note on Rendering Modes<\/strong><\/h3>\n\n\n\n<p>Next.js gives you three main ways to render a page, and each one fits a different situation.<\/p>\n\n\n\n<p><strong>SSR<\/strong> builds the page fresh on every request. It works well for things that change often, like a shopping cart.<\/p>\n\n\n\n<p><strong>SSG<\/strong> builds the page once, at build time. It&#8217;s a good fit for content that barely changes.<\/p>\n\n\n\n<p><strong>ISR<\/strong> sits in between. Pages stay static, but they refresh quietly in the background. That makes it a strong choice for product listing pages.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"what-is-bagisto\">What is Bagisto ?<\/h2>\n\n\n\n<p>Bagisto is an open source eCommerce platform built on Laravel. It manages products, orders, customers, inventory, and other store operations.<\/p>\n\n\n\n<p>In a headless setup, Bagisto acts as the backend and exposes store data through a GraphQL API.<\/p>\n\n\n\n<p>Bagisto provides store data through its GraphQL API, allowing your Next.js storefront to fetch products, categories, customers, and other information whenever it&#8217;s needed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"the-nextjs-ecommerce-tech-stack\">Next.js eCommerce Tech Stack<\/h2>\n\n\n\n<p>A real storefront needs a few more tools beyond just Next.js. Here&#8217;s the stack we&#8217;ll be using.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>Tool<\/strong><\/td><td><strong>Role in the Storefront<\/strong><\/td><\/tr><tr><td>Next.js<\/td><td>The core frontend framework<\/td><\/tr><tr><td>Apollo Client<\/td><td>Sends and caches GraphQL requests<\/td><\/tr><tr><td>Redux<\/td><td>Manages cart and global state<\/td><\/tr><tr><td>NextAuth.js<\/td><td>Handles customer login and sessions<\/td><\/tr><tr><td>TypeScript<\/td><td>Adds type safety to the code<\/td><\/tr><tr><td>ISR<\/td><td>Keeps product pages fast and fresh<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\"> Prerequisites<\/h3>\n\n\n\n<p>Before you begin, install the required software for running Bagisto.<\/p>\n\n\n\n<p>Since Bagisto is built on Laravel, it requires a standard Laravel development environment.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th><strong>Requirement<\/strong><\/th><th><strong>Version<\/strong><\/th><\/tr><\/thead><tbody><tr><td><strong>PHP<\/strong><\/td><td>8.3 or higher<\/td><\/tr><tr><td><strong>Composer<\/strong><\/td><td>2.5 or higher<\/td><\/tr><tr><td><strong>MySQL<\/strong><\/td><td>8.0.32 or higher<\/td><\/tr><tr><td><strong>Web Server<\/strong><\/td><td>Apache 2 or NGINX<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>One more thing worth knowing upfront: the GraphQL package we&#8217;ll install needs Bagisto 2.3 or later. If you&#8217;re working from an older Bagisto install, update it first.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Part 1: Install and Run Bagisto<\/strong><\/h2>\n\n\n\n<p>Let&#8217;s start with the backend. We&#8217;ll install Bagisto using Composer.<\/p>\n\n\n\n<p>This command creates a new Bagisto project inside a folder called <code><strong>my-store<\/strong><\/code>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">composer create-project bagisto\/bagisto my-store\ncd my-store\nphp artisan bagisto:install\nphp artisan serve\n<\/pre>\n\n\n\n<p>The install command walks you through an interactive setup. It configures your database and creates an admin account for you.<\/p>\n\n\n\n<p>Once it&#8217;s done, your store will be running locally. You can refer to the <a href=\"https:\/\/devdocs.bagisto.com\">official Bagisto documentation<\/a> for more detailed setup steps.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Enable the GraphQL API<\/h3>\n\n\n\n<p>Install the GraphQL package to expose Bagisto&#8217;s APIs.<\/p>\n\n\n\n<p>The installation registers the GraphQL routes and generates the required configuration. You can use the <a href=\"https:\/\/api-demo.bagisto.com\/api\/graphql\">GraphQL Playground<\/a> to test queries and explore the available operations.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">composer require bagisto\/graphql-api\nphp artisan optimize:clear\n<\/pre>\n\n\n\n<p>The install command registers the GraphQL routes and generates a few config values you&#8217;ll need in a moment.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Generate a Storefront API Key<\/strong><\/h3>\n\n\n\n<p>Bagisto secures its headless API with an access key. Your Next.js application must include this key when sending API requests.<\/p>\n\n\n\n<p>Run this command to create one.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">php artisan bagisto-api:generate-key --name=&quot;My Storefront&quot; --rate-limit=null<\/pre>\n\n\n\n<p>Save the generated key, as you&#8217;ll use it in your Next.js <code>.env.local<\/code> file in the next section.<\/p>\n\n\n\n<p>Once configured, your storefront can securely access product, customer, and other store data through the GraphQL API.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-unset-2\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-1200x675.webp\" alt=\"bagisto commands\" class=\"wp-image-546684\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-1200x675.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-300x169.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-250x141.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-768x432.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-1536x864.webp 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-install-2048x1152.webp 2048w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Part 2: Set Up the Next.js Storefront<\/h2>\n\n\n\n<p>With the backend ready, it&#8217;s time to build the part your customers will actually use.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create the Next.js App<\/h3>\n\n\n\n<p>Start by generating a fresh Next.js project.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">npx create-next-app@latest<\/pre>\n\n\n\n<p>Next, copy the example environment file. This is where your Bagisto backend URL and API key will go.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">cp .env.example .env.local<\/pre>\n\n\n\n<p>Open <code>.env.local<\/code> and add these two values. Use the storefront key you generated in <code>Part 1<\/code>.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">NEXT_PUBLIC_BAGISTO_ENDPOINT=https:\/\/your-bagisto-url.com\nNEXT_PUBLIC_BAGISTO_STOREFRONT_KEY=your_storefront_key_here<\/pre>\n\n\n\n<p>Then start the dev server.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">npm run dev<\/pre>\n\n\n\n<p>Visit your local storefront in the browser to confirm it&#8217;s running.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-unset-3\"><img decoding=\"async\" width=\"1200\" height=\"611\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage-1200x611.webp\" alt=\"bagisto-home-page \" class=\"wp-image-546528\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage-1200x611.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage-300x153.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage-250x127.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage-768x391.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage-1536x783.webp 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-homepage.webp 1570w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Add a GraphQL Proxy Route<\/h3>\n\n\n\n<p>Create an API route (<strong>app\/api\/graphql\/route.js <\/strong>)  to securely connect your Next.js application with Bagisto.<\/p>\n\n\n\n<p>This route forwards GraphQL requests to Bagisto and attaches the storefront access key on the server before sending the request.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { NextResponse } from &#039;next\/server&#039;;\n\nexport async function POST(req) {\n  const { query, variables } = await req.json();\n\n  const response = await fetch(`${process.env.NEXT_PUBLIC_BAGISTO_ENDPOINT}\/api\/graphql`, {\n    method: &#039;POST&#039;,\n    headers: {\n      &#039;Content-Type&#039;: &#039;application\/json&#039;,\n      &#039;X-STOREFRONT-KEY&#039;: process.env.NEXT_PUBLIC_BAGISTO_STOREFRONT_KEY,\n    },\n    body: JSON.stringify({ query, variables }),\n  });\n\n  const data = await response.json();\n  return NextResponse.json(data);\n}<\/pre>\n\n\n\n<p>Every GraphQL call from here on goes through this route instead of hitting Bagisto directly.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Fetch Products with GraphQL<\/h3>\n\n\n\n<p>Now we connect the two sides. GraphQL acts as the bridge between Bagisto and Next.js.<\/p>\n\n\n\n<p>The big advantage is that you fetch only the data you need. Nothing extra is sent over the wire.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"write-the-query\">Write the Query<\/h4>\n\n\n\n<p>Now we connect the two sides. GraphQL acts as the bridge between Bagisto and Next.js.<\/p>\n\n\n\n<p>The nice part about GraphQL is that you only fetch the data you actually need. Nothing extra gets sent over the wire.<\/p>\n\n\n\n<p>Create a <code><strong>graphql<\/strong><\/code> folder and add a <code><strong>queries.j<\/strong>s<\/code> file inside it. This query asks Bagisto for product details like ID, name, SKU, price, and images.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { gql } from &#039;graphql-request&#039;;\n\nexport const GET_PRODUCTS = gql`\n  query GetProducts {\n    products(input: {}) {\n      data {\n        id\n        name\n        sku\n        price\n        description\n        images {\n          url\n          path\n        }\n      }\n    }\n  }\n`;<\/pre>\n\n\n\n<p>Check the <a href=\"https:\/\/api-docs.bagisto.com\/api\/graphql-api\/shop\/queries\/get-products.html\">Bagisto product GraphQL API<\/a><\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong><strong>Fetch on the Server Side<\/strong><\/strong><\/h4>\n\n\n\n<p>The App Router lets us fetch data on the server. This means products load before the page reaches the browser.<\/p>\n\n\n\n<p>The result is faster pages and better SEO out of the box.<\/p>\n\n\n\n<p>This page component requests the products and renders them in a grid.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { client } from &#039;..\/..\/lib\/bagisto&#039;;\nimport { GET_PRODUCTS } from &#039;..\/..\/graphql\/queries&#039;;\n\nexport default async function ProductsPage() {\n  const data = await client.request(GET_PRODUCTS);\n  const products = data.products.data;\n\n  return (\n    &lt;div&gt;\n      &lt;h1&gt;Products&lt;\/h1&gt;\n      &lt;div className=&quot;product-grid&quot;&gt;\n        {products.map((product) =&gt; (\n          &lt;div key={product.id} className=&quot;product-card&quot;&gt;\n            &lt;img\n              src={product.images&#091;0]?.url}\n              alt={product.name}\n            \/&gt;\n            &lt;h2&gt;{product.name}&lt;\/h2&gt;\n            &lt;p&gt;SKU: {product.sku}&lt;\/p&gt;\n            &lt;p&gt;${product.price}&lt;\/p&gt;\n          &lt;\/div&gt;\n        ))}\n      &lt;\/div&gt;\n    &lt;\/div&gt;\n  );\n}<\/pre>\n\n\n\n<p>The data is fetched on the server, so the browser receives a ready-made page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Part 3: Add Customer Sign Up<\/strong><\/h3>\n\n\n\n<p>Every store needs customers, and customers need accounts. Sign-up is where that starts.<\/p>\n\n\n\n<p>In a headless setup, the registration form lives inside Next.js. The actual account, though, gets created by Bagisto through a GraphQL mutation.<\/p>\n\n\n\n<p>The flow is simple. The shopper fills out a form, Next.js passes the data along, and Bagisto creates the account and sends it back.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-unset-4\"><img decoding=\"async\" width=\"1200\" height=\"600\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup-1200x600.webp\" alt=\"signup page\" class=\"wp-image-546694\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup-1200x600.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup-300x150.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup-250x125.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup-768x384.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup-1536x768.webp 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/07\/bagisto-signup.webp 1774w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 1: Write the Registration Mutation<\/strong><\/h4>\n\n\n\n<p>GraphQL uses mutations whenever you want to change data, not just read it.<\/p>\n\n\n\n<p>Add a <code><strong>mutations.js<\/strong><\/code> file inside your <code><strong>graphql<\/strong><\/code> folder. This mutation sends the new customer&#8217;s details to Bagisto and asks for the saved account in return.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">import { gql } from &#039;graphql-request&#039;;\n\nexport const CUSTOMER_REGISTRATION = gql`\n  mutation registerCustomer($input: createCustomerInput!) {\n    createCustomer(input: $input) {\n      customer {\n        id\n        firstName\n        lastName\n        email\n        status\n        apiToken\n        token\n      }\n    }\n  }\n`;<\/pre>\n\n\n\n<p>The <code>apiToken<\/code> and <code>token<\/code> fields matter here. They&#8217;re what keep the customer signed in right after they register.<\/p>\n\n\n\n<p>One detail worth catching early: Bagisto&#8217;s API expects the confirmation field as <code><strong>confirmPassword<\/strong><\/code>, not <code><strong>passwordConfirmation<\/strong><\/code>.<\/p>\n\n\n\n<p>It&#8217;s a small naming mismatch, but it&#8217;s the kind of thing that throws an unhelpful GraphQL error if you miss it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 2: Build the Sign Up Form<\/strong><\/h4>\n\n\n\n<p>Now let&#8217;s build the form itself. We&#8217;ll use <code>react-hook-form<\/code> to handle inputs and validation.<\/p>\n\n\n\n<p>This form collects a name, email, and password. It also checks that both password fields match before submitting anything.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&#039;use client&#039;;\nimport { useForm } from &#039;react-hook-form&#039;;\nimport { createUser } from &#039;..\/..\/lib\/actions&#039;;\n\nexport default function RegistrationForm() {\n  const {\n    register,\n    handleSubmit,\n    formState: { errors, isSubmitting },\n  } = useForm();\n\n  const onSubmit = async (data) =&gt; {\n    if (data.password !== data.passwordConfirmation) {\n      alert(&#039;The passwords do not match.&#039;);\n      return;\n    }\n    const res = await createUser(data);\n    if (res?.success) {\n      window.location.href = &#039;\/customer\/login&#039;;\n    } else {\n      alert(res?.error?.message || &#039;Failed to create user&#039;);\n    }\n  };\n\n  return (\n    &lt;form onSubmit={handleSubmit(onSubmit)} noValidate&gt;\n      &lt;input\n        placeholder=&quot;First name&quot;\n        {...register(&#039;firstName&#039;, { required: &#039;First name is required&#039; })}\n      \/&gt;\n      &lt;input\n        placeholder=&quot;Last name&quot;\n        {...register(&#039;lastName&#039;, { required: &#039;Last name is required&#039; })}\n      \/&gt;\n      &lt;input\n        placeholder=&quot;Email&quot;\n        {...register(&#039;email&#039;, { required: &#039;Email is required&#039; })}\n      \/&gt;\n      &lt;input\n        type=&quot;password&quot;\n        placeholder=&quot;Password&quot;\n        {...register(&#039;password&#039;, {\n          required: &#039;Password is required&#039;,\n          minLength: { value: 8, message: &#039;Must be at least 8 characters&#039; },\n        })}\n      \/&gt;\n      &lt;input\n        type=&quot;password&quot;\n        placeholder=&quot;Confirm password&quot;\n        {...register(&#039;passwordConfirmation&#039;, { required: &#039;Please confirm password&#039; })}\n      \/&gt;\n      &lt;button type=&quot;submit&quot; disabled={isSubmitting}&gt;\n        Sign Up\n      &lt;\/button&gt;\n    &lt;\/form&gt;\n  );\n}<\/pre>\n\n\n\n<p>Each field has its own validation rule. If something&#8217;s missing or wrong, the shopper sees a clear message right away.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>Step 3: Send the Data to Bagisto<\/strong><\/h4>\n\n\n\n<p>The form doesn&#8217;t talk to GraphQL directly. Instead, it calls a server action that handles the request for us.<\/p>\n\n\n\n<p>Keeping this logic on the server is safer. Your API details never get exposed to the browser.<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\">&#039;use server&#039;;\nimport { client } from &#039;.\/bagisto&#039;;\nimport { CUSTOMER_REGISTRATION } from &#039;..\/graphql\/mutations&#039;;\n\nexport async function createUser(formData) {\n  try {\n    const { firstName, lastName, email, password, passwordConfirmation } = formData;\n    const data = await client.request(CUSTOMER_REGISTRATION, {\n      input: {\n        firstName,\n        lastName,\n        email,\n        password,\n        confirmPassword: passwordConfirmation,\n      },\n    });\n    return { success: true, customer: data.createCustomer.customer };\n  } catch (err) {\n    return { success: false, error: { message: err?.message || &#039;An error occurred&#039; } };\n  }\n}<\/pre>\n\n\n\n<p>Notice the form still collects <code><strong>passwordConfirmation<\/strong><\/code>, but we map it to <code><strong>confirmPassword<\/strong><\/code> right before sending it to Bagisto.<\/p>\n\n\n\n<p>That keeps the form code readable while still matching what the API actually expects.<\/p>\n\n\n\n<p>If Bagisto accepts the data, it sends back the new customer. If something goes wrong, the error comes back too, so the form can show it.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\"><strong>How the Sign-Up Flow Works<\/strong><\/h4>\n\n\n\n<p>It helps to see the whole journey laid out step by step.<\/p>\n\n\n\n<p>1. The customer fills out the sign-up form in Next.js.<\/p>\n\n\n\n<p>2. <code><strong>react-hook-form<\/strong><\/code> checks the fields on the client side.<\/p>\n\n\n\n<p>3. The form calls the <code><strong>createUser<\/strong><\/code> server action.<\/p>\n\n\n\n<p>4. The server action sends a GraphQL mutation to Bagisto.<\/p>\n\n\n\n<p>5. Bagisto creates the account and sends back the customer with a token.<\/p>\n\n\n\n<p>6. The customer lands on the login page, ready to sign in.<\/p>\n\n\n\n<p>The frontend handles the experience. Bagisto handles the account. That split is really the whole idea behind headless commerce.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large wp-duotone-unset-5\"><img decoding=\"async\" width=\"1200\" height=\"675\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow-1200x675.webp\" alt=\"signup-flow\" class=\"wp-image-546479\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow-1200x675.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow-300x169.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow-250x141.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow-768x432.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow-1536x864.webp 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/signup-flow.webp 1800w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<p><br><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Key Features of eCommerce in Next.js Storefront<\/h3>\n\n\n\n<p>A storefront built with Next.js and Bagisto delivers a fast, scalable shopping experience while giving developers the flexibility to build modern eCommerce applications.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Product &amp; Shopping Experience<\/h4>\n\n\n\n<p>Create engaging product pages with support for multiple product types, while secure customer accounts, carts, and checkout ensure a smooth buying journey.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"611\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout-1200x611.webp\" alt=\"bagisto cart-checkout\" class=\"wp-image-545697\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout-1200x611.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout-300x153.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout-250x127.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout-768x391.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout-1536x783.webp 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/cart-checkout.webp 1570w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">High Performance<\/h4>\n\n\n\n<p>Built-in server-side rendering, incremental static regeneration (ISR), and intelligent caching keep pages fast and responsive, improving the shopping experience on every device.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1200\" height=\"611\" src=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance-1200x611.webp\" alt=\"bagisto performance\" class=\"wp-image-545695\" srcset=\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance-1200x611.webp 1200w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance-300x153.webp 300w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance-250x127.webp 250w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance-768x391.webp 768w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance-1536x783.webp 1536w, https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/performance.webp 1570w\" sizes=\"(max-width: 1200px) 100vw, 1200px\" loading=\"lazy\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">SEO &amp; Accessibility<\/h4>\n\n\n\n<p>Generate search engine-friendly pages with server-rendered content, responsive layouts, and accessible interfaces that help your store reach more customers.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p>Next.js and Bagisto provide a solid foundation for building headless eCommerce applications. Next.js delivers a fast, flexible storefront, while Bagisto handles products, orders, customers, and the rest of your commerce operations.<\/p>\n\n\n\n<p>You now have a working setup with GraphQL connecting both applications. From here, you can continue building your storefront by adding features such as product search, shopping carts, user authentication, and checkout.<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Modern eCommerce websites need to be fast, responsive, and easy to find on search engines. Next.js helps meet these requirements with built-in performance optimizations, strong SEO support, and flexible rendering options. In this guide, you&#8217;ll build a headless eCommerce store using Next.js and Bagisto. Next.js will power the storefront, while Bagisto will manage products, customers, <a href=\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\">[&#8230;]<\/a><\/p>\n","protected":false},"author":770,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-545558","post","type-post","status-publish","format-standard","hentry","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 eCommerce in Next.js - Webkul Blog<\/title>\n<meta name=\"description\" content=\"Learn how to build eCommerce in Next.js using Bagisto as a headless backend. Set up GraphQL APIs, fetch products, and create a fast, scalable online store.\" \/>\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-ecommerce-in-next-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to build eCommerce in Next.js - Webkul Blog\" \/>\n<meta property=\"og:description\" content=\"Learn how to build eCommerce in Next.js using Bagisto as a headless backend. Set up GraphQL APIs, fetch products, and create a fast, scalable online store.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\" \/>\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=\"2026-07-02T07:35:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-07-02T07:41:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp\" \/>\n<meta name=\"author\" content=\"Ritu\" \/>\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=\"Ritu\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 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-ecommerce-in-next-js\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\"},\"author\":{\"name\":\"Ritu\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/5e29ed784b7f9445c4e3ff7543bfa29f\"},\"headline\":\"How to build eCommerce in Next.js\",\"datePublished\":\"2026-07-02T07:35:10+00:00\",\"dateModified\":\"2026-07-02T07:41:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\"},\"wordCount\":1617,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/webkul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\",\"url\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\",\"name\":\"How to build eCommerce in Next.js - Webkul Blog\",\"isPartOf\":{\"@id\":\"https:\/\/webkul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp\",\"datePublished\":\"2026-07-02T07:35:10+00:00\",\"dateModified\":\"2026-07-02T07:41:18+00:00\",\"description\":\"Learn how to build eCommerce in Next.js using Bagisto as a headless backend. Set up GraphQL APIs, fetch products, and create a fast, scalable online store.\",\"breadcrumb\":{\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage\",\"url\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2.webp\",\"contentUrl\":\"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2.webp\",\"width\":1536,\"height\":1024},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/webkul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to build eCommerce in Next.js\"}]},{\"@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\/5e29ed784b7f9445c4e3ff7543bfa29f\",\"name\":\"Ritu\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/9bc2529731debbaa3262752e12dd0beadbf918c5a3eb2461dc39f50e155236d9?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/9bc2529731debbaa3262752e12dd0beadbf918c5a3eb2461dc39f50e155236d9?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g\",\"caption\":\"Ritu\"},\"description\":\"Ritu is a software engineer specializing in building modern, high-performance web applications with Next.js. With expertise in UI\/UX design and headless theme development, she creates fast, scalable, and user-centric digital experiences. Having contributed to numerous projects across different domains, she combines technical expertise with a strong design perspective to deliver seamless, responsive, and engaging web solutions.\",\"sameAs\":[\"https:\/\/in.linkedin.com\/in\/rituthakur03\/\"],\"url\":\"https:\/\/webkul.com\/blog\/author\/ritu-uxlab322\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to build eCommerce in Next.js - Webkul Blog","description":"Learn how to build eCommerce in Next.js using Bagisto as a headless backend. Set up GraphQL APIs, fetch products, and create a fast, scalable online store.","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-ecommerce-in-next-js\/","og_locale":"en_US","og_type":"article","og_title":"How to build eCommerce in Next.js - Webkul Blog","og_description":"Learn how to build eCommerce in Next.js using Bagisto as a headless backend. Set up GraphQL APIs, fetch products, and create a fast, scalable online store.","og_url":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/","og_site_name":"Webkul Blog","article_publisher":"https:\/\/www.facebook.com\/webkul\/","article_published_time":"2026-07-02T07:35:10+00:00","article_modified_time":"2026-07-02T07:41:18+00:00","og_image":[{"url":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp","type":"","width":"","height":""}],"author":"Ritu","twitter_card":"summary_large_image","twitter_creator":"@webkul","twitter_site":"@webkul","twitter_misc":{"Written by":"Ritu","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#article","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/"},"author":{"name":"Ritu","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/5e29ed784b7f9445c4e3ff7543bfa29f"},"headline":"How to build eCommerce in Next.js","datePublished":"2026-07-02T07:35:10+00:00","dateModified":"2026-07-02T07:41:18+00:00","mainEntityOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/"},"wordCount":1617,"commentCount":0,"publisher":{"@id":"https:\/\/webkul.com\/blog\/#organization"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp","inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/","url":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/","name":"How to build eCommerce in Next.js - Webkul Blog","isPartOf":{"@id":"https:\/\/webkul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage"},"image":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage"},"thumbnailUrl":"https:\/\/webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2-1200x800.webp","datePublished":"2026-07-02T07:35:10+00:00","dateModified":"2026-07-02T07:41:18+00:00","description":"Learn how to build eCommerce in Next.js using Bagisto as a headless backend. Set up GraphQL APIs, fetch products, and create a fast, scalable online store.","breadcrumb":{"@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#primaryimage","url":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2.webp","contentUrl":"https:\/\/cdnblog.webkul.com\/blog\/wp-content\/uploads\/2026\/06\/bagisto-2.webp","width":1536,"height":1024},{"@type":"BreadcrumbList","@id":"https:\/\/webkul.com\/blog\/how-to-build-ecommerce-in-next-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/webkul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to build eCommerce in Next.js"}]},{"@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\/5e29ed784b7f9445c4e3ff7543bfa29f","name":"Ritu","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/webkul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/9bc2529731debbaa3262752e12dd0beadbf918c5a3eb2461dc39f50e155236d9?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/9bc2529731debbaa3262752e12dd0beadbf918c5a3eb2461dc39f50e155236d9?s=96&d=https%3A%2F%2Fcdnblog.webkul.com%2Fblog%2Fwp-content%2Fuploads%2F2019%2F10%2Feva.png&r=g","caption":"Ritu"},"description":"Ritu is a software engineer specializing in building modern, high-performance web applications with Next.js. With expertise in UI\/UX design and headless theme development, she creates fast, scalable, and user-centric digital experiences. Having contributed to numerous projects across different domains, she combines technical expertise with a strong design perspective to deliver seamless, responsive, and engaging web solutions.","sameAs":["https:\/\/in.linkedin.com\/in\/rituthakur03\/"],"url":"https:\/\/webkul.com\/blog\/author\/ritu-uxlab322\/"}]}},"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/545558","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\/770"}],"replies":[{"embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/comments?post=545558"}],"version-history":[{"count":102,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/545558\/revisions"}],"predecessor-version":[{"id":546862,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/posts\/545558\/revisions\/546862"}],"wp:attachment":[{"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/media?parent=545558"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/categories?post=545558"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/webkul.com\/blog\/wp-json\/wp\/v2\/tags?post=545558"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}