Current Time 0:00
/
Duration Time -:-

Create a New Next.js Project With the Keystatic CLI

Share this video with your friends

Social Share Links

Send Tweet
Published a year ago
Updated a year ago

In this lesson, you'll set up a fresh new Next.js 14 project with the Keystatic CLI. We'll take a quick tour of what's been generated for us, and play around with Keystatic's two-way content editing capabilities!

Instructor: [0:00] Create a new Keystatic project with npm create @keystatic@latest. Here we'll choose Next.js, and we'll call our project keystatic-blog. All right, it's all set up. Let's cd into our keystatic-blog and open it in the code editor.

[0:16] If we look at what's been generated, we have a Next.js app using the app router, and you can see we also have a posts directory with a Markdoc file here. Let's install the dependencies with npm install. We'll start the dev server with npm run dev.

[0:33] Let's open localhost:3000. The home page is listing one post, which is the post for which we found a Markdoc file in the posts directory. We can edit this post directly from the Markdoc file. What's really cool about Keystatic is it also provides an Admin UI. We now have a super-nice content-editing interface. I can change the content here. Our file has been updated.

[1:02] Right now we have one post, but just for fun, let's create a new one. My Second Post, "Whoaaaaa, this is suuuuper cool!" We'll create that one. Now in our posts directory, we have the second file. If we visit our frontend, we also have the link to the second post.