Nextjs Patterns logo

Nextjs Patterns

Organization
OrcaQubits
nextjs-patterns

Build with Next.js for BigCommerce — App Router, Server/Client Components, data fetching, ISR, middleware, API routes, and Catalyst patterns. Use when building headless BigCommerce storefronts with Next.js.

Overview

PublisherOrcaQubits
Repositoryagentic-commerce-skills-plugins
Skill namenextjs-patterns
Stars
40
Forks
17
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by OrcaQubits on GitHub. Read the source before you install it.

Installation

Install the Nextjs Patterns AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/bigcommerce-commerce/skills/nextjs-patterns
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/OrcaQubits/agentic-commerce-skills-plugins.git /tmp/agentic-commerce-skills-plugins
mkdir -p .claude/skills
cp -r /tmp/agentic-commerce-skills-plugins/bigcommerce-commerce/skills/nextjs-patterns .claude/skills/nextjs-patterns
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Nextjs Patterns in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Nextjs Patterns on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Nextjs Patterns is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Next.js Patterns for BigCommerce

Before writing code

Fetch live docs:

  1. Fetch https://nextjs.org/docs for Next.js documentation
  2. Fetch https://www.catalyst.dev/ for Catalyst-specific patterns
  3. Web-search nextjs app router data fetching patterns for current best practices

App Router Fundamentals

File-Based Routing

app/
├── page.tsx                   # /
├── layout.tsx                 # Root layout
├── products/
│   ├── page.tsx               # /products
│   └── [slug]/
│       └── page.tsx           # /products/:slug
├── cart/
│   └── page.tsx               # /cart
├── api/
│   └── webhooks/
│       └── route.ts           # /api/webhooks (API route)
└── not-found.tsx              # 404 page

Special Files

FilePurpose
page.tsxRoute component
layout.tsxShared layout (persists across navigation)
loading.tsxLoading UI (Suspense boundary)
error.tsxError boundary
not-found.tsx404 page
route.tsAPI route handler
template.tsxRe-rendered layout (no persistence)

Server vs Client Components

Server Components (Default)

  • Run on the server only — no JS sent to client
  • Can await async operations directly
  • Access server-only resources (DB, API tokens, env vars)
  • Cannot use hooks, browser APIs, or event handlers

Client Components

Mark with 'use client' directive:

  • Run in the browser
  • Use React hooks (useState, useEffect, etc.)
  • Handle user interactions (onClick, onChange)
  • Access browser APIs

Pattern for BigCommerce

typescript
// Server Component — fetches data
async function ProductPage({ params }: { params: { slug: string } }) {
  const product = await getProduct(params.slug); // Server-side fetch
  return (
    <div>
      <h1>{product.name}</h1>
      <AddToCartButton productId={product.id} /> {/* Client component */}
    </div>
  );
}

// Client Component — handles interactivity
'use client';
function AddToCartButton({ productId }: { productId: number }) {
  const [loading, setLoading] = useState(false);
  const handleClick = async () => { /* add to cart */ };
  return <button onClick={handleClick}>Add to Cart</button>;
}

Data Fetching

Server Component Fetching

typescript
async function ProductsPage() {
  const products = await fetch(`${STORE_URL}/graphql`, {
    method: 'POST',
    headers: { Authorization: `Bearer ${STOREFRONT_TOKEN}` },
    body: JSON.stringify({ query: PRODUCTS_QUERY }),
    next: { revalidate: 300 }, // ISR: revalidate every 5 minutes
  }).then(r => r.json());
  return <ProductGrid products={products.data.site.products} />;
}

Caching & Revalidation

StrategyUse CaseConfig
StaticRarely changing data{ cache: 'force-cache' }
ISRProduct/category pages{ next: { revalidate: 300 } }
DynamicCart, checkout, account{ cache: 'no-store' }
On-DemandAfter webhook eventsrevalidateTag('products')

On-Demand Revalidation

Trigger revalidation from webhooks:

typescript
// app/api/webhooks/route.ts
export async function POST(request: Request) {
  const body = await request.json();
  if (body.scope === 'store/product/updated') {
    revalidateTag('products');
  }
  return Response.json({ revalidated: true });
}

API Routes

Webhook Handlers

typescript
// app/api/webhooks/orders/route.ts
export async function POST(request: Request) {
  const body = await request.json();
  // Verify webhook authenticity
  // Process order event
  return Response.json({ received: true });
}

Proxy Routes

Proxy BigCommerce API calls to hide credentials:

typescript
// app/api/products/route.ts
export async function GET() {
  const response = await fetch(`${BC_API_URL}/v3/catalog/products`, {
    headers: { 'X-Auth-Token': process.env.BC_ACCESS_TOKEN! },
  });
  const data = await response.json();
  return Response.json(data);
}

Middleware

Authentication

typescript
// middleware.ts
export function middleware(request: NextRequest) {
  const token = request.cookies.get('auth_token');
  if (request.nextUrl.pathname.startsWith('/account') && !token) {
    return NextResponse.redirect(new URL('/login', request.url));
  }
  return NextResponse.next();
}

Geolocation / Channel Routing

Route users to the correct channel based on locale or region.

Image Optimization

typescript
import Image from 'next/image';

<Image
  src={product.imageUrl}
  alt={product.name}
  width={500}
  height={500}
  priority={isAboveFold} // Preload for LCP images
/>

Configure remotePatterns in next.config.js for BigCommerce CDN domains.

Environment Variables

# .env.local
BIGCOMMERCE_STORE_HASH=abc123
BIGCOMMERCE_ACCESS_TOKEN=xxx        # Server-only (no NEXT_PUBLIC_ prefix)
NEXT_PUBLIC_STORE_URL=https://...   # Available in browser
BIGCOMMERCE_STOREFRONT_TOKEN=yyy    # Client-side GraphQL

Catalyst-Specific Patterns

GraphQL Client

Catalyst includes a typed GraphQL client:

  • Queries in client/queries/ directory
  • Mutations in client/mutations/ directory
  • Auto-generated types from GraphQL schema

Component Library

Catalyst provides pre-built components:

  • Product cards, galleries, options
  • Cart drawer, cart page
  • Navigation, breadcrumbs, search
  • Customer account pages

Best Practices

  • Use Server Components by default — add 'use client' only when needed
  • Fetch data in Server Components — pass data down to Client Components as props
  • Use ISR for product/category pages — balance freshness and build speed
  • Use on-demand revalidation with BigCommerce webhooks
  • Keep API tokens server-side — never expose via NEXT_PUBLIC_ prefix
  • Use next/image for automatic optimization
  • Implement loading states with loading.tsx or Suspense
  • Handle errors gracefully with error.tsx boundaries

Fetch the Next.js documentation and Catalyst source for exact API, configuration options, and current patterns before implementing.

Frequently asked questions

What does the Nextjs Patterns AI skill do?

Build with Next.js for BigCommerce — App Router, Server/Client Components, data fetching, ISR, middleware, API routes, and Catalyst patterns. Use when building headless BigCommerce storefronts with Next.js.

Why use Nextjs Patterns on TypingMind?

Because you install it once and use it with any model. Nextjs Patterns is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Nextjs Patterns in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/OrcaQubits/agentic-commerce-skills-plugins/tree/main/bigcommerce-commerce/skills/nextjs-patterns. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Nextjs Patterns?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Nextjs Patterns?

As many as you like. As long as a model supports skills, you can use Nextjs Patterns with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Nextjs Patterns AI skill free?

Yes. It is published on GitHub by OrcaQubits under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇