Create a New Next.js Project With the Keystatic CLI

Share this video with your friends

Social Share Links

Send Tweet
Published 6 months ago
Updated 6 months 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.

egghead
egghead
~ a minute ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today