Introduction
AnimeThemes Web is a Next.js application built with the Pages Router architecture. The project serves as a frontend for browsing anime opening and ending themes, providing static generation for optimal performance while supporting dynamic user interactions.Technology Stack
Framework
- Next.js 15 with Pages Router
- React 19 for UI components
- TypeScript for type safety
Styling
- styled-components for component styling
- Sass for global styles
- Custom theme system with dark mode
Data Layer
- GraphQL with schema merging
- @tanstack/react-query for client state
- SWR for authentication state
Build & Deploy
- Static Site Generation (SSG)
- Incremental Static Regeneration (ISR)
- Server-Side Rendering (SSR) where needed
Architecture Diagram
Project Structure
The codebase follows a feature-based organization within a standard Next.js structure:Directory Structure
Directory Structure
Key Architectural Patterns
1. Static Site Generation (SSG)
The application heavily leverages SSG for performance:2. GraphQL Schema Merging
Multiple GraphQL APIs are merged into a unified schema:3. Context-Based State Management
The app uses React Context for global state:- Player Context
- Theme Context
- Toast Context
Rendering Strategies
The application uses different rendering strategies based on page requirements:| Page Type | Strategy | Reason |
|---|---|---|
| Anime Detail | SSG + ISR | Content changes infrequently, revalidate hourly |
| Artist Detail | SSG + ISR | Static content with periodic updates |
| Search | CSR | Highly dynamic, user-specific queries |
| Homepage | SSG | Featured content, regenerated on build |
| User Profile | SSR | User-specific, requires authentication |
Data Flow
Performance Optimizations
Build-Time Caching
Pages cache API responses during build to avoid redundant requests:
Concurrent Limiting
API requests are limited to prevent timeouts:
Smart Includes
GraphQL automatically determines required API includes based on query fields
ISR Revalidation
Pages revalidate after 1 hour (3600 seconds) to balance freshness and performance
Configuration
Key configuration innext.config.ts:
Next Steps
Pages & Routing
Learn about the Pages Router structure and dynamic routes
GraphQL Layer
Understand the GraphQL implementation and schema merging
State Management
Explore React Query, SWR, and context-based state