All Frameworks

Next.js Rules

5 rules available

NEXTJS
98%

Next.js App Router Server Components First

Prioritize React Server Components for data fetching and static content. Client components only when interactivity is required.

server-componentsapp-routerperformance
'use server';

import { db } from '@/lib/database';
import { cache } from 'react';

export const getProjects = cache(async () => {
  return db.project...
Jan 15, 2024by Vercel Engineering
View Rule
NEXTJS
93%

Next.js Image Optimization Best Practices

Use the Image component with proper sizing, formats, and loading strategies for maximum performance.

nextjsimage-optimizationperformance
import Image from 'next/image';
import Link from 'next/link';

export function ProjectCard({ project }: { project: Project }) {
  return (
    <Link h...
Feb 28, 2024by Vercel
View Rule
NEXTJS
94%

Next.js Middleware Authentication

Implement authentication at the edge with Next.js Middleware for protected routes.

nextjsmiddlewareauthentication
import { NextResponse } from 'next/server';
import type { NextRequest } from 'next/server';
import { jwtVerify } from 'jose';

const JWT_SECRET = new ...
Mar 8, 2024by Next.js Team
View Rule
NEXTJS
92%

Next.js Dynamic Metadata API

Use the Metadata API for SEO optimization with dynamic titles, descriptions, and OpenGraph images.

nextjsseometadata
import { Metadata, ResolvingMetadata } from 'next';
import { notFound } from 'next/navigation';
import { db } from '@/lib/db';
import { SchemaMarkup }...
Mar 18, 2024by Vercel
View Rule
NEXTJS
97%

Next.js Caching Strategies

Master Next.js caching with fetch, revalidation, and Route Handler caching for optimal performance.

nextjscachingperformance
import { unstable_cache } from 'next/cache';
import { revalidatePath, revalidateTag } from 'next/cache';
import { cookies, headers } from 'next/header...
Mar 28, 2024by Vercel Engineering
View Rule