Getting started
Setup repository
This project is a Github template, you can click Use this template to create a repository with a single init commit. As soon as you have a repository, proceed with the setup.
- Clone repository locally
- Install dependencies
Provision a Contentful space
To develop locally, you will want to connect to a Contentful instance that has the same data model as we use to develop, there are 2 ways to do that:
Provision Contentful Marketing Template space
You could get access to an existing space that follows Contentful Marketing Template content model, for example a colleague could share his space with you, or alternatively you can create a new one. Contentful lets you create a new space from a template, but only for new accounts
Follow instructions here to create a new space from a template.
While this method works now because our template uses the same content model, we will add new content types in future and this option will be removed.
Provision a new space with our seed script
You can start from scratch and use our seed script to provision the content model and content. First you will need to create an account and a space. You can follow first set of instructions here
After you have a space, let's login to Contentful CLI (it's installed as a dev dependency in the project)
Once you are logged in, you can provision the new space with a new content model and content using our seed script:
Configure environment variables
Once a space with content is provisioned, time to configure Next.js app to connect to it.
You will want to get a CDA and CPA API keys by using this guide
Create .env.local
in apps/marketing
directory of the repo with the following contents:
Run Next.js Dev Server
or run both Next.js and Storybook dev servers with:
Open http://localhost:3000 with your browser to see the result.
What's next?
Now that you have a working setup, you can start exploring the code and building your own components and pages, here are some suggestions:
- Create a new UI component in
packages/ui
package - Create a new content type in Contentful and integrate it in the project
- Explore out data-fetching choices and tweak them to your needs
You can learn more about those topics in dedicated sections of this documentation.