Skip to content
agents.store
stackstack

stack-directus-nextjs

Directus + Next.js architecture plugin. How Directus (content, files, access) and a Next.js App Router frontend fit together: who holds the token, how the cache is invalidated, how assets and types cross the boundary, who owns the session, and a production checklist. Tool knowledge comes from its dependencies.

v2.0.5Updated

  • stack
  • directus-nextjs
  • architecture
  • agents-store
  • directus
  • nextjs
  • headless-cms
  • app-router

Install

Pick your agent for the steps.

Install on Claude Code

  1. 1.Add the marketplace

    /plugin marketplace add Agents-Store/claude-plugins
  2. 2.Install the plugin

    /plugin install stack-directus-nextjs@agents-store-claude-plugins

    Type it inside Claude Code.

Claude Code install docs

What is inside

Skills (6)

  • authentication

    This skill should be used when the user wants to "add authentication to Directus + Next.js", "implement Directus login in Next.js", "use NextAuth with Directus", "use Better Auth with Directus", "protect Next.js pages with Directus auth", "choose an auth approach for Directus and Next.js", "decide who owns the session", or needs to decide who owns the end-user session and the tokens across Directus and Next.js.

  • deployment

    This skill should be used when the user wants to "set up Docker for Directus with Next.js", "run Directus locally for a Next.js app", "configure content-change webhooks", "set up revalidation when Directus content changes", "auto-update the site on content change", "production checklist for Directus + Next.js", or needs the pipeline that connects Directus edits to Next.js pages and the checks before production. For platform-specific deployment (Vercel, Dokploy, etc.), see the respective deployment plugin.

  • directus-to-nextjs

    This skill should be used when the user wants to "fetch Directus data in Next.js", "display Directus content in Next.js pages", "render Directus images in Next.js", "use Directus SDK with Server Components", "create Next.js pages from Directus collections", "add TypeScript types for Directus", "cache Directus data in Next.js", "revalidate after Directus content changes", "fix 403 on Directus images", or needs the rules where Directus data meets Next.js rendering: who holds the token, what is cached, how files are served, and how types follow the schema.

  • examples

    End-to-end scenario walkthroughs for the Directus + Next.js stack. This skill should be used when the user asks for "Directus Next.js examples", "how to build a blog with Directus and Next.js", "Directus Next.js product catalog", "show me a complete example", or needs implementation references for common application types.

  • full-feature

    This skill should be used when the user wants to "build a complete feature with Directus and Next.js", "create an end-to-end page from Directus data", "implement a full CRUD feature across Directus and Next.js", "build a new section of the site", "create a page that shows Directus data", "build a dashboard with Directus content", "display Directus collection in Next.js", "add a new page with CMS data", or needs a step-by-step recipe for building features that span both Directus and Next.js.

  • init-project

    This skill should be used when the user asks to "set up Directus + Next.js project", "initialize Directus Next.js stack", "configure Directus with Next.js", "connect Directus to Next.js", "bootstrap Directus Next.js app", "create Next.js app with Directus", "scaffold Directus + Next.js", "start new project with Directus", "create a new Directus Next.js project", or needs to set up environment variables and verify connections for the Directus + Next.js stack.

Agents (1)

  • stack-orchestrator

    Use this agent when the user needs help coordinating work across Directus and Next.js — building pages that display Directus content, deciding who owns the user session, configuring cache revalidation, or implementing features that span both services. <example> Context: User wants to build a page that displays Directus content user: "Build a blog listing page that fetches posts from Directus and displays them with images" assistant: "I'll use the stack-orchestrator agent to build the blog page with Directus data fetching and image handling." <commentary> Feature requires Directus SDK data fetching in a Next.js Server Component with image optimization — spans Data and Interface layers. </commentary> </example> <example> Context: User wants to add authentication user: "Set up user login for the site that uses Directus" assistant: "I'll use the stack-orchestrator agent to decide who owns the session and wire the matching authentication path." <commentary> Authentication spans Directus (user store, token management) and Next.js (session library, proxy) — orchestrator decides who owns the session and coordinates both sides. </commentary> </example> <example> Context: User wants to set up content-change revalidation user: "Set up auto-rebuild when Directus content changes" assistant: "I'll use the stack-orchestrator agent to configure the Directus Flow + tag revalidation pipeline." <commentary> Revalidation wiring spans Directus Flows and Next.js route handlers and cache tags — cross-service coordination. </commentary> </example> <example> Context: User encounters a cross-service issue user: "My Directus images aren't loading in production" assistant: "I'll use the stack-orchestrator agent to diagnose the image loading issue across Directus CORS, Next.js image config, and hosting settings." <commentary> Cross-service debugging requires understanding Directus file permissions, next.config.ts image patterns, and environment variables. </commentary> </example>

MCP servers (1)

  • directus http

README

Directus + Next.js architecture plugin for Agents Store. It describes how Directus (content, files, access) and a Next.js App Router frontend fit together: who holds which token, how the cache is invalidated when content changes, how assets and types cross the boundary, who owns the user session, and what to check before production. It names its parts in dependencies; what one tool does and how to drive it is taught by that tool's own plugin.

Architecture

LayerServiceRole
DataDirectusContent, REST API, file storage, users and policies
Interface + LogicNext.jsApp Router, Server Components, Server Actions, Route Handlers

The boundary between them is what this plugin owns:

BoundaryRule
TokenThe server holds a service token of a dedicated Directus user; the browser holds nothing of Directus
CacheEvery Directus read is tagged with its collection; a Directus Flow expires the tag through a Route Handler
AssetsA file URL never carries a token: public files, or a server route that adds the token
Typestypes/directus.ts follows the Directus schema, and tsc is the drift check
SessionOne owner of the end-user session, chosen once (see authentication)

Deployment is handled by a separate plugin (for example dokploy-dev, vercel-dev).

Dependencies

Declared in plugin.json and installed together with the stack. They hold the tool-level knowledge:

PluginTeaches
directus-devDirectus MCP tools, REST API, @directus/sdk (sdk-patterns, including server-side use), local Docker Compose (docker-local-dev), flows (flow-automation), schema design
nextjs-devApp Router, data fetching and caching (data-fetching), authentication (auth-patterns), proxy.ts, images, Cache Components

nextjs-provision (shadcn/ui setup) is optional: install it separately if you want it. Pick the plugin that matches your hosting for deployment (dokploy-dev, vercel-dev).

Prerequisites

  • Directus 12 (MCP needs 11.12 or later and is switched on in Settings → AI)
  • Next.js 16, next@^16.3.8
  • Node.js 22 or later (@directus/sdk 26 requires it)
  • Docker, for a local Directus

Installation

claude plugin install stack-directus-nextjs@agents-store-claude-plugins

The two technology plugins above come with it.

MCP Server

This plugin's .mcp.json connects Claude to Directus. Tools are named mcp__plugin_stack-directus-nextjs_directus__<tool> (schema, collections, fields, items, files, flows and the rest of the Directus MCP surface).

ServerTransportAddress
directusHTTP${NEXT_PUBLIC_DIRECTUS_URL}/mcp with Bearer ${DIRECTUS_ADMIN_TOKEN}

MCP acts with the permissions of the token's user, so a token of a dedicated user with a narrow policy also narrows what the model can change.

Environment Variables

Copy templates/.env.example to your project root as .env.local:

VariablePurposeClient-side
NEXT_PUBLIC_DIRECTUS_URLDirectus addressYes
DIRECTUS_ADMIN_TOKENStatic token of a dedicated Directus user (the name is historical; an administrator token is for local development only)No
DIRECTUS_URL, DIRECTUS_TOKEN, NEXT_PUBLIC_CMS_URLThe names the directus-dev and nextjs-dev recipes read. In .env.local they expand to the two variables above (DIRECTUS_URL=${NEXT_PUBLIC_DIRECTUS_URL}, DIRECTUS_TOKEN=${DIRECTUS_ADMIN_TOKEN}, NEXT_PUBLIC_CMS_URL=${NEXT_PUBLIC_DIRECTUS_URL}); without them the NextAuth login calls undefined/auth/login and the images config failsNEXT_PUBLIC_CMS_URL: yes
NEXTAUTH_URLNextAuth base URL (NextAuth path only)No
NEXTAUTH_SECRETNextAuth encryption secret (NextAuth path only)No
REVALIDATION_SECRETShared secret for /api/revalidate, sent by a Directus Flow in a headerNo
PUBLIC_ASSET_FOLDER_IDDirectus folder whose files the asset proxy may serve (proxy path only)No

Skills

SkillDescription
init-projectVersions, environment, dependencies, client and types, verification
directus-to-nextjsThe boundary: token, cache, assets, types
authenticationWho owns the user session and the tokens; three paths
deploymentLocal development pointers, the revalidation pipeline, production checklist
full-featureStep-by-step recipe for building a feature across both layers
examplesScenario walkthroughs (blog, product catalog)

Agent

stack-orchestrator — Coordinates work across Directus and Next.js: content pages, the session, revalidation, and cross-service debugging.