LookManLookLookManLook
Tutorials

How to Structure a Content CMS in Next.js App Router

Learn how to effectively structure a content CMS using Next.js App Router, aimed at founders and builders exploring software and AI tools.

August 21, 2026

Introduction

Building a content management system (CMS) in a Next.js application can be a game changer for founders and builders looking to leverage content effectively. In this post, I will walk you through the process of structuring a content CMS using Next.js App Router, focusing on practical steps and real-world applications.

Why Use Next.js for Your CMS?

Next.js offers several benefits that make it ideal for building a CMS:

  • Server-side Rendering (SSR): Provides better performance and SEO.
  • Static Site Generation (SSG): Ideal for blogs and content-heavy sites.
  • API Routes: Easily create RESTful APIs to manage your content.
  • File-based Routing: Simplifies the routing structure.

Setting Up Your Next.js Project

First things first, let’s set up a new Next.js project if you haven’t done so already. You can quickly create a new Next.js application using the following command:

npx create-next-app@latest your-cms-app

After the setup is complete, navigate into your project directory:

cd your-cms-app

Creating Your Content Structure

When structuring your CMS, you need to decide how to organize your content data. Here’s a simple way to do it:

1. Define Content Types

Identify the types of content you’ll manage. Common types might include:

  • Articles
  • Pages
  • Categories
  • Tags
  • Authors

2. Create the Content Directories

In your pages directory, create folders for each content type. For example:

/pages
  ├── articles
  ├── pages
  ├── categories
  └── authors

This structure allows Next.js to handle routing easily for each content type.

3. Implement API Routes

Next.js API routes can be used to manage content dynamically. Create a folder named api inside the pages directory:

/pages
  └── api
      ├── articles.js
      ├── pages.js
      ├── categories.js
      └── authors.js

In each of these files, you can handle CRUD operations for your content types. Here’s an example for the articles.js file:

export default function handler(req, res) {
  if (req.method === 'GET') {
    // Fetch articles
  } else if (req.method === 'POST') {
    // Create an article
  }
}

Integrating a Headless CMS

For many, managing content through a headless CMS like Sanity, Contentful, or Strapi can streamline the process. Here’s how you can integrate a headless CMS:

1. Choose a Headless CMS

Select a service that fits your needs. Consider factors like ease of use, pricing, and available features.

2. Set Up Your Headless CMS

Follow the setup instructions provided by your chosen CMS. Once done, you’ll usually end up with API endpoints to fetch your content.

3. Fetch Content in Next.js

You can use getStaticProps or getServerSideProps in your Next.js pages to fetch content from your headless CMS:

export async function getStaticProps() {
  const res = await fetch('https://your-headless-cms.com/api/articles');
  const articles = await res.json();

  return { props: { articles }};
}

Building the Frontend

With the backend set up, let's focus on building the frontend to display your content.

1. Create Article Pages

Under the articles folder, create [id].js to handle dynamic routing for each article:

import { useRouter } from 'next/router';

const Article = ({ article }) => {
  return <div>{article.title}</div>;
};

export async function getStaticPaths() {
  // Fetch article IDs here
}

export async function getStaticProps({ params }) {
  // Fetch article by ID here
}

export default Article;

2. List Articles

In your main articles page, you can list articles with links to their respective pages:

const ArticlesPage = ({ articles }) => {
  return (
    <ul>
      {articles.map(article => (
        <li key={article.id}>
          <Link href={`/articles/${article.id}`}>{article.title}</Link>
        </li>
      ))}
    </ul>
  );
};

Testing and Iteration

Once your CMS structure is in place, it's crucial to test it thoroughly:

  • Test all API endpoints for functionality.
  • Ensure the frontend displays content correctly.
  • Check for SEO optimizations like metadata and structured data.

Checklist for Your Next.js CMS

  • [ ] Set up Next.js project
  • [ ] Define content types
  • [ ] Create content directories
  • [ ] Implement API routes
  • [ ] Integrate headless CMS (if applicable)
  • [ ] Build frontend pages
  • [ ] Test all functionalities

Conclusion

Structuring a content CMS in a Next.js application is a straightforward process when you break it down into manageable steps. By leveraging Next.js's features, you can build a robust and efficient CMS that meets your needs as a founder or builder. For more insights and resources on software and AI tools, visit LookManLook. Happy building!

Next.jsCMSblog CMScontent management

Keep going

More writing on the blog, or watch the same ideas on YouTube.