Skip to content

joakimgunst/msp-next

Repository files navigation

Munksnäs Spejarna web site

This is the web site for the scout group Munksnäs Spejarna. It is located at www.munksnasspejarna.fi. The site is created using Next.js with Contentful as a CMS. It is deployed to Vercel.

Development with Vercel CLI

Using the Vercel CLI is currently only available to Joakim, as the project uses the free single-user Hobby plan.

Install the Vercel CLI:

npm i -g vercel

Login to Vercel:

vercel login

Link the project:

vercel

Download the environment variables:

vercel env pull

Run the development server:

vercel dev

Development without the Vercel CLI

Create an .env file with the following environment variables, which you can get from Joakim.

CONTENTFUL_SPACE_ID=<space_id>
CONTENTFUL_ACCESS_TOKEN=<access_token>
CONTENTFUL_PREVIEW_ACCESS_TOKEN=<preview_access_token>
CONTENTFUL_PREVIEW_SECRET=<preview_secret>

Run the development server:

yarn dev

Deployments

To deploy to a preview environment run:

vercel deploy

To manually deploy to production run:

vercel deploy --prod

A new production deployment is done automatically whenever code is pushed to the master branch on GitHub.

A webhook is also configured in Contentful so that a production deployment is done whenever there are changes in the content.

Contentful

Contentful types are automatically generated and are located in the src/contentful/types directory. To generate types, first create a personal access token in the Contentful app. You can then run:

export CONTENTFUL_MANAGEMENT_ACCESS_TOKEN=<token>
pnpm generate-contentful-types