Does Express Work With Strapi?
Express and Strapi work together seamlessly—use Strapi as a headless CMS backend and Express as a separate frontend or custom API layer.
Quick Facts
How Express Works With Strapi
Express and Strapi don't integrate directly because they serve different purposes: Strapi is a complete headless CMS with its own Express-based server, while Express is a minimal framework for building custom APIs. The practical approach is to run them as separate services. Strapi exposes a REST API (and GraphQL) that your Express app consumes via HTTP requests. Your Express server becomes the frontend or a custom middleware layer that fetches content from Strapi, processes it, and serves it to clients. This architecture is ideal for decoupled systems where you want Strapi handling content management and Express handling custom business logic, authentication, or presentation. Both are Node.js-based, so deployment, environment configuration, and tooling are aligned. You'll manage two separate processes—typically with Strapi on port 1337 and Express on port 3000—and call Strapi's REST endpoints using libraries like axios or node-fetch.
Best Use Cases
Express consuming Strapi REST API
npm install express axios dotenvconst express = require('express');
const axios = require('axios');
require('dotenv').config();
const app = express();
const STRAPI_URL = process.env.STRAPI_URL || 'http://localhost:1337';
const STRAPI_TOKEN = process.env.STRAPI_API_TOKEN;
app.get('/posts', async (req, res) => {
try {
const response = await axios.get(
`${STRAPI_URL}/api/posts?populate=*`,
{
headers: {
Authorization: `Bearer ${STRAPI_TOKEN}`
}
}
);
res.json(response.data.data);
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.listen(3000, () => {
console.log('Express server on :3000, consuming Strapi at', STRAPI_URL);
});Known Issues & Gotchas
CORS issues when Express frontend calls Strapi API from browser
Fix: Configure Strapi's CORS settings in config/middlewares.js to allow your Express app's domain, or proxy Strapi requests through Express to avoid client-side CORS entirely
No built-in request authentication between Express and Strapi
Fix: Use API tokens in Strapi and include them in Express server-to-server requests via Authorization headers; never expose tokens to clients
Duplicated environment management across two separate Node.js processes
Fix: Use a monorepo structure with shared .env files or orchestrate both services with Docker Compose for consistent configuration
Strapi's automatic admin panel increases memory footprint; not lightweight like Express alone
Fix: Run Strapi and Express on separate servers if resource-constrained, or containerize both for independent scaling
Alternatives
- •Next.js with Strapi—Next.js provides built-in API routes (like Express) plus React frontend, reducing setup overhead
- •Fastify with Strapi—similar decoupled architecture but with better performance for high-traffic APIs
- •Contentful + Express—managed headless CMS alternative if you prefer SaaS over self-hosted Strapi
Resources
Related Compatibility Guides
Explore more compatibility guides