DEV Community

Alex Spinov
Alex Spinov

Posted on

Vendure Has a Free API You've Never Heard Of

Vendure is an open-source headless commerce framework built on TypeScript and GraphQL. It's designed for complex e-commerce with multi-channel, multi-vendor, and custom workflow support.

What Makes Vendure Special?

  • GraphQL-first — complete commerce GraphQL API
  • Multi-channel — B2B, B2C, marketplace from one backend
  • Plugin architecture — extend everything
  • TypeScript — fully typed, great DX
  • Free — MIT licensed

The Hidden API: GraphQL Commerce

# Search products with facets
query {
  search(input: {
    term: "laptop"
    facetValueFilters: [{ and: ["brand-apple"] }]
    sort: { price: ASC }
    take: 20
  }) {
    items {
      productName
      slug
      price { ... on SinglePrice { value } }
      productAsset { preview }
    }
    facetValues {
      facetValue { name }
      count
    }
    totalItems
  }
}

# Add to cart and checkout
mutation {
  addItemToOrder(productVariantId: "1", quantity: 2) {
    ... on Order {
      id
      totalWithTax
      lines {
        productVariant { name }
        quantity
        linePriceWithTax
      }
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Plugin API — Extend Everything

import { VendurePlugin, PluginCommonModule } from '@vendure/core';

@VendurePlugin({
  imports: [PluginCommonModule],
  providers: [LoyaltyService],
  shopApiExtensions: {
    schema: gql`
      extend type Order {
        loyaltyPoints: Int!
      }
    `,
    resolvers: [LoyaltyResolver]
  }
})
export class LoyaltyPlugin {
  static init(options: LoyaltyOptions) {
    return LoyaltyPlugin;
  }
}
Enter fullscreen mode Exit fullscreen mode

Quick Start

npx @vendure/create my-shop
cd my-shop && npm run dev
# Admin: localhost:3000/admin
# Shop API: localhost:3000/shop-api
Enter fullscreen mode Exit fullscreen mode

Why E-Commerce Teams Choose Vendure

A developer shared: "We built a B2B marketplace with Vendure in 6 weeks. The multi-channel support meant one backend serves our wholesale portal, retail site, and mobile app. Try doing that with WooCommerce."


Building commerce platforms? Email spinov001@gmail.com or check my tools.

GraphQL or REST for e-commerce? What's your preference?

Top comments (0)