headless-bff-architecture

Route private VTEX API calls through a secure Express-based BFF.

39|9|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/vtexdocs/ai-skills --skill headless-bff-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: headless-bff-architecture
Source: https://github.com/vtexdocs/ai-skills/tree/main/tracks/headless/skills/headless-bff-architecture
Command: npx skills add https://github.com/vtexdocs/ai-skills --skill headless-bff-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Securely proxy VTEX private APIs through a server-side BFF to prevent exposure of API keys and shopper credentials in frontend code, enabling safe, authenticated communication with VTEX services.

Core Features & Use Cases

  • Mandatory BFF layer for all headless VTEX projects to centralize API calls and credential management.
  • Server-side handling of VtexIdclientAutCookie and API keys to protect shopper sessions and machine credentials.
  • Clear routing rules for public vs private VTEX endpoints, with validation and security guardrails.
  • Per-module API key separation and credential management to minimize risk and scope.

Quick Start

Install a minimal Express-based BFF, configure server-side VTEX credentials via environment variables, and route private VTEX endpoints through the BFF.

Frequently Asked Questions about headless-bff-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I securely proxy VTEX private APIs in a headless storefront?

To securely proxy VTEX private APIs, route frontend calls through a server-side BFF that validates requests and manages authentication. This backend layer protects VTEX AppKeys and shopper tokens from frontend exposure.

Why do I need a BFF layer for headless VTEX apps?

A BFF layer is mandatory for headless VTEX apps to prevent exposing API keys and shopper credentials in frontend code. It centralizes credential management and applies security guardrails like input validation and server-side session management.

How do I handle VtexIdclientAutCookie and API keys server-side?

Handle VtexIdclientAutCookie and API keys server-side by configuring VTEX credentials via environment variables in an Express-based BFF. This protects shopper sessions and machine credentials while routing private VTEX endpoints.

What are the routing rules for public vs private VTEX endpoints?

Public VTEX endpoints can be accessed directly, while private endpoints must route through the BFF with validation and security guardrails. The BFF applies routing rules to protect credentials and manage per-module API key separation.

Does this BFF architecture require Express for VTEX headless projects?

An Express-based BFF is the recommended implementation for VTEX headless projects. You install a minimal Express server, configure server-side VTEX credentials via environment variables, and route private endpoints through it.

What are the limitations of using a BFF for VTEX API proxying?

The BFF approach requires server-side infrastructure and careful credential management via environment variables. Limitations include the need for per-module API key separation and maintaining validation guardrails for all private endpoint routing.