A modern, high-performance blog platform built with Next.js 16 and Cosmic CMS, featuring the latest improvements in routing, caching, and developer experience.
- 🚀 Next.js 16 with Turbopack - Up to 10× faster Fast Refresh and 2-5× faster production builds
- 📝 Dynamic Blog Posts - Full markdown support with syntax highlighting
- 👤 Author Profiles - Detailed author pages with biographical information
- 🏷️ Category Filtering - Browse posts by Technology, Lifestyle, and Travel categories
- 📱 Responsive Design - Mobile-first design with Tailwind CSS
- 🖼️ Optimized Images - Automatic image optimization with imgix
- ⚡ Enhanced Routing - Layout deduplication and incremental prefetching for faster navigation
- 🔍 SEO Optimized - Proper metadata and semantic HTML structure
- 🎨 Modern UI - Clean, minimalist design with Inter font family
Want to create your own version of this project with all the content and structure? Clone this Cosmic bucket and code repository to get started instantly:
This application was built using the following prompts to generate the content structure and code:
"Create a content model for a blog with posts, authors, and categories"
"Based on the content model I created for 'Create a content model for a blog with posts, authors, and categories', now build a complete web application that showcases this content. Include a modern, responsive design with proper navigation, content display, and user-friendly interface. Use Next.js 16"
The app has been tailored to work with your existing Cosmic content structure and includes all the features requested above.
- Next.js 16 - React framework with App Router and Turbopack
- React 19.2 - Latest React features including View Transitions
- TypeScript - Type-safe development with comprehensive interfaces
- Tailwind CSS - Utility-first CSS framework for responsive design
- Cosmic CMS - Headless CMS for content management
- imgix - Image optimization and transformation
- React Markdown - Markdown rendering for blog content
- Node.js 20.9 or higher
- A Cosmic account with the blog content model set up
- Clone this repository:
git clone <your-repo-url>
cd nextjs-16-blog- Install dependencies:
bun install- Set up environment variables:
Create a
.env.localfile with your Cosmic credentials:
COSMIC_BUCKET_SLUG=your-bucket-slug
COSMIC_READ_KEY=your-read-key- Run the development server:
bun dev- Open http://localhost:3000 in your browser.
import { cosmic } from '@/lib/cosmic'
const { objects: posts } = await cosmic.objects
.find({ type: 'posts' })
.props(['id', 'title', 'slug', 'metadata'])
.depth(1)const { object: post } = await cosmic.objects
.findOne({
type: 'posts',
slug: 'your-post-slug'
})
.depth(1)const { objects: posts } = await cosmic.objects
.find({
type: 'posts',
'metadata.category': categoryId
})
.props(['id', 'title', 'slug', 'metadata'])
.depth(1)This application integrates with Cosmic CMS to manage all blog content:
- Posts (
posts): Blog posts with title, content (markdown), featured images, excerpts, authors, categories, and published dates - Authors (
authors): Author profiles with names, bios, profile photos, and email addresses - Categories (
categories): Content categories with names and descriptions
All content is fetched server-side for optimal performance and SEO. The application uses Next.js 16's enhanced routing and caching features to ensure fast page loads and smooth navigation.
The easiest way to deploy this Next.js app is with Vercel:
- Click the button above
- Connect your GitHub repository
- Add your environment variables (
COSMIC_BUCKET_SLUG,COSMIC_READ_KEY) - Deploy!
- Push your code to GitHub
- Import your repository in Netlify
- Add environment variables in the Netlify dashboard
- Deploy!
Make sure to set these environment variables in your hosting platform:
COSMIC_BUCKET_SLUG- Your Cosmic bucket slugCOSMIC_READ_KEY- Your Cosmic read key
nextjs-16-blog/
├── app/
│ ├── layout.tsx # Root layout with navigation
│ ├── page.tsx # Home page with featured posts
│ ├── posts/
│ │ ├── page.tsx # All posts listing
│ │ └── [slug]/
│ │ └── page.tsx # Individual post pages
│ ├── categories/
│ │ ├── page.tsx # All categories
│ │ └── [slug]/
│ │ └── page.tsx # Posts by category
│ ├── authors/
│ │ └── [slug]/
│ │ └── page.tsx # Author profile pages
│ └── globals.css # Global styles
├── components/
│ ├── PostCard.tsx # Post card component
│ ├── CategoryBadge.tsx # Category badge component
│ ├── AuthorCard.tsx # Author card component
│ ├── Navigation.tsx # Navigation component
│ └── CosmicBadge.tsx # Cosmic badge component
├── lib/
│ └── cosmic.ts # Cosmic SDK configuration
├── types.ts # TypeScript interfaces
├── public/
│ └── dashboard-console-capture.js # Console logging for dashboard
└── next.config.ts # Next.js configuration
