Skip to content
InsightLogEditorial Notes
メニュー

Next.js App Router でサーバーコンポーネントを使ってブログを設計する

サーバーコンポーネントを基準にデータの流れを分けると、ブログのキャッシュ戦略が単純になります。構造と落とし穴を整理します。

Daniel Okafor更新 2026年11月20日1分で読めます閲覧 683
X で共有
肯定的 100%

要点 · TL;DR

ブログは読み取りが圧倒的に多いため、一覧と記事ページはサーバーで描画して ISR で更新し、投票や閲覧数のように状態が変わる部分だけをクライアントコンポーネントに分離するのが効率的です。

Key facts

  • An ISR window of about 30 seconds is enough for most article pages.
  • Side effects such as view counting belong in an API route, not in render.
  • Admin areas should enforce both middleware and a server-side session check.

構造から整理する

App Router で最も重要な判断は、どこまでサーバーで処理するかです。

  • 一覧・記事・分類ページ: サーバーコンポーネント + ISR
  • 投票・閲覧数・読書進捗: クライアントコンポーネント
  • 管理画面のフォーム: サーバーアクション

キャッシュ戦略

記事ページに再検証の秒数を一行加えるだけで、多くのブログは十分な鮮度を保てます。

よくある失敗

  1. 描画中にデータを変更する。
  2. cookies() の呼び出しで静的ページが動的になる。
  3. マークダウンパーサーをクライアントに含める。

まとめ

読み取り中心のサービスでは、サーバー描画と最小限のクライアント状態が最も単純で高速です。

よくある質問

Should view counts be incremented inside a server component?

No. Rendering can run multiple times and prefetching happens too. Increment views from a client call or a route handler.

この記事は役に立ちましたか?

評価は他の読者に記事の信頼性を示すシグナルになります。

肯定的 100%

Daniel Okafor
Daniel Okafor

Senior data editor · InsightLog

Builds data pipelines and measurement systems, and writes about the context behind every number.

マークダウン原文: /ja/posts/nextjs-app-router-blog-architecture/raw

引用時の出典: https://insightlog.site/ja/posts/nextjs-app-router-blog-architecture