Skip to content

An interactive demonstration project showcasing Next.js 15 App Router core features, including layout systems, file conventions, and routing functionality with complete examples.

License

Notifications You must be signed in to change notification settings

TencentEdgeOne/next-app-router-template

Repository files navigation

Next.js App Router Demo Project

An interactive demonstration project showcasing Next.js 15 App Router core features, including layout systems, file conventions, and routing functionality with complete examples.

πŸš€ Project Features

Core Features

  • Nested Layouts - Nested layout system demonstration
  • Route Groups - Route grouping functionality showcase
  • Parallel Routes - Parallel routing feature implementation
  • File Conventions - Complete file convention examples
    • loading.js - Loading state management
    • error.js - Error boundary handling
    • not-found.js - 404 page customization

Tech Stack

  • Next.js 15.5.0 - Latest version of App Router
  • TypeScript - Complete type support
  • Tailwind CSS v4 - Modern styling system
  • shadcn/ui - High-quality UI component library
  • Lucide React - Beautiful icon library

πŸ“ Project Structure

app-router-template/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ globals.css              # Global styles and theme
β”‚   β”‚   β”œβ”€β”€ layout.tsx               # Root layout
β”‚   β”‚   β”œβ”€β”€ page.tsx                 # Home page
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   └── Header.tsx          # Shared navigation component
β”‚   β”‚   β”œβ”€β”€ layouts/                 # Layout system demonstration
β”‚   β”‚   β”‚   β”œβ”€β”€ nested-layouts/     # Nested layouts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ layout.tsx      # Outer layout
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx        # Home page
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/      # Dashboard page
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ settings/       # Settings page (with inner layout)
β”‚   β”‚   β”‚   β”‚   └── profile/        # Profile page
β”‚   β”‚   β”‚   β”œβ”€β”€ route-groups/       # Route groups
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ page.tsx        # Demo page
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ (admin)/        # Admin group
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ (user)/         # User group
β”‚   β”‚   β”‚   β”‚   └── (public)/       # Public group
β”‚   β”‚   β”‚   └── parallel-routes/    # Parallel routes
β”‚   β”‚   β”‚       β”œβ”€β”€ layout.tsx      # Parallel routes layout
β”‚   β”‚   β”‚       β”œβ”€β”€ @messages/      # Messages slot
β”‚   β”‚   β”‚       β”œβ”€β”€ @users/         # Users slot
β”‚   β”‚   β”‚       └── @settings/      # Settings slot
β”‚   β”‚   └── file-conventions/       # File conventions demonstration
β”‚   β”‚       β”œβ”€β”€ loading/            # Loading states
β”‚   β”‚       β”‚   β”œβ”€β”€ page.tsx        # Introduction page
β”‚   β”‚       β”‚   β”œβ”€β”€ loading.js      # Loading component
β”‚   β”‚       β”‚   └── demo/           # Demo page
β”‚   β”‚       β”œβ”€β”€ error/              # Error handling
β”‚   β”‚       β”‚   β”œβ”€β”€ page.tsx        # Introduction page
β”‚   β”‚       β”‚   β”œβ”€β”€ error.js        # Error boundary
β”‚   β”‚       β”‚   └── demo/           # Demo page
β”‚   β”‚       └── not-found/          # 404 page
β”‚   β”‚           β”œβ”€β”€ page.tsx        # Introduction page
β”‚   β”‚           β”œβ”€β”€ not-found.js    # 404 component
β”‚   β”‚           └── demo/           # Demo page
β”‚   └── components/
β”‚       └── ui/                     # shadcn/ui components
β”œβ”€β”€ public/                          # Static assets
β”œβ”€β”€ package.json                     # Project dependencies
β”œβ”€β”€ next.config.ts                   # Next.js configuration
β”œβ”€β”€ tailwind.config.ts               # Tailwind configuration
└── tsconfig.json                    # TypeScript configuration

🎨 Design Theme

The project adopts a modern dark theme design:

  • Primary Color: #1c66e5 (Blue)
  • Background: #0a0a0a (Dark black)
  • Foreground: #ffffff (White)
  • Card: #1a1a1a (Dark gray)
  • Border: rgba(255, 255, 255, 0.1) (Semi-transparent white)

πŸ› οΈ Quick Start

Requirements

  • Node.js 18.17 or higher
  • npm or yarn package manager

Install Dependencies

npm install

Start Development Server

edgeone pages dev

The project will start at http://localhost:8088

πŸ“š Feature Demonstrations

1. Nested Layouts

Path: /layouts/nested-layouts

Demonstrates a true nested layout system:

  • Outer layout provides shared navigation and title
  • Inner layout (settings page) provides sidebar
  • Layout state persists during page transitions
  • Supports multi-level nesting and independent rendering

Features:

  • Layout persistence
  • Shared components
  • Multi-level nesting
  • Performance optimization

2. Route Groups

Path: /layouts/route-groups

Showcases route grouping functionality:

  • Uses (folderName) convention to create logical groups
  • Doesn't affect URL path structure
  • Applies different layouts to different route segments
  • Supports admin, user, public, and other groups

Group Structure:

  • (admin) - Admin backend pages
  • (user) - User-related pages
  • (public) - Public pages

3. Parallel Routes

Path: /layouts/parallel-routes

Implements true parallel routing features:

  • Uses @folder convention to create slots
  • Renders multiple independent route segments simultaneously
  • Each slot maintains independent state
  • Supports conditional rendering and default slots

Slot Components:

  • @messages - Message list
  • @users - User management
  • @settings - Application settings
  • @default - Default content

4. File Conventions

Loading UI (loading.js)

Path: /file-conventions/loading

  • Automatically displays loading states
  • Supports nesting and inheritance
  • Doesn't affect SEO and performance
  • Real demonstration of async component loading

Error UI (error.js)

Path: /file-conventions/error

  • Automatically captures component errors
  • Graceful degradation handling
  • Provides error recovery mechanisms
  • Prevents application crashes

Not Found UI (not-found.js)

Path: /file-conventions/not-found

  • Custom 404 pages
  • Supports notFound() function calls
  • Maintains complete application structure
  • User-friendly guidance

πŸ”§ Technical Implementation

Layout System

  • Outer Layout: Provides shared navigation and title
  • Inner Layout: Provides additional layout for specific page segments
  • Layout Inheritance: Supports multi-level nesting and state persistence
  • Performance Optimization: Only re-renders changed parts

Route Management

  • File System Routing: Automatic routing based on file structure
  • Dynamic Routing: Supports parameters and query strings
  • Middleware Support: Route-level logic processing
  • SEO Optimization: Server-side rendering and metadata management

State Management

  • Layout State: Persists during page transitions
  • Component State: Managed using React Hooks
  • Server State: Supports async data fetching
  • Client State: Interactions and user input

πŸ“– Learning Resources

Official Documentation

Related Technologies

🀝 Contributing

Welcome to submit Issues and Pull Requests to improve this project!

Development Standards

  • Write code using TypeScript
  • Follow ESLint rules
  • Keep component structure clear
  • Add appropriate comments and documentation

Commit Standards

  • Use clear commit messages
  • One commit for one thing
  • Test to ensure functionality works
  • Update related documentation

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

Deployment

Deploy with EdgeOne Pages

About

An interactive demonstration project showcasing Next.js 15 App Router core features, including layout systems, file conventions, and routing functionality with complete examples.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published