Next.js Page Template Generator

Create Next.js pages with SSR, SSG, or ISR data fetching patterns

6/11/2026
Prompt
Generate a Next.js page template with the following specifications:

Page Route: {{PAGE_ROUTE}}
Rendering Strategy: {{RENDERING_STRATEGY}} (SSR/SSG/ISR/CSR)
Data Requirements: {{DATA_REQUIREMENTS}}
Layout: {{LAYOUT_NAME}}
Protected Route: {{IS_PROTECTED}} (yes/no)

Create a complete page including:

1. **Data Fetching:**
   - getServerSideProps (for SSR)
   - getStaticProps + getStaticPaths (for SSG)
   - Revalidation config (for ISR)
   - Client-side fetching with SWR/React Query

2. **Page Component:**
   - TypeScript types for props
   - SEO metadata with next/head or metadata export
   - Layout integration
   - Loading and error states

3. **Route Handling:**
   - Dynamic route parameters
   - Query string handling
   - Middleware considerations

4. **Performance:**
   - Image optimization with next/image
   - Font optimization
   - Code splitting considerations
   - Prefetching strategies

5. **Authentication (if protected):**
   - Session checking
   - Redirect logic
   - Protected route wrapper

6. **Error Handling:**
   - Custom error boundaries
   - 404 handling
   - API error display

Provide both App Router and Pages Router versions if applicable.

Or press ⌘C to copy

Variables (5)

Replace these placeholders with your own content before using the prompt.

[{PAGE_ROUTE][{RENDERING_STRATEGY][{DATA_REQUIREMENTS][{LAYOUT_NAME][{IS_PROTECTED]

Ready to use?

Copy and paste into your favorite AI tool

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...