How yukaorange/portfolio-2024 works
Project Type and Purpose
• This is a portfolio website built for showcasing technical skills during a job search.
• It is built using Next.js with React and TypeScript, and it leverages R3F (React Three Fiber) together with Three.js for interactive WebGL graphics.
• The site integrates with microCMS to fetch content and assets, using static site generation (SSG), and it is deployed on Vercel.
• The project also emphasizes advanced visual effects, shader animations, and interactive UI transitions.
Main Components
a. Frontend UI Layer:
• Next.js pages and layouts (located primarily in the app directory: app/page.tsx, app/layout.tsx, etc.)
• Component library (organized under the components directory: Common, Layout, Gallery, About, Top, etc.) which handles modular UI elements, navigation, and interactivity.
• React Context Providers (in the app folder) for managing scroll, transition, and other UI states.
b. WebGL / 3D Graphics Module:
• R3F and Three.js components (found in components/WebGL and associated shader files in the shaders directory).
• Custom shader programs (directory “shaders”) used to animate textures, lighting, and post-process effects.
c. State Management:
• Recoil atoms (organized in the store directory) that manage global state such as loading progress, navigation state, and texture information.
• Custom hooks (in the hooks directory) that help integrate and maintain component state and animations, including viewport calculations and frame rate control.
d. Data Integration Layer:
• Integration with microCMS via the lib/microcms.ts file for fetching content.
• Usage of static generation (SSG) in Next.js to prebuild pages with external data.
e. Asset and Public Resources:
• Resources such as fonts, images, models, and JSON data are stored under the public directory.
• WebGL models (in public/models) and Draco decoder files (in public/draco) are crucial for efficient 3D model loading.
f. Development and Styling:
• Shared styling and configuration files for ESLint, Prettier, styleLint, SCSS mixins, and global styles (in both the root and styles directories).
Relationships and Interactions
• The Browser sends requests which are handled by Next.js routes defined in the app directory. The route resolver picks the correct page component which in turn utilizes layout wrappers and reusable components from the components directory.
• Components interact with each other via React props, context providers, and Recoil state management to maintain a reactive and highly interactive UX.
• During page transitions or initial load, the WebGL layer initiates visual effects that drive the dynamic image textures and animations, with shader programs running on the client.
• Data is fetched from microCMS via the lib module and is provided to the pages during the build time (SSG) or runtime.
• The build process makes use of utilities like gltfjsx to convert 3D models into React components (as referenced in the README).
• Deployment is streamlined using Vercel.
Architectural Patterns and Design Principles
• Component-Based Design: Clear separation into presentation, container, and utility components.
• File System-Based Routing (Next.js): Organizing pages and sub-pages inside the app directory.
• Separation of Concerns: Distinct folders for UI components, business logic (hooks and state), WebGL rendering, and shader code.
• Declarative State Management: Use of Recoil and Context Providers to minimize unnecessary renders and manage cross-cutting concerns (like scroll and transition states).
• Optimized Asset Delivery: Use of public directories for static assets, and dedicated paths for WebGL and shader assets for optimal performance.