Vendure GraphQL API Frontend Integration

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.
Development and maintenance of all types of websites:
Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1 servicesAll 2065 services
Vendure GraphQL API Frontend Integration
Medium
~5 business days
FAQ
Our competencies:
Development stages
Latest works
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    822
  • image_crm_chasseurs_493_0.webp
    CRM development for Chasseurs
    847
  • image_website-sbh_0.png
    Website development for SBH Partners
    999
  • image_website-_0.png
    Website development for Red Pear
    451

Vendure GraphQL API Frontend Integration

Vendure provides two separate GraphQL endpoints: Shop API (/shop-api) for customers and Admin API (/admin-api) for administrators. Frontend uses only Shop API. Authentication via cookie-based sessions or Bearer token, choice made at server config level.

Client Setup (urql)

urql is lighter than Apollo and better for Vendure — less boilerplate with cookie sessions:

// lib/vendureClient.ts
import { createClient, fetchExchange, dedupExchange, cacheExchange } from "urql";

export const shopClient = createClient({
  url: `${process.env.NEXT_PUBLIC_VENDURE_API_URL}/shop-api`,
  exchanges: [dedupExchange, cacheExchange, fetchExchange],
  fetchOptions: {
    credentials: "include", // cookie-based auth
    headers: { "vendure-token": process.env.NEXT_PUBLIC_CHANNEL_TOKEN! },
  },
});

Type Generation

# codegen.yml
schema:
  - ${VENDURE_API_URL}/shop-api:
      headers:
        vendure-token: ${CHANNEL_TOKEN}

documents: "src/**/*.graphql"

generates:
  src/generated/shop-types.ts:
    plugins:
      - typescript
      - typescript-operations
      - typescript-urql
    config:
      withHooks: true
VENDURE_API_URL=http://localhost:3000 CHANNEL_TOKEN=my-token npx graphql-codegen

Catalog Queries

query GetProductList($options: ProductListOptions) {
  products(options: $options) {
    totalItems
    items {
      id
      name
      slug
      variants {
        id
        priceWithTax
        stockLevel
      }
    }
  }
}

Checkout Flow

// hooks/useCheckout.ts
export function useCheckout() {
  const [, setAddress] = useMutation(SetShippingAddressDocument);
  const [, setShipping] = useMutation(SetShippingMethodDocument);
  const [, addPayment] = useMutation(AddPaymentToOrderDocument);

  async function completeCheckout(params: CheckoutParams) {
    // 1. Address
    const addr = await setAddress({ input: params.address });

    // 2. Shipping method
    await setShipping({ id: [params.shippingMethodId] });

    // 3. Add payment
    const payment = await addPayment({
      input: { method: "yookassa", metadata: { returnUrl: window.location.origin } },
    });

    return payment.data?.addPaymentToOrder;
  }

  return { completeCheckout };
}

SSR with Next.js

// app/shop/page.tsx
import { createServerClient } from "@/lib/vendureServerClient";

export default async function ShopPage() {
  const client = createServerClient();
  const result = await client.query(GetProductListDocument, {
    options: { take: 24 },
  }).toPromise();

  return <ProductGrid initialData={result.data} />;
}

Timelines: Setup Vendure client, schema generation, catalog integration, checkout — 3–5 business days. Payment integration, shipping, admin panel — +3–4 days.