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.
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 managementerror.js- Error boundary handlingnot-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
@folderconvention 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.