How nabit23/course-creative-portfolio-next works
Main Components
• Frontend – Built with Next.js:
• This is realized through the src/app directory which includes the main pages, dynamic route segments (e.g., [uid]), layouts, and dedicated sections (blog, project, slice simulator).
• The app leverages Next.js API routes found under src/app/api (e.g., preview, exit-preview, revalidate) to control content previewing and live content updates.
• Content Management Integration – Prismic CMS:
• Custom content types are defined in the customtypes folder. Each content type (blog_post, homepage, page, project, settings) has its own JSON configuration.
• The slices directory (src/slices) contains various slice components (e.g., Biography, Hero, TechList) complete with mock data and models. This, along with the slicemachine.config.json, signifies integration with Prismic's Slice Machine.
• 3D and Animation Components:
• The project name indicates 3D creative content, which uses Three.js (for 3D scenes) and GSAP (for animations). Although these libraries are referenced via the tutorial and course documentation in the README, highlight them as dedicated components for rendering and animating portfolio content.
• Public Assets and Media:
• The public directory contains assets like HDR file for environment mapping ("smallroom.hdr") and sound effects. These contribute as supporting media used in the interactive and 3D sections.
• Utility and Configurations:
• Utility functions under src/utils (e.g., formatting dates).
Relationships and Interactions
• The Frontend interacts with the Prismic CMS in two primary ways:
• During build-time and/or runtime API calls (using fetch / Next.js API routes) to retrieve or update content.
• The dynamic rendering of slices/components that compose the pages (using data from slice models and mocks).
• API Routes handle specialized content scenarios:
• Preview mode, content revalidation, and exit-preview endpoints form an integral layer allowing live content collaboration and updates.
• 3D/Animation Components are embedded within the Next.js pages:
• Configuration and Utility Layers are “injected” across components:
• Global CSS and Tailwind act as the styling backbone across pages while shared utilities help format data or process content before rendering.
Architectural Patterns and Design Principles
• Modular and Component-Driven Design:
• Every part of the UI is broken down into logically grouped components (e.g., Header, Footer, Button) and slices.
• Dynamic Routing and API Abstractions:
• Next.js file-based routing (dynamic routes like [uid]) combined with API endpoints provides flexibility in content rendering.
• Integration with External CMS via Slice Machine:
• Use of Prismic’s custom types and slices is a key architectural choice, influencing how the application decouples content creation from presentation.
• Separation of Concerns:
• Clear divisions between layout, presentation, API handling, and utility aspects ensure maintainability.