datocms / nextjs-starter-kit

https://datocms-nextjs-starter-kit.vercel.app/
8 stars 0 forks source link

šŸ‘‰ Visit the DatoCMS homepage or see What is DatoCMS?


Next.js Starter Kit

This project aims to be a great starting point for your Next.js projects that need to interact with DatoCMS.

How to use

Quick start

  1. Create an account on DatoCMS.

  2. Make sure that you have set up the Github integration on Vercel.

  3. Let DatoCMS set everything up for you clicking this button below:

Deploy with DatoCMS

Local setup

Once the setup of the project and repo is done, clone the repo locally.

Set up environment variables

Copy the sample .env file:

cp .env.local.example .env.local

In your DatoCMS' project, go to the Settings menu at the top and click API tokens.

Copy the values of the following tokens into the specified environment variable:

Then set SECRET_API_TOKEN as a sicure string ā€” it will be used to safeguard all route handlers from incoming requests from untrusted sources.

Run your project locally

npm install
npm run dev

Your website should be up and running on http://localhost:3000!

VS Code

It is highly recommended to follow these instructions for an optimal experience with Visual Studio Code, including features like diagnostics, auto-completions, and type hovers for GraphQL.

Updating the GraphQL schema

When the DatoCMS schema, which includes various models and fields, undergoes any updates or modifications, it is essential to ensure that these changes are properly reflected in your local development environment. To accomplish this, you should locally run the following command:

npm run generate-schema

Executing this task will automatically update the schema.graphql file for you. This crucial step ensures that gql.tada will have access to the most current and accurate version of the GraphQL schema, allowing your application to function correctly with the latest data structures and relationships defined within your DatoCMS setup.


What is DatoCMS?

DatoCMS is the REST & GraphQL Headless CMS for the modern web.

Trusted by over 25,000 enterprise businesses, agency partners, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ā¤ļø our developers, content editors and marketers!

Quick links:

Our featured repos:

Or see all our public repos