
Language 🇺🇸 English
Strapi Installation
Add Live Commenting to Strapi Sites
This guide adds the FastComments live commenting widget to a site whose content is managed in Strapi. Strapi is a headless CMS and does not render pages, so the widget is added to the frontend application that renders Strapi entries. Each comment thread is identified by the entry's documentId, so the thread stays attached to the entry when its slug or URL changes.
Strapi does not include a comment system for site visitors. The Strapi Marketplace lists third-party plugins for this, such as Comments (strapi-plugin-comments, maintained by Sensinum), which stores comments as content types in the Strapi database. FastComments stores comments on FastComments servers and does not require a Strapi plugin.
This tutorial requires a FastComments account. You can create an account here.
Step 1: Fetch the Entry's documentId 
In Strapi 5, a document groups the draft and published versions of an entry for every locale, and the REST API identifies a document by its documentId. Using the documentId as the FastComments thread ID keeps comments attached to the entry when its slug, title, or URL changes.
The frontend usually loads an entry by its slug. The examples in this guide use a collection type with the plural API ID articles and a slug field. Replace them with the names of your own content type and field.

The response contains the matching entries in the data array. Each entry includes its documentId:

Use data[0].documentId as the thread ID. Do not use the numeric id: in Strapi 5 it differs between locales of the same document.
Access to the REST API
Content types are private by default. To allow the frontend to read entries, do one of the following:
- In the admin panel, open Users & Permissions plugin > Roles, edit the Public role, enable the
findaction for the content type, and click Save. - Create a Read-only token in Settings > Global settings > API Tokens and send it in the
Authorization: Bearer <token>header. Send the token only from server-side code so that it is not exposed to browsers.
Published content and locales
The REST API returns the published version of documents unless the request sets status=draft. The documentId is the same for the draft and the published version.
All locales of a document share one documentId, so every locale of an entry shows the same comment thread. To keep a separate thread per locale, combine the two values, for example documentId + '-' + locale.
Strapi 4
In Strapi 4, the REST API response does not include documentId. Each entry has a numeric id and its fields are nested under attributes. Use data[0].id as the thread ID and read fields from data[0].attributes.
Step 2: Add the Widget in Next.js 
This step uses the Next.js App Router and the FastComments Next.js library, fastcomments-nextjs, which supports Next.js 13 to 16 with React 18 or 19. Install the library in the Next.js project:

Render the Widget on the Entry Page
The page is a Server Component. It fetches the entry from Strapi by slug and passes the entry's documentId to the comment widget as urlId. Create app/articles/[slug]/page.tsx:

If you are logged in to FastComments, the snippet above contains your tenant ID. Otherwise, replace demo with your tenant ID.
Set STRAPI_URL and STRAPI_API_TOKEN in the environment of the Next.js app, for example in .env.local. If the Public role has the find permission, remove the headers option. Replace https://example.com/articles/ with the public URL of your article pages.
urlIdidentifies the comment thread. It is set to the entry'sdocumentId.urlis the link to the page that FastComments uses in notifications.keymakes React mount a new widget when the reader navigates from one entry to another.- The
FastCommentscomponent declares'use client'itself, so it can be rendered from a Server Component without a wrapper.
In Next.js 14 and earlier, params is a plain object instead of a Promise, and await on it returns the same object.
EU Accounts
If your FastComments account is in the EU region, add region="eu" to the FastComments component.
Add the Widget Without a Framework Library 
Frontends that do not use React, such as Astro, Nuxt, or server-rendered templates, can load the widget with the FastComments script. The template that renders the entry writes the entry's documentId into a data-entry-id attribute, and the script passes it to the widget as urlId:

If you are logged in to FastComments, the snippet above contains your tenant ID. Otherwise, replace demo with your tenant ID.
Replace ENTRY_DOCUMENT_ID with the template expression for the entry's documentId. For example, in an Astro component the attribute is written as data-entry-id={article.documentId}, and in a Vue template as :data-entry-id="article.documentId".
If your FastComments account is in the EU region, load the script from https://cdn-eu.fastcomments.com/js/embed-v2.min.js and add region: 'eu' to the object passed to window.FastCommentsUI.
FastComments also provides component libraries for other frameworks, including Astro, Vue, and Svelte. With these libraries, pass the documentId as the urlId option of the comment widget.
Enable or Disable Comments per Entry 
A Boolean field on the content type lets editors turn comments off for individual entries. The frontend reads the field and renders the widget only when comments are enabled.
Add the Field in the Content-Type Builder
The Content-Type Builder is available only when Strapi runs in development mode.
- Open the Content-Type Builder and select the collection type, for example Article.
- Click Add another field and choose Boolean.
- Enter
commentsEnabledas the name. In the advanced settings, set the default value totrue. - Click Finish, then click Save.
The Content-Type Builder writes the field to the content type's schema.json file, for example src/api/article/content-types/article/schema.json. The attribute can also be added to that file directly:

Check the Field in the Frontend
The REST API returns the field with the other fields of the entry. In the Next.js page from Step 2, render the FastComments component only when the field is not false:

If you are logged in to FastComments, the snippet above contains your tenant ID. Otherwise, replace demo with your tenant ID.
The check uses !== false so that entries without a value for the field, such as entries created before the field was added, still show comments.
Hiding the widget does not delete the entry's existing comments. They are shown again when the field is set back to true.
Domain Errors 
The widget may show an authorization error like the following:
This error means the domain of the page is not in the list of domains allowed for your FastComments account.
Add the domain of the frontend that renders your Strapi content on the domain configuration page of your account. The domain of the Strapi admin panel and API is not needed, because the widget runs on the frontend pages.
Customization 
Styling and configuration options for the widget are described in the Customization Documentation.
With the Next.js library, configuration options are passed as props of the FastComments component. With the script embed, they are added to the object passed to window.FastCommentsUI.