Next starter for creating a corporate site with Strapi.
This starter is designed for flexibility. Using it, you'll be able to manage your website content entirely in Strapi, and get a Next app automatically generated. Marketing teams will be able to create pages and design their layout without help from developers.
This starter features:
- Pages creation within Strapi, no code necessary
- Fully flexible page structure: design the pages you want using UI Sections
- 8 UI Sections out of the box: Hero, RichText, LargeVideo, Testimonials, Pricing, BottomActions, FeatureRows, FeatureColumns
- Easy to theme with Tailwind
- Static site generation with Next
- An integrated Preview Mode, to view your pages on a private URL before publishing them
Let's see how you can build your own website using this starter. We're going to fork this repository, then publish it on Heroku and Vercel.
Start by forking this GitHub repository. You can also download it as a zip, then publish it on your own GitHub account. The goal is to get a repository that you own, where you'll be able to make changes later.
Create a Heroku account if you don't have one already. Then, from your dashboard, create a new Heroku app.
Then select GitHub as the deployment method, and connect the fork that we just created.
Start by creating a Cloudinary account if you don't have one. We'll use it to host the medias uploaded in Strapi. You can find your credentials on the Cloudinary console.
We now need to do some configuration in Heroku. In the settings tab, reveal your Config Vars and enter the following:
PROJECT_PATH: set "back", since it's the path of our Strapi project within the repoCLOUDINARY_CLOUD_NAME: the cloud name of your Cloudinary accountCLOUDINARY_API_KEY: the API key of your Cloudinary accountCLOUDINARY_API_SECRET: the API secret of your Cloudinary accountADMIN_JWT_SECRET: a random token for security reasons
On the same page, let's set up our buildpacks. We'll use the subdir buildpack, that you can add using this URL: https://github.com/timanovsky/subdir-heroku-buildpack . Then add the official Node.js buildpack. Make sure they are in this order: subdir first, Node second.
Finally, let's setup a database. In the Resources tab, search for the "Heroku Postgres" addon, and select the free tier. And that's it – we now have a Postgres database linked to our project.
We'll now need the Heroku CLI, so install it if you don't have it already. Then run heroku login to make sure you are authenticated. To import the dummy content we have prepared, run this command:
heroku pg:backups:restore 'https://cdn.jsdelivr.net/gh/strapi/strapi-starter-next-corporate@latest/data.dump' DATABASE_URL -a my-heroku-appRemember to replace my-heroku-app by the name of your app on Heroku, but leave the rest unchanged. We have now imported a Postgres backup.
Everything is now set up for the backend, we can actually start it. On the Heroku Deploy tab, click on "Deploy Branch". You can also enable automatic deploys if you want. Wait for the app to compile then click on "Open app". You should see your Strapi app!
Go to the /admin path no Strapi and create an admin user. You now have access to the Strapi admin.
Let's deploy our frontend on Vercel. Since it's a statically generated site, we could also host it on Netlify, Amazon S3, or any other CDN. But we'll only cover Vercel in this guide.
Create a Vercel account and go to the import page. Select "Import Git Repository", and paste the URL of your repo. Then, select the front directory as the root of our website.
Then, in the "Environment Variables" section of the form, add the following:
NEXT_PUBLIC_STRAPI_API_URL: the URL of your Strapi app on Heroku (without the trailing slash)PREVIEW_SECRET: a random token that you can chose. It will be used to access Next's preview mode.
Then click on Deploy and wait for the app to build. Your site should now be live!
There's still one more thing necessary to enable the preview mode. Go back to your Config Vars on Heroku, and add these:
FRONTEND_URL: the URL of your Next frontend (without the trailing slash)FRONTEND_PREVIEW_SECRET: the secret key you entered in Vercel earlier
We're using Next's static generation for our frontend. This means we need to trigger new builds when the content changes in Strapi. We'll use webhooks to do this automatically.
We first need to create a Deploy Hook in Vercel. In your project's settings, go to the end of the Git Integration tab. Name your hook however you want, but make sure you link it to your master branch.
Then copy the generated URL and open your Strapi admin in production. In the settings tab, open Webhooks and paste the hook URL. Make sure you check all events to trigger build after every change.
Now everytime we make a change in Strapi, Vercel creates a new build!
To edit this website, you'll need to run both the frontend and the backend in your development environment.
Open a terminal window and cd into the Strapi directory
cd backCopy the .env.example file in this directory to a .env file (which will be ignored by Git):
cp .env.example .envOut of the box, this starter connects to a Postgres database in production, and to an SQLite file in development. Feel free to change these configurations if you need.
Start running Strapi:
yarn developYou can view full backend documentation on the back directory Readme.
While the Strapi server is running, open a new terminal and cd into the Next.js app directory.
cd frontCopy the .env.local.example file in this directory to .env.local (which will be ignored by Git):
cp .env.local.example .env.localThen set each variable on .env.local:
STRAPI_PREVIEW_SECRETcan be any random string (but avoid spaces), likeMY_SECRET- this is used for Preview Mode.NEXT_PUBLIC_STRAPI_API_URLshould be set ashttp://localhost:1337(no trailing slash).
Finally, run Next in development mode.
yarn install
yarn devYou can view full frontend documentation on the front directory Readme.
We have built sections for you, but you will likely want to add more to fit your needs. Follow these steps:
- Create a new component in Strapi in the "sections" category
- In the Content-Types Builder, open the Pages collection and check your new section on the
contentSectionsfield. - Create a React component that takes a
dataprop in/front/components/sections - To link your Strapi section to this React component, open
/front/components/sections.js, and add an entry to thesectionComponentsobject.
We use Tailwind CSS for styling. To modify your page's look, you can edit the theme in /front/tailwind.config.js. Read the Tailwind docs to view all the changes you can make. For example, you can change the primary color like this:
const { colors } = require(`tailwindcss/defaultTheme`);
module.exports = {
theme: {
extend: {
colors: {
primary: colors.green,
},
},
},
};






