These integration guides are not official documentation and the Strapi Support Team will not provide assistance with them.
What Is Claude Code?
Claude Code is Anthropic's terminal-based AI coding assistant that runs locally in your project directory. Launch claude in any repo, and it reads files, executes shell commands, runs tests, and maintains context about your codebase in a CLAUDE.md file. This context automatically reloads each session—no need to re-explain your folder structure or naming conventions every time.
Unlike browser-based AI tools, this assistant integrates directly into your development workflow. Through Model Context Protocol (MCP) tools, it calls external services. The /ide command hooks into VS Code to suggest and apply edits as you work. Built around Node.js and TypeScript, it feels native when developing Strapi backends or any JavaScript project.
Consider it a teammate who lives in your repo: understands your code, follows your conventions, and executes the commands you approve.
Why Integrate Claude Code with Strapi
When you're building content-heavy backends, you need speed without losing control of your codebase. This terminal-based assistant bridges that gap as a project-aware helper that works directly in your command line and IDE—the same environment where you already develop Strapi projects.
Instead of switching between the Admin Panel, REST clients, and your editor, you work with one agent that understands your folder structure, content models, and daily commands.
The developer-centric workflow feels natural because the assistant launches from the command line like running npm run develop. You describe what you want, and it edits files, runs tests, or spins up the Strapi dev server without forcing you into a separate interface.
Project awareness sets this tool apart from generic coding assistants. You can document your Strapi version, content types, and naming conventions in a CLAUDE.md file. The AI loads this context in every session, so it remembers that your article content type lives in src/api/article and that you prefer kebab-case UIDs.
MCP integration for Strapi is currently in development and does not yet provide structured tools or built-in permission checks for CRUD operations such as 'strapi.create' or 'strapi.findMany.'
The iteration cycle accelerates across your entire stack. Whether you're defining a new component, adjusting a controller, or updating a Next.js page that consumes your API, the AI edits code in place and runs it immediately. You spend less time context-switching and fewer moments realizing you forgot to rebuild.
This approach naturally supports test-driven development, which Anthropic recommends in their best-practice guide. You can ask the assistant to write a Jest spec for a custom findBySlug endpoint, let the test fail, then have it implement the controller until your suite passes. Your Strapi backend stays well-covered without extra ceremony.
Teams using this approach during the Vibe Coding proof-of-concept reported significant velocity gains—new content types went from hours to minutes, and frontend refactors stayed synchronized because the AI tracked schema changes in real time.
If you handle both backend and frontend development, the integration feels especially smooth. The assistant edits Strapi schemas, regenerates TypeScript types for your React client, and updates fetch hooks in one pass. You maintain full control while offloading boilerplate tasks to an agent that works at shell speed.
How to Integrate Claude Code with Strapi
The integration process takes about 30 minutes, whether you're starting fresh or working with an existing codebase. You'll set up the configuration, connect the AI to your project, and verify everything works with live API calls.
Prerequisites
You need Node.js 18 or newer with a package manager like npm, yarn, or pnpm. Make sure Git is installed for version control, and follow Anthropic's platform-specific guide to install the CLI. A local editor like VS Code helps if you want to use the
/ide integration, though it's optional.
For Strapi, you need either an existing project on v4 or v5, or the readiness to create one now. Admin access to your Strapi instance is required—whether that's local at http://localhost:1337/admin or on Strapi Cloud. Docker can help if you prefer containerized databases, and Postman or Insomnia makes API testing quicker, but neither is strictly necessary.
If you're comfortable in the terminal, you have everything you need.
Setting Up Your Environment
Start with a clean Strapi workspace or open an existing one:
npx create-strapi-app@latest my-strapi-app
cd my-strapi-app
npm run developOnce the admin UI launches, create a simple collection type—an article with a title field works fine—for test traffic. Keep Strapi running since the assistant will connect to the API at http://localhost:1337/api. Capture a sample payload so the AI sees real data:
curl http://localhost:1337/api/articles?[populate=deep](https://docs.strapi.io/cms/api/rest/populate-select) > docs/sample-articles.jsonStore environment variables like STRAPI_URL in an .env file and adjust public role permissions on your new collection type for local testing.
Configuring Claude Code for Strapi Development
From the Strapi project root, launch the assistant. You can create a CLAUDE.md file to document project details—Strapi version, database choice, folder layout, and conventions like "use entityService, avoid direct SQL." A basic example:
# Strapi Backend
- Local URL: http://localhost:1337
- Content types: article, category, author
- Scripts: `npm run develop`, `npm run build`
- Conventions: kebab-case API IDs, draft & publish enabledThe AI can load this file to maintain context across sessions, so keep it concise and current. The public CLAUDE.md from the strapi-mcp-server project provides inspiration. For VS Code users, connect the IDE with /ide, and the assistant will open files directly in your editor.
Configuration Method 1: Generating Content Types and Schemas
You can take two approaches: let Strapi's CLI scaffold files and have the AI refine them, or let it write the JSON directly. The CLI-first approach works well when sketching ideas: First, use the Strapi CLI to create collection types (e.g., 'npx strapi generate content-type article'), then manually edit each schema.json file to add relations (such as manyToMany between articles and categories, manyToOne from articles to authors), required flags, and draftAndPublish options, as needed.
For a code-first approach, tell the assistant to create the file tree under src/api/ and write fully-formed schemas. Either way, validate by restarting Strapi—the AI can troubleshoot any startup errors.
Configuration Method 2: Building Custom Controllers and Services
Strapi separates HTTP concerns in controllers from business logic in services. To extend the basics, this is a common pattern for customizing Strapi manually:
// Chat prompt:
"Add a custom findBySlug action to the article controller"You would create a route in routes/article.js, add a controller method that calls strapi.entityService.findMany, and put shared logic in a service using createCoreService. For analytics aggregation or webhook triggers, ask for new service methods rather than bloating the controller—thin controllers, fat services.
Common mistakes include handler-name typos and missing route registration. Running npm run develop after each change keeps you honest.
Implementing Custom Plugins
When built-in hooks aren't enough, a plugin provides a namespaced workspace. The AI can scaffold the plugin directory, React admin components, server code, and the entry in config/plugins.js. A practical first task might be an SEO analyzer that flags low-word-count articles.
Tell the assistant, "Generate a Strapi plugin that validates article SEO scores," and it handles the boilerplate. Start small—plugins touch more moving parts than controllers, so having the AI manage the repetitive setup saves hours.
Testing the Integration
Prove everything works with these validation steps:
# Restart Strapi—the console should show zero schema errors
npm run develop
# Test endpoints with curl or Postman
curl http://localhost:1337/api/articles?populate=author
# Ask Claude for integration tests
# "Write tests for the findBySlug endpoint"
# Run the test suite and confirm everything passes
npm testThe test-driven development approach catches issues early and keeps your API contract solid. Check Strapi logs for surprises, and you're ready to iterate with confidence.
Project Example: Build an E-commerce Backend with Claude Code and Strapi
Building a product catalog with cart and checkout functionality typically involves substantial scaffolding work. Here's how the AI assistant streamlines this process in a real Strapi project.
Planning the Content Architecture
Start a session in your project root and ask: "Design Strapi content types for e-commerce: products, categories, variants, orders, cart, customer."
The assistant returns a structured outline—product with SKU, price, images, and relations to variant; order linking to customer and orderItem; plus a shared seo component for public-facing content. Since it reads your CLAUDE.md, it already knows your naming conventions and draftAndPublish preferences.
Generating the Schemas
Instead of clicking through the Admin UI, let the AI write the boilerplate:
npx create-strapi generate content-type product
npx create-strapi generate content-type category
npx create-strapi generate content-type variant
npx create-strapi generate content-type order
npx create-strapi generate content-type order-itemRun the commands, then ask the assistant to open each schema.json file and add relations, UID fields, and components. A quick npm run develop confirms everything loads properly—the iterative "generate, run, fix" loop that keeps development moving.
Building Custom Logic
Cart operations need custom controllers. This is a recommended pattern: under src/api/cart/controllers/cart.ts, you can expose a POST /cart/add endpoint while keeping business logic separated into a service as shown:
// src/api/cart/services/cart.ts
import { factories } from '@strapi/strapi';
export default factories.createCoreService('api::cart.cart', ({ strapi }) => ({
async addLine(userId: number, productId: number, quantity = 1) {
const line = await strapi.entityService.create('api::order-item.order-item', {
data: { product: productId, quantity },
});
return strapi.entityService.update('api::cart.cart', userId, {
data: { order_items: { connect: [line.id] } },
populate: ['order_items', 'order_items.product'],
});
},
}));This keeps controllers thin and services focused—a pattern that prevents the "everything in one method" problem.
Layering in Business Rules
Inventory checks, discount calculations, and order confirmation all belong in the service layer. The assistant handles the boilerplate for a beforeCreate lifecycle that prevents overselling and a discountService that applies coupon logic. Describing requirements in plain English gets you working code quickly.
Testing with MCP Tools
There is currently no MCP server available for Strapi. While such functionality may be in development, there is no official support yet for bulk-creating demo products, categories, or variants through an MCP interface.
Project Results
This approach—content models, controllers, and seeded data—can considerably accelerate setup compared to manual implementation, which typically requires several weeks for comparable functionality. The AI's context persistence keeps naming consistent across product ↔ variant ↔ inventory relationships, preventing the integration issues that surface during QA.
Before deployment, developers can manually generate Jest tests for custom endpoints and configure CI workflows that spin up Strapi for automated testing. Once tests pass, production deployment still requires dedicated steps such as environment configuration and proper deployment setup.
Strapi Open Office Hours
If you have any questions about Strapi 5 or just would like to stop by and say hi, you can join us at Strapi's Discord Open Office Hours, Monday through Friday, from 12:30 pm to 1:30 pm CST: Strapi Discord Open Office Hours.
For more details, visit the Strapi documentation and Claude Code documentation.