kapsys logo
build a website with next js
Back to blog
  • User Experience

Building an Efficient Website on Vercel using Next.js and Strapi

24 August 2023 by Sara Wahba

The digital landscape today demands efficient, fast, and scalable websites. If you've been seeking a combination of tools to achieve this, look no further: Next.js for frontend development, Strapi as your headless CMS, and Vercel for deployment create the trifecta of web efficiency. In this guide, Kapsys will take a deep dive into how to build a website with Next.js and leverage the power of Strapi, all while deploying seamlessly on Vercel.

Sign up to our blog to stay tuned about the latest industry news.

Why Choose Next.js, Strapi, and Vercel?

Choosing the right stack for your web application can significantly affect performance, development speed, and scalability. Among the myriad options available, Next.js, Strapi, and Vercel have become a potent combination for many developers and businesses. Let's explore why this trio stands out:

  • Next.js: An open-source React framework, Next.js offers hybrid static & server rendering, TypeScript support, smart bundling, route pre-fetching, and more - making it a top choice for modern web development.
  • Strapi: As a headless CMS, Strapi provides the flexibility of integrating with any frontend framework or application, allowing you to manage your content effortlessly.
  • Vercel: Known for its speed and efficiency, Vercel is the optimal deployment platform for Next.js applications. It provides a smooth CI/CD process, global CDN, and enhanced performance.

Setting Up Next.js 

To get started, you'll want to create a new Next.js application:


npx create-next-app my-next-site


Navigate to your new project:

cd my-next-site


And run your application:

npm run dev



You'll now have a Next.js application running on your local server. Time to integrate Strapi!

Setting up Strapi

For those new to Strapi, it's a flexible, open-source Headless CMS that can be used with any database, making it versatile and fit for any project.

Begin by installing Strapi:

npx create-strapi-app my-strapi-app --quickstart

The --quickstart flag will set up Strapi using SQLite as your database. Once Strapi is up and running, create content types, add some content, and set permissions to access this content publicly.


Integrating Next.js with Strapi

Now that your Next.js application and Strapi CMS are set up, it's time to connect them. This is where the magic happens, allowing you to build a website with Next.js that pulls dynamic content from Strapi.

Start by installing the axios library to help fetch data:

npm install axios

In your Next.js application, you can now fetch data from Strapi:

import axios from 'axios';

export async function getStaticProps() {
  const { data } = await axios.get('http://localhost:1337/posts');
  return {
    props: {
      posts: data

With this setup, your Next.js application will fetch posts from your Strapi CMS during build time.

Deploying on Vercel

Deployment is the final step in this journey. With Vercel, this step is as seamless as the development process.

First, push your Next.js project to a GitHub, GitLab, or Bitbucket repository. Then, go to Vercel and sign up (or log in). Import your project, and Vercel will do the rest. It will automatically detect that it's a Next.js app, build it, and deploy it to a global CDN.

For Strapi, you might want to deploy it on platforms like Heroku, DigitalOcean, or any cloud platform you choose. Just ensure you update the endpoint in your Next.js app to match the deployed Strapi URL.

build a website with next js


To build a website with Next.js, combined with Strapi and Vercel, is to choose efficiency, scalability, and speed. This trio ensures that you are not just creating a site but building an experience that is fast for users, easy to manage for developers, and scalable for the long haul. Dive into this powerful combination and witness the future of web development firsthand.