vercel/next-learn

Learn Next.js Starter Code

4,705 stars TypeScript 6 components

Contains tutorial starter templates demonstrating Next.js features progressively

At build time, Next.js reads markdown files from the posts directory, parses their frontmatter metadata using gray-matter, converts content to HTML with remark, then generates static pages. The homepage lists all posts with titles and dates, while individual post pages display full content. Navigation uses Next.js Link components for client-side routing between the generated static pages.

Under the hood, the system uses 2 data pools, 2 control points to manage its runtime behavior.

A 6-component fullstack. 131 files analyzed. Data flows through 6 distinct pipeline stages.

How Data Flows Through the System

At build time, Next.js reads markdown files from the posts directory, parses their frontmatter metadata using gray-matter, converts content to HTML with remark, then generates static pages. The homepage lists all posts with titles and dates, while individual post pages display full content. Navigation uses Next.js Link components for client-side routing between the generated static pages.

  1. Scan posts directory — getSortedPostsData uses Node.js fs module to read filenames from the posts directory, filtering for .md files and extracting post IDs
  2. Parse markdown frontmatter — gray-matter library extracts YAML frontmatter (title, date) from each markdown file while preserving the body content for later processing
  3. Sort posts by date — Post metadata array is sorted in descending chronological order so newest posts appear first in blog listings [PostData → PostData]
  4. Generate static props — getStaticProps runs at build time to pass the sorted post data as props to the homepage component for static generation [PostData → StaticProps]
  5. Render blog listing — Home component maps over allPostsData to create Link components pointing to individual posts, with Date components for formatting [StaticProps]
  6. Convert markdown to HTML — For individual posts, getPostData uses remark with remark-html plugin to convert markdown content into HTML string for safe rendering [PostData → PostData]

Data Models

The data structures that flow between stages — the contracts that hold the system together.

PostData basics/*/lib/posts.js
Object with id: string, title: string, date: ISO string, contentHtml?: string from markdown frontmatter parsing
Created by parsing markdown files with gray-matter, sorted by date, then rendered in React components
StaticProps basics/*/pages/index.js
Next.js props object with allPostsData: PostData[] passed from getStaticProps to page components
Generated at build time by getStaticProps, serialized to JSON, then hydrated on client
LayoutProps basics/*/components/layout.js
React props with children: ReactNode, home?: boolean to control header display and navigation
Passed from page components to Layout wrapper for consistent site structure

System Behavior

How the system operates at runtime — where data accumulates, what loops, what waits, and what controls what.

Data Pools

Posts Directory (file-store)
Collection of markdown files with YAML frontmatter containing blog posts, read at build time for static generation
Static Generation Cache (cache)
Next.js build output containing pre-rendered HTML pages and JSON data for each route, enabling fast serving without runtime processing

Delays

Control Points

Technology Stack

Next.js (framework)
React framework providing file-based routing, static generation, image optimization, and development tooling for all tutorial examples
React (library)
Component library for building interactive user interfaces with JSX syntax across all tutorial applications
gray-matter (library)
Parses YAML frontmatter from markdown files to extract post metadata like titles and dates for blog functionality
remark (library)
Markdown processor that converts markdown content to HTML for rendering blog posts with remark-html plugin
date-fns (library)
Date formatting library used in Date component to display human-readable post publication dates
Tailwind CSS (framework)
Utility-first CSS framework used in dashboard examples for styling components with pre-built classes
CSS Modules (build)
Scoped CSS system where .module.css files provide component-level styling without global namespace conflicts

Key Components

Explore the interactive analysis

See the full architecture map, data flow, and code patterns visualization.

Analyze on CodeSea

Related Fullstack Repositories

Frequently Asked Questions

What is next-learn used for?

Contains tutorial starter templates demonstrating Next.js features progressively vercel/next-learn is a 6-component fullstack written in TypeScript. Data flows through 6 distinct pipeline stages. The codebase contains 131 files.

How is next-learn architected?

next-learn is organized into 3 architecture layers: Tutorial Basics, Dashboard Application, SEO Examples. Data flows through 6 distinct pipeline stages. This layered structure keeps concerns separated and modules independent.

How does data flow through next-learn?

Data moves through 6 stages: Scan posts directory → Parse markdown frontmatter → Sort posts by date → Generate static props → Render blog listing → .... At build time, Next.js reads markdown files from the posts directory, parses their frontmatter metadata using gray-matter, converts content to HTML with remark, then generates static pages. The homepage lists all posts with titles and dates, while individual post pages display full content. Navigation uses Next.js Link components for client-side routing between the generated static pages. This pipeline design reflects a complex multi-stage processing system.

What technologies does next-learn use?

The core stack includes Next.js (React framework providing file-based routing, static generation, image optimization, and development tooling for all tutorial examples), React (Component library for building interactive user interfaces with JSX syntax across all tutorial applications), gray-matter (Parses YAML frontmatter from markdown files to extract post metadata like titles and dates for blog functionality), remark (Markdown processor that converts markdown content to HTML for rendering blog posts with remark-html plugin), date-fns (Date formatting library used in Date component to display human-readable post publication dates), Tailwind CSS (Utility-first CSS framework used in dashboard examples for styling components with pre-built classes), and 1 more. A focused set of dependencies that keeps the build manageable.

What system dynamics does next-learn have?

next-learn exhibits 2 data pools (Posts Directory, Static Generation Cache), 2 control points, 2 delays. These runtime behaviors shape how the system responds to load, failures, and configuration changes.

What design patterns does next-learn use?

4 design patterns detected: Progressive Tutorial Structure, File-based Routing Convention, Static Site Generation Pattern, Consistent Layout Wrapper.

Analyzed on April 20, 2026 by CodeSea. Written by .