DEV Community

Cover image for Next-Stage: A Modern Next.js Starter Template for AI-Driven Development
Kazuki Yonemoto
Kazuki Yonemoto

Posted on • Edited on

Next-Stage: A Modern Next.js Starter Template for AI-Driven Development

Next-Stage is a cutting-edge starter template built on Next.js, designed specifically for developers looking to leverage modern web development practices with AI-assisted workflows.

This template combines the latest technologies and best practices to provide a robust foundation for building type-safe, performant web applications.

Demo: https://next-stage-demo.vercel.app/


πŸ› οΈ Technology Stack

Category Technology
Framework Next.js (App Router)
Language TypeScript
Package Manager Bun
API Framework Hono
UI Components shadcn/ui
Styling Tailwind CSS
Form Management React Hook Form
Validation Zod
Linting & Formatting Biome
Markup Linting Markuplint
E2E Testing Playwright
Supply Chain Security Bun Security Scanner

πŸ”‘ Key Features

Type-Safe Development Environment

Next-Stage provides end-to-end type safety throughout your application:

  • TypeScript Integration: Built with TypeScript strict mode for comprehensive type checking
  • Zod Validation: Schema-based validation for forms and API requests with type inference
  • TypeScript-Safe API Responses: Structured API response types for consistent client-server communication

Modern Frontend Architecture

The template leverages the latest in frontend development:

  • Next.js with App Router: Utilizing React Server Components and the latest features
  • React: The latest React with improved performance and new features
  • Tailwind CSS: Next-generation utility-first CSS framework
  • shadcn/ui Components: Beautiful, accessible UI components built with Radix UI

Robust API Layer with Hono

Next-Stage features a powerful API implementation using Hono:

  • Efficient Routing: Clean API route organization with Hono's routing system
  • Request Validation: Integrated Zod validation via @hono/zod-validator
  • RPC Implementation: Type-safe Remote Procedure Call functionality for seamless client-server communication

Advanced Form Handling

The template includes a comprehensive form management solution:

  • React Hook Form: Performant, flexible form management with minimal re-renders
  • Zod Integration: Type-safe form validation through @hookform/resolvers

Supply Chain Security

Next-Stage implements proactive protection against supply chain attacks:

Developer Experience Optimizations

Next-Stage prioritizes developer productivity:

  • Bun Package Manager: Fast, all-in-one JavaScript runtime and package manager
  • Turbopack: Default bundler in Next.js for lightning-fast builds and hot module replacement
  • Biome: Modern, fast JavaScript/TypeScript linting and formatting (replaces ESLint + Prettier)
  • Markuplint: JSX/TSX markup linting for high-quality, accessible UI components
  • Playwright: End-to-end testing with browser automation

πŸ€– AI-Driven Development

Next-Stage is built with AI-assisted development in mind, providing comprehensive support for multiple AI coding tools.

Universal AI Agent Support

The project includes AGENTS.md following the agents.md standard β€” a universal format that works across all AI coding agents and tools.

Supported AI Tools

AI Editors

Editor Configuration Location
Cursor .cursor/rules/
Windsurf .windsurf/rules/
GitHub Copilot .github/copilot-instructions.md
Kiro .kiro/steering/

AI CLI Tools

Tool Configuration File
Claude Code CLAUDE.md
Google Gemini CLI GEMINI.md

Rule File Hierarchy

The project maintains a hierarchical rule system for consistent AI-driven development:

  1. Base Rules (_llm-rules/ directory):

    • core-rule.md: Core task execution methodology
    • nextjs-rule.md: Next.js specific development patterns
    • test-rule.md: Testing guidelines and best practices
  2. Universal Format:

    • AGENTS.md: Universal format following agents.md standard
  3. Tool-Specific Files:

    • CLAUDE.md, GEMINI.md, and generated editor-specific rules

Generating Editor-Specific Rules

# Generate rules for specific editors
bun run rules:cursor
bun run rules:windsurf
bun run rules:copilot
bun run rules:kiro

# Generate rules for all supported editors
bun run rules
Enter fullscreen mode Exit fullscreen mode

Next.js DevTools MCP Integration

This project includes Next.js DevTools MCP integration for AI coding assistants that support the Model Context Protocol (MCP).

Key MCP Features:

  • MCP tools for automating Next.js upgrades and Cache Components setup
  • Pre-configured prompts for common Next.js development tasks
  • Direct access to Next.js documentation and best practices
  • Browser automation integration with Playwright
  • Access to internal state, diagnostics, and errors from running dev servers

πŸ“ Project Structure

next-stage/
β”œβ”€β”€ public/               # Static assets
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/              # App Router routes
β”‚   β”‚   β”œβ”€β”€ _components/  # Page-specific components
β”‚   β”‚   β”œβ”€β”€ _styles/      # Page-specific styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx    # Root layout
β”‚   β”‚   └── page.tsx      # Home page
β”‚   β”œβ”€β”€ components/       # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ layout/       # Layout components (header, footer)
β”‚   β”‚   └── ui/           # shadcn/ui components
β”‚   β”œβ”€β”€ config/           # Configuration files
β”‚   β”œβ”€β”€ lib/              # Utility functions
β”‚   └── types/            # Type definitions
β”œβ”€β”€ e2e/                  # E2E tests (Playwright)
β”œβ”€β”€ _llm-rules/           # Base rules for AI-assisted development
β”œβ”€β”€ _llm-docs/            # Documentation for AI-assisted development
β”œβ”€β”€ _tasks/               # Build tasks and scripts
β”œβ”€β”€ AGENTS.md             # Universal AI agent instructions
β”œβ”€β”€ CLAUDE.md             # Claude CLI specific instructions
β”œβ”€β”€ GEMINI.md             # Gemini CLI specific instructions
└── ...                   # Config files
Enter fullscreen mode Exit fullscreen mode

Colocation Pattern

Next-Stage implements the colocation pattern for better organization:

  • Page-specific resources: Components, actions, and hooks are located within the page directory using underscore prefixes (_components/, _actions/, _hooks/)
  • Cross-cutting resources: Domain-independent components are kept in top-level directories
  • Clear separation: Underscore prefixes distinguish page-specific directories from route segments

πŸš€ Getting Started

1. Clone the Repository

bunx create-next-app@latest my-app --example https://github.com/Kazuki-tam/next-stage
Enter fullscreen mode Exit fullscreen mode

2. Install Dependencies

cd my-app
bun install
Enter fullscreen mode Exit fullscreen mode

3. Environment Setup (Optional)

cp .env.example .env.local
# Edit .env.local with your environment variables
Enter fullscreen mode Exit fullscreen mode

4. Start the Development Server

bun dev
Enter fullscreen mode Exit fullscreen mode

5. Open Your Browser

Navigate to http://localhost:3000 to see your application running.


πŸ“‹ Available Commands

Command Description
bun dev Start development server
bun build Build for production
bun start Start production server
bun run lint Run all linters
bun run format Format code with Biome
bun run check Run linting, formatting, and type checking
bun run test:unit Run unit tests
bun run test:e2e Run E2E tests with Playwright
bun run test:e2e:ui Run E2E tests with UI mode
bun run rules Generate AI editor rules

🚒 Deployment

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out the Next.js deployment documentation for more details.


βœ… Conclusion

Next-Stage provides a solid foundation for modern web application development with Next.js. Its focus on:

  • Type Safety: End-to-end TypeScript with Zod validation
  • Developer Experience: Fast builds with Turbopack and Bun
  • AI-Driven Development: Comprehensive support for AI coding tools
  • Modern Stack: React, Tailwind CSS, and the latest ecosystem

Whether you're building a small project or a large-scale application, Next-Stage gives you the tools and patterns needed to succeed, with a special emphasis on leveraging AI assistance to accelerate your development workflow.

Take the next step in your web development journey with Next-Stage!

Top comments (0)