This example showcases Next.js's Static Generation feature using esa as the data source.
- WordPress
- DatoCMS
- Sanity
- TakeShape
- Contentful
- Strapi
- Agility CMS
- Cosmic
- ButterCMS
- Storyblok
- Blog Starter
Execute create-next-app
with npm or Yarn to bootstrap the example:
npm init next-app --example cms-esa cms-esa-app
# or
yarn create next-app --example cms-esa cms-esa-app
Download the example:
curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/cms-esa
cd cms-esa
First, create an account on esa.
After creating an account, create a new team from the dashboard and assign any name to it.
From the dropdown next to the project name, click API Keys.
Create a new API Key with the Read permission.
Next, copy the .env.local.example
file in this directory to .env.local
(which will be ignored by Git):
cp .env.local.example .env.local
Then set each variable on .env.local
:
ESA_API_TOKEN
should be the API token you just copied.ESA_TEAM
should be the team name, which is a subdomain in the esa URL:https://<team>.esa.io/
Your .env.local
file should look like this:
ESA_API_TOKEN=...
ESA_TEAM=...
npm install
npm run dev
# or
yarn install
yarn dev
Your blog should be up and running on http://localhost:3000! If it doesn't work, post on GitHub discussions.
You can deploy this app to the cloud with Vercel (Documentation).
To deploy your local project to Vercel, push it to GitHub/GitLab/Bitbucket and import to Vercel.
Important: When you import your project on Vercel, make sure to click on Environment Variables and set them to match your .env.local
file.