Strapi with Nuxt using the Nuxt Strapi module

A practical guide to connecting a Nuxt app to a self-hosted Strapi 5 server with @nuxtjs/strapi, covering configuration, fetching, authentication, URLs and preview. It shows what your team builds and where the work usually goes wrong.

On this page

How does a Nuxt app connect to Strapi 5 with the Nuxt Strapi module?

A team with a Nuxt front end and a separately hosted Strapi server needs one reliable way to send requests from the app to the CMS. @nuxtjs/strapi is a Nuxt client for a separately hosted Strapi server. Its defaults point at STRAPI_URL or use the /api prefix, target Strapi v5 and store the login token in a strapi_jwt` cookie. The module does not run Strapi, host content or define your content types. Strapi runs as its own service with its own database, admin panel, backups and upgrade schedule, and the Nuxt app only calls its API. Confirm that the Strapi version you run matches the version the module is configured for before you write any fetch code, because the module supports v5, v4 and v3 and the default is v5.

The module's configuration determines how the connection behaves in each environment. Set the Strapi base URL through STRAPI_URL in your runtime environment rather than hard-coding it, and check the module's setup page for the option names that apply to your module version. The module's client-side calls and server-side calls can reach Strapi by different addresses. Inside your network, server-side rendering may need an internal hostname that the browser cannot resolve, while the browser needs the public HTTPS address. Decide which address each side uses, confirm that Strapi's CORS settings allow the public front-end origin, and test both paths from the environments where the app will run.

Authentication and preview add the last decisions. The strapi_jwt cookie holds the session that the module's composables use for signed-in requests, so the cookie's domain, path, secure flag and lifetime must fit the way your Nuxt and Strapi hosts are arranged. Public content can usually be fetched without a login, but draft preview needs a signed-in editor or a preview token, and that flow must be checked end to end on staging. Ask your team to confirm how Strapi's Users and Permissions settings and token lifetimes apply to your app before go-live, and plan a test that signs in, reads a draft, and signs out.

What you need before connecting Nuxt to Strapi

The module connects two separately running systems: a Strapi 5 server that owns the content and a Nuxt app that reads it. Each card below is a prerequisite that is easy to skip and expensive to discover during integration, so confirm them before you install anything.

A running Strapi 5 server

The Nuxt module is a client for a Strapi server that you host separately, so the server must exist and start before any Nuxt work begins. This page targets Strapi 5. The module also supports v4 and v3, but the defaults assume v5, including the /api prefix and the v5 response format. Confirm the Strapi version you will run against the official installation requirements, and check that your Strapi project starts cleanly on its own before adding Nuxt.

Strapi installation requirements

A supported database and Node.js version

Strapi 5 does not support MongoDB or other NoSQL databases. Its supported relational options are PostgreSQL 14 or later, MySQL 8.0 or later, MariaDB 10.3 or later and SQLite 3, and it runs only on Active or Maintenance LTS Node.js versions. Pick the database before you create content types, because switching later is a migration project. Confirm the current Node.js LTS status for your target release against the official docs, since the supported range changes over time.

A Nuxt project with a planned rendering mode

You need an existing Nuxt project, or a plan to create one, with a decision on how pages will render. Fetching on the server during rendering and fetching in the browser behave differently, and the module's options depend on which one you use. Confirm the Nuxt version you target against the current Nuxt and module documentation, because the module and Nuxt release on their own schedules.

Strapi URLs reachable from server and browser

Nuxt code runs on the server during rendering and in the browser after hydration, and each context may need a different address for Strapi. A value such as ` works on a developer machine but fails inside a container or on a deployed Nuxt server. Plan one URL for server-side requests, one public URL for browser requests and the CORS settings that allow the browser origin. Decide these values per environment before you write any configuration.

Nuxt Strapi module setup

Content types and permissions the front end needs

Each page you render needs a content type in Strapi and a permission that lets the front end read it. Public read access is the simplest option for published content, while authenticated access requires the Users and Permissions plugin and a login flow in Nuxt. Map every page or component to its content types, then set the public or authenticated role for each read action. Test with an unauthenticated request before blaming the Nuxt code when a request returns 403.

Environment variables and a version check

The module reads its Strapi address from the STRAPI_URL environment variable and falls back to a local default when it is absent. Decide where that value comes from in each environment, such as a local .env file, CI secrets or your hosting platform, and keep it out of version control. Also record the Strapi and module versions you tested, so an upgrade of either one starts from a known baseline.

How to configure the Nuxt Strapi module step by step

This sequence takes a Nuxt app from no Strapi connection to a verified first request, with each step ending in a check you can see in the browser or on the server. It assumes a Strapi 5 server is already running and reachable from your Nuxt project.

  1. Confirm the Strapi 5 server is reachable

    Before touching the Nuxt project, the developer who owns the Strapi server confirms that it runs and that its REST API responds at the base address you plan to use. Open the base URL and the /api path for a content type that already has published entries in a browser or with curl. If the Strapi server runs on a different host or port from the one you expect, record the exact address now, because the next steps depend on it. Done means a published collection returns JSON from the Strapi server, not from the Nuxt app.

  2. Install the module in the Nuxt project

    In the Nuxt project directory, the developer adds the @nuxtjs/strapi package with the package manager the team already uses, then commits the lockfile change. Check the module's compatibility notes for the Nuxt major version in use, since the module is maintained separately from Nuxt itself. Done means the package appears in package.json and the install completes without peer dependency errors.

  3. Register the module in nuxt configuration

    The developer adds @nuxtjs/strapi to the modules array in nuxt.config.ts and places a strapi block beside it for options. Keep the block minimal at first, so that defaults such as the /api prefix and the v5 version apply, and add overrides only when a requirement calls for them. Done means the dev server starts without a module load error and the Nuxt log shows no warning about the Strapi configuration.

  4. Set the Strapi URL for each environment

    The developer sets the Strapi address through the STRAPI_URL environment variable, which keeps the value out of source control and lets each environment point to its own server. When the variable is absent, the module falls back to so a local Strapi instance works without extra configuration. Confirm the value in a .env` file for development and in the deployment environment for other stages. Done means the Nuxt server log or the module's resolved configuration shows the expected address.

  5. Confirm the API prefix and Strapi version

    The developer checks that the resolved configuration uses the /api prefix and the v5 version, which are the module defaults, and matches both to the Strapi server. A mismatch here usually produces 404 responses or unexpected response shapes rather than a clear startup error. Compare one returned entry against the Strapi content type in the admin panel to confirm the field names. Done means the configured prefix and version match the server and the sample entry has the fields you expect.

  6. Run a first collection fetch

    In a page or component, the developer calls the module's fetch composable against a published collection, such as articles, and renders the result in a simple list. Start with a collection that has public read permission in Strapi, since permission errors are the most common cause of an empty response at this stage. Open the browser network tab or the Nuxt server log and look for the request to the Strapi address returning a success status with entries. Done means the list renders real entries from the Strapi server, and the request is visible with its expected path.

  7. Verify the request path on the server

    The developer loads the same page with server-side rendering enabled and checks the server log to confirm that the fetch runs against the server URL, not the browser. Then reloads the page on client navigation and confirms the browser request goes to the address the browser can reach. If the two addresses differ, note which one is needed for each path before going further. Done means both the server render and the client request return the same entries, with no CORS or connection errors in the browser console.

Server versus client URLs: which address each request uses

During server-side rendering, the Nuxt server process calls Strapi directly. That process usually runs inside your private network, next to the Strapi container or host, so it can reach an internal address such as a service name or a private IP that browsers cannot resolve. Calls from the server are not subject to browser CORS checks, which means a server-side request can succeed even when the origin list in Strapi does not include the Nuxt domain.

  • URL to use: set the server-side base URL to the address the Nuxt server can reach, typically an internal hostname or the local address on the same host.
  • Network path: confirm that the Nuxt runtime can resolve and route to that address, including inside containers and build pipelines.
  • CORS: server calls do not depend on CORS, so a passing server fetch does not prove the browser can call Strapi.
  • Timeouts and TLS: internal hops may use plain HTTP or a private certificate authority, so verify the trust chain used by the Nuxt process.
  • Build-time fetches: if you prerender pages, the build machine needs the same reachability as the server.

Confirm the setting by requesting a known collection from the Nuxt server logs or a server route and checking the response code from the production runtime, not from your laptop.

Using composables for fetching and end-user authentication

The module gives Nuxt code a small set of composables for talking to Strapi, so pages do not build raw requests by hand. Use the collection and single type reads for content that editors manage, and keep each call tied to the content type it serves so that a schema change in Strapi shows up in one place. Authentication is handled by a separate composable that signs an end user in and stores the result. Confirm the exact composable names and their signatures against the version of @nuxtjs/strapi you install, because the module's API is the part most likely to change between releases.

The module keeps the login token in a cookie named strapi_jwt by default. That token is issued by the Users and Permissions plugin when an end user logs in through the Strapi auth routes, and it is what the Nuxt server sends back to Strapi on later requests. Treat this cookie as a session credential: check its name, path, expiry and httpOnly and secure flags in your environment, and make sure the server side, not the browser, reads it wherever the data is sensitive. End-user login is a different system from admin SSO. Strapi's SSO feature applies only to administrator login to the admin panel through an identity provider, so configuring it does nothing for the people signing in to your Nuxt site.

Before you ship, map every route the Nuxt app calls and mark it as public or token-protected in the Users and Permissions settings for each role. Confirm that public read permissions expose only the fields you intend, and that protected routes return a 401 or 403 when called without a valid strapi_jwt token. Test this with a request that has no cookie, an expired token and a token for a role with fewer permissions. A route that works in the Nuxt app for a logged-in user can still be open to anonymous callers if the permission was set on the wrong role.

How a Nuxt request reaches Strapi and returns content

The flow starts in the browser, which requests a page from the Nuxt app. For server-rendered data, the Nuxt server calls Strapi's REST API over the private network using the server URL, and Strapi reads the content from its database and returns JSON. The /api prefix and the strapi_jwt cookie travel with requests that need a signed-in user, so check that the cookie is set for the Nuxt domain and that the browser only calls Strapi directly where the public URL is intended.

Request path from the browser through the Nuxt server to Strapi and its database.

How Strapi fields and Nuxt data models line up

This table maps each part of a Strapi 5 REST response to what your Nuxt code should expect after fetching it. Read it as a checklist: confirm each row against a real response from your own Strapi instance before you type composables or components. The main takeaway is that Strapi 5 identifies entries by documentId and returns attributes at the top level, so code copied from v4 examples often breaks at the first field access.

Strapi elementWhat the Nuxt side receivesWhat to verify in your project
Collection response wrapperAn object with a data array and a meta object, unwrapped in your composable before useLog one raw response from your endpoint and confirm the wrapper matches the format your module version expects
Entry identifierdocumentId is the stable key for fetching, updating and linking one entryDo not rely on numeric id in route params or cache keys if your team has v4 code
AttributesFields such as title and slug sit directly on each item rather than under a nested attributes objectCheck whether any v4-era component still reads item.attributes.title and update it
Media fieldsUploads come back as objects with url and format data, and the URL may be relative to the Strapi hostConfirm how your module or helper prefixes the Strapi base URL for images
Single relationsA populated relation is a nested object with its own documentId and fields only when populate is requestedCompare the output with and without populate to see which fields are absent by default
Components and dynamic zonesReturned as arrays or objects tagged with __component, which your renderer maps to Vue componentsTest one dynamic zone block and confirm the __component value matches your component name
Response format headerStrapi-Response-Format: v4 can request the older shape during migration, if your Strapi version supports itConfirm whether your team uses this header and remove it once all consumers are updated
Generated TypeScript typesInterfaces you write or generate should mirror the flattened Strapi 5 shape with documentIdRegenerate or review types after each Strapi schema change, since types drift silently

Securing the Nuxt to Strapi connection

A Nuxt app talking to Strapi creates three trust boundaries: the server-to-Strapi call, the browser session and the preview route. The cards below cover where the Strapi URL and tokens live, what anonymous users can read, how the session cookie is set, which origins may call the API and who can open draft content. Confirm each setting in your own environment before launch.

Keep the Strapi URL and tokens server-side

The module reads the Strapi address from configuration such as STRAPI_URL, which defaults to when unset. Put the server address and any API token in server-side runtime config so they are not exposed to the browser bundle. Use the public runtime config only for values that are safe to reveal. In your build, check the client bundle and page source for the Strapi host and any secret string before release. Confirm the exact key names against the module setup guide for your module version.

Nuxt Strapi setup

Limit public permissions in Strapi

Anonymous requests use the Public role in Strapi's Users and Permissions plugin. Grant find and findOne only on content types that the public site must show, and leave create, update and delete closed to anonymous users. Review each field and relation the public role can read, since populate can expose related content types. Test the permission set by calling the API without a token from outside the Nuxt server and confirm that restricted content returns a denial.

Set strapi_jwt cookie flags

The module stores the user session in a strapi_jwt cookie. Confirm in your environment that the cookie is marked HttpOnly so scripts cannot read it, that it is marked Secure so it travels only over HTTPS, and that its SameSite value matches your login flow. Shorten session lifetime where editors or end users handle sensitive data. Verify the flags in the browser developer tools after a real login, because defaults and overrides in module options can change them.

Restrict CORS to the Nuxt origins

Strapi's CORS settings decide which browser origins may call its API. List only the production and staging Nuxt origins, and avoid a wildcard when requests carry credentials. Browser calls made from the client should go through the origin you list, while server-side fetches from the Nuxt server do not depend on CORS. Confirm the allowed origins with a request from an unlisted origin, which should fail. Review the Strapi security configuration documentation for the settings that apply to your version.

Protect preview access

Preview shows draft content, so the preview route needs its own control. Require an authenticated editor or a signed, short-lived token before the Nuxt preview page renders drafts, and never reuse the public fetch path for it. Confirm that a preview URL opened without a session returns published content only. For editor logins to the Strapi admin panel, decide whether SSO applies, since Strapi SSO covers administrator access only and does not replace end-user login.

Strapi SSO docs

Keep the Strapi admin off the public path

The Nuxt app should not be the only barrier protecting the CMS. Decide whether the Strapi admin panel is reachable from the internet or only from an internal network or VPN, and confirm that the API host is reachable only at the paths the front end needs. Plan secret rotation for the API token and for the JWT secrets Strapi uses, and record who may change them. Confirm these choices with your platform team and the hosting setup you run.

Setting up preview for drafts in Nuxt

Preview is a different read path from publishing, and it needs its own rules. A published page reads only entries that are live, so anonymous visitors can receive it from a cache or a static build. A preview shows what an editor has saved but not yet published, which means the Nuxt app has to ask Strapi for draft versions. Strapi 5 keeps draft and published states on the same document, so the request that returns the draft must carry credentials that Strapi accepts for that draft. Anything that lets an unauthenticated browser request draft data turns the preview route into a public window onto unreleased content, so treat the draft read as a privileged call from the start.

Restrict the preview route to editors before you write any fetch logic. In the Nuxt app, the preview route should check for an editor session or a signed preview token before it calls Strapi, and it should refuse to render drafts for anyone else. On the Strapi side, confirm which role and permissions the token or session uses, and keep that role limited to reading the content types that editors preview. Do not reuse a broad API token from another integration. Also confirm whether the strapi_jwt cookie that @nuxtjs/strapi sets is sent on the server request you use for preview, because that decides whether the draft read runs as the editor or as the public role.

Confirm the exact preview mechanism before you build it. This page does not assume one implementation. Check the @nuxtjs/strapi module documentation and the Nuxt Strapi module setup guide for supported options, then check the preview configuration in your Strapi project, including the preview URL and the admin panel settings your editors use. Test with an unpublished entry, a published entry with unsaved edits, and an anonymous browser session. The anonymous session should see only published content, and the editor session should see the draft. Record which Nuxt route, cookie and Strapi role each step used so that a later module upgrade does not silently change who can read drafts.

Why Nuxt cannot reach Strapi and how to fix it

This table lists the failures that most often stop a Nuxt app from reading Strapi 5 content through @nuxtjs/strapi, with the likely cause and the first fix to try for each. Work down the rows in order, because a wrong URL or missing prefix can produce errors that look like permission or CORS problems. Confirm each fix against your own server and browser logs before changing anything else.

SymptomLikely causeFirst fix to try
Requests work on the server but fail in the browserSTRAPI_URL points to an address only the Nuxt server can resolve, such as a Docker service name or an internal hostnameSet a public Strapi URL for client requests and confirm the browser can open it directly
Data loads during server rendering but not after navigationThe client-side base URL is still or another development addressCheck the module's runtime configuration and set the public Strapi address for production builds
404 responses on every content requestThe /api prefix is missing from the base URL or was removed from the module's API path settingConfirm the request path begins with /api and matches the Strapi REST route for the collection
Browser console shows a CORS errorThe Nuxt origin is not in Strapi's allowed origins, or the request uses headers Strapi does not acceptAdd the Nuxt site origin to the CORS settings in config/middlewares and restart Strapi
403 Forbidden on public contentThe Public role in the Users & Permissions plugin does not allow find or findOne for that content typeEnable read permissions for the Public role on the content type, then save and retest
401 or user data missing after loginThe strapi_jwt cookie is absent, expired or not sent because the Nuxt and Strapi domains differConfirm the cookie is set after login, check its expiry, and test on the same site domain
Requests fail after a Strapi upgradeThe module expects the v5 default, but the Strapi server or response format is v4Match the module's version option to the running Strapi major version and check the response shape
Field values are undefined in templatesThe response is in the Strapi 5 flat format, but code reads the older nested attributes structureRead fields directly from each entry and compare one live response with your component's expectations

Questions teams ask before connecting Nuxt to Strapi

How much effort does connecting Nuxt to Strapi take?

The module itself is a small part of the work. Effort depends on how many content types the front end reads, how complex the relations and dynamic zones are, whether pages need preview, and how many environments must share one setup. A basic read-only connection to a few collections is far smaller than a site with multiple locales, draft preview and role-aware editing. Ask any partner to size the work from your content model and page list rather than from the module alone. Hosting Strapi is a separate cost. The Strapi self-hosted and Cloud pricing pages list current plan prices, which you should compare with your own infrastructure costs.

How long does a Nuxt and Strapi integration typically run?

Timing is best understood in stages rather than as a fixed duration. The usual stages are confirming the content model and environments, configuring the module and server and client URLs, building the data fetching and any authentication, adding preview, then testing and handover. Each stage depends on how many pages depend on the content and how quickly your team can review decisions. A written scope should list these stages with the deliverable and sign-off for each, so timing follows from agreed work rather than an estimate in the abstract.

What does our team need to provide before the work starts?

Three things unblock most projects: administrator access to the Strapi project or a dedicated test instance, a documented content model with content types, components, relations and locales, and agreed environments such as local, staging and production with their URLs. You should also provide the Nuxt project repository, the hosting platform for the front end, and a named person who can approve content model changes. Ask for these items to be listed in the written scope so that delays caused by missing access are visible early.

Can an in-house team connect Nuxt to Strapi without a partner?

Yes, if the team already knows Nuxt and Strapi well and the scope is limited to reading a few content types. The module documents its defaults and options, including the server URL, the /api prefix, the Strapi v5 version setting and the strapi_jwt cookie used for authentication. Teams usually need outside help when preview, authenticated editor sessions, server and client URL separation across environments, or a Strapi 4 to 5 migration are in scope. Assess your own skills against those items before deciding.

Which Strapi version does the Nuxt Strapi module expect?

The module defaults to Strapi v5 and also supports v4 and v3 through configuration. Strapi v4 reached end of life on April 30, 2026, and its final release was 4.26.2, so new projects should target Strapi 5. If you have an existing Strapi 4 backend, plan the Strapi upgrade as its own workstream, since the response format and Document Service API changed. Confirm the exact module version and Strapi version pairing in the module documentation before you write any code.

What goes wrong with server and client URLs, and how do we avoid it?

The most common fault is using an address that the browser cannot reach, such as a private network hostname, in code that runs in the browser. Server-side rendering can reach the Strapi host through an internal address, while client-side requests need the public address and correct CORS settings. Define both URLs per environment, test requests from the browser and from the server, and check that the strapi_jwt cookie is set on the right domain. Your security team should also review which Strapi routes are public, since the front end can only read what the permissions allow.

Can DeployOpen take on the Nuxt and Strapi integration?

DeployOpen plans, implements, customizes and documents self-hosted open-source platforms inside your own cloud accounts, data centers or air-gapped networks, and most engagements are fixed-scope with scope, deliverables and timelines agreed in writing before work starts. A quote follows from that written scope, and DeployOpen does not publish a price list. Work on Strapi that touches the front end, authentication or hosting can be scoped together with the rest of the platform. Ask for a written scope that lists the environments, content types and preview requirements you need.

How DeployOpen scopes and delivers the Nuxt and Strapi integration

DeployOpen plans and builds the connection between a Nuxt front end and a self-hosted Strapi 5 server inside infrastructure you control. Each engagement starts with a written scope that fixes the URLs, module options, authentication flows and preview behavior before any code is written.

How we scope

  • We confirm your Strapi 5 version, database and Node.js runtime before choosing how Nuxt will reach the server.
  • The written scope lists which content types, components and routes the Nuxt app will fetch, and which need preview.
  • We document server-side and browser-side URL needs, including which environment variables each deployment environment receives.
  • Engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts.

How we build

  • We configure @nuxtjs/strapi with the URL, API prefix and version options your Strapi instance requires.
  • We build composables for fetching collections and single types, and for end-user sign-in through the strapi_jwt cookie.
  • We separate server URLs from public client URLs so internal addresses never reach browser code.
  • We implement preview routes that only fetch draft content for authorized editors, and test them against your Strapi setup.

How we hand over

  • You receive the Nuxt project, configuration files and environment variable documentation for each environment.
  • We deliver test evidence for fetching, authentication, cookie handling and preview behavior across the agreed routes.
  • Runbooks explain how to change the Strapi URL, rotate credentials and update the module when Strapi releases ship.
  • We walk your front-end and CMS teams through the integration so they can maintain it after handover.

How we support

  • Ongoing support, module upgrades and continuous testing are available as retainers after handover.
  • Retainers can cover upgrades when Nuxt, the Strapi module or Strapi 5 minor releases change the integration.
  • Confirm with us during scoping which support hours, response paths and upgrade reviews a retainer would include.
  • Strapi and Nuxt version changes are reviewed against your written scope before they reach production.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.