These integration guides are not official documentation and the Strapi Support Team will not provide assistance with them.
Gridsome is a Vue.js-based static site generator that follows the PRPL pattern (Push, Render, Pre-cache, Lazy Load). It generates static HTML that loads quickly and then hydrates into a Vue.js Single-Page Application.
By integrating Gridsome with Strapi, you can take advantage of pre-rendered pages at build time, making content instantly available to users and search engines. This integration boosts page load times and enhances SEO performance.
Gridsome's data layer uses GraphQL to query content from various sources, simplifying the creation of complex, data-driven websites. Vue.js developers will appreciate Gridsome's gentle learning curve, along with benefits like:
Gridsome is ideal for modern JAMstack applications. By decoupling the frontend from the backend, you can build secure, scalable websites that are easily deployed to CDNs around the world.
When integrating Gridsome with Strapi, content is fetched at build time to generate static pages, combining the flexibility of a CMS with the high performance of static sites.
Integrating Gridsome with Strapi creates a powerful JAMstack architecture that separates content management from presentation.
Strapi, the leading open-source headless CMS, offers a user-friendly interface and robust API capabilities, including both RESTful and GraphQL endpoints. Strapi’s flexible content modeling, which supports custom fields in Strapi, allows you to structure data precisely as needed, making it an excellent backend for Gridsome sites.
This integration is perfect for developers seeking customizability and powerful API capabilities. For more insights into how Strapi compares to other CMS options, check out Strapi vs. Contentful.
Before starting, ensure your environment has:
Install the Gridsome CLI globally:
1
2
3
yarn global add @gridsome/cli
# OR
npm install --global @gridsome/cliCreate a new project:
1
2
3
gridsome create your-project-name
cd your-project-name
gridsome develop
This starts a development server at localhost:8080.
Set up Strapi and define your content types through the Strapi admin panel.
Install the source plugin:
1
yarn add @gridsome/source-strapiConfigure in gridsome.config.js:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module.exports = {
siteName: 'Your Site Name',
plugins: [
{
use: '@gridsome/source-strapi',
options: {
apiURL: 'http://localhost:1337',
queryLimit: 1000,
contentTypes: ['article', 'category'],
singleTypes: ['general'],
// Optional: For authenticated APIs
// loginData: {
// identifier: '',
// password: ''
// }
},
},
],
}Configure API permissions in Strapi:
For production:
1. Environment Variables: Use for sensitive information:
1
GRIDSOME_API_URL=https://your-production-strapi-url.com2. Update gridsome.config.js:
1
apiURL: process.env.GRIDSOME_API_URL,3. CORS Configuration: Allow requests from your Gridsome domain.
4. Build Process: Set up CI/CD that rebuilds your Gridsome site when content changes.
5. Static File Hosting: Deploy to a CDN or static host for optimal performance.
Gridsome offers built-in image optimization that works with Strapi's media library:
Use Gridsome's image component with Strapi images:
1
2
3
4
5
6
<g-image
:src="course.featuredImage.url"
:alt="course.title"
width="500"
quality="80"
/>
Configure Strapi to upload assets to cloud storage like AWS S3 or Cloudinary for better performance.
Gridsome's GraphQL data layer enables precise data retrieval:
1. Static Site Generation: Content is pulled at build time, eliminating runtime API calls.
2. GraphQL Queries: Fetch only necessary data:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
query {
allStrapiCourse(filter: { status: { eq: "published" } }) {
edges {
node {
id
title
description
slug
featuredImage {
url
}
categories {
id
name
}
}
}
}
}
3. Pagination and Filtering: Implement server-side pagination to avoid over-fetching.
Here's how to use Gridsome and Strapi to build a learning platform.
Our learning platform features:
The team implemented:
Results:
The integration delivered:
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 the Gridsome documentation.