This project documents the successful modernization of the Olipop brand website into a Next.js 16 application. The project achieved all core objectives, including the implementation of a complex 200-frame scroll-driven parallax animation system, seamless variant switching logic with state management, and a highly responsive component-based architecture. The new system leverages React 19, TypeScript for reliability, and Tailwind CSS v4 for modern styling, delivering a premium, interactive user experience that maintains the original design's aesthetic fidelity while significantly improving maintainability and scalability.
- ๐งฉ Project Overview
- ๐ฏ Objectives & Goals
- โ Acceptance Criteria
- ๐ป Prerequisites
- โ๏ธ Installation & Setup
- ๐ API Documentation
- ๐ฅ๏ธ UI / Frontend
- ๐ข Status Codes
- ๐ Features
- ๐งฑ Tech Stack & Architecture
- ๐ ๏ธ Workflow & Implementation
- ๐งช Testing & Validation
- ๐งฐ Verification Testing Tools
- ๐งฏ Troubleshooting & Debugging
- ๐ Security & Secrets
- โ๏ธ Deployment (Vercel)
- โก Quick-Start Cheat Sheet
- ๐งพ Usage Notes
- ๐ง Performance & Optimization
- ๐ Enhancements & Features
- ๐งฉ Maintenance & Future Work
- ๐ Key Achievements
- ๐งฎ High-Level Architecture
- ๐๏ธ Folder Structure (Tree)
- ๐งญ How to Demonstrate Live
- ๐ก Summary, Closure & Compliance
The Olipop Next.js project is a rebuild of the customer-facing landing page. It features a sophisticated hero section with a scroll-controlled 3D product rotation (parallax), interactive flavor variant switching, and modular content sections (Reviews, Ingredients, Nutrition). The architecture is designed to be "production-ready," utilizing Server Components where possible and Client Components for interactivity.
- Modernization: Migrate legacy HTML/JS to Next.js 16 App Router architecture.
- Performance: Optimize asset loading (specifically heavy image sequences) and improve Core Web Vitals.
- Type Safety: Implement strict TypeScript across all components and hooks.
- Maintainability: Componentize the UI using React enabling easier updates and AB testing.
- UX Excellence: Replicate and smooth out the detailed parallax interactions and animations.
- Hero animation uses exactly 200 frames for optimal load/quality balance.
- Hero section stays fixed (z-0) while content sections scroll over it (z-10).
- Variant switching (Cherry, Grape, Lemon) updates all relevant UI elements (Hero image, Colors, Product section image) instantly.
- Buttons and layout are fully responsive down to mobile devices (375px width).
- No hydration errors or console warnings in the final build.
- Node.js: Version 20.x or higher
- Package Manager: npm (v10+) or pnpm
- Git: For version control
- OS: Windows, macOS, or Linux
-
Clone the repository:
git clone [repository-url] cd nextjs-parallax-web-experience -
Install dependencies:
npm install
-
Run development server:
npm run dev
-
Build for production:
npm run build npm start
Note: This project is primarily a frontend application. However, it interfaces with external storage for assets.
- Asset Source: Supabase Object Storage
- Endpoint Pattern:
[BaseUrl]/[FrameNumber].webp - Hook Interface (
useImagePreloader):- Input:
variant: Variant - Output:
{ frames: HTMLImageElement[], isLoading: boolean, progress: number }
- Input:
- Global State:
VariantContextwraps the application layout, managing thecurrentVariantstate globally. - Hero Component:
ParallaxHeroconsumes context to display the correct image sequence. It controls the window scroll interaction. - Content Sections:
ProductSection,IngredientsSection, etc., consume context to update content dynamically based on the selected flavor.
| Component | Path | Description |
|---|---|---|
| ParallaxHero | src/components/hero/ParallaxHero.tsx | Manages the scroll-driven frame animation (400vh height). |
| VariantSwitcher | src/components/hero/VariantSwitcher.tsx | Handles user input for changing flavors. |
| ProductSection | src/components/sections/ProductSection.tsx | Displays "Our Story" with dynamic product imagery. |
Application logic handles the following internal states:
- Loading (0-99%):
isLoading: trueinuseImagePreloader. Blocks interaction. - Ready (100%):
isLoading: false. Unlocks scroll and reveals interface. - Error: Failed asset loads trigger console errors but attempt to degrade gracefully.
- 3D Parallax Scroll: Smooth scrubbing through 200 high-res frames as the user scrolls.
- Dynamic Theme Engine: Background colors and asset paths switch instantly based on variant selection.
- Asset Preloading: Custom hook ensures smooth playback by pre-fetching image sequences.
- Responsive Design: Mobile-first approach using Tailwind CSS v4 breakpoints.
- Component Encapsulation: ShadCN UI primitives used for standard elements like Accordion and Separators.
- Framework: Next.js 16 (App Router)
- Language: TypeScript 5.x
- UI Library: React 19.2
- Styling: Tailwind CSS v4 + PostCSS
- Animation: Framer Motion + Native Scroll Events
- Validation: Zod
- Assets: WebP sequences hosted on Supabase
RootLayout (VariantProvider)
โ
โโโ Navigation (Fixed)
โ
โโโ Page (Home)
โ โ
โ โโโ LoadingScreen (Overlay)
โ โ
โ โโโ ParallaxHero (h-400vh, z-0)
โ โ โโโ ParallaxBackground (Frames)
โ โ โโโ HeroContent (z-1)
โ โ โโโ Header/Buttons
โ โ โโโ VariantSwitcher
โ โ
โ โโโ ProductSection (z-10)
โ โโโ IngredientsSection (z-10)
โ โโโ NutritionSection (z-10)
โ โโโ ReviewsSection (z-10)
โ โโโ FAQSection (z-10)
โ โโโ CTASection (z-10)
โ
โโโ Footer
- Setup: Initialized Next.js project with TypeScript and Tailwind CSS.
- Data Modeling: Defined
Varianttypes and configured asset sources invariants.ts. - Core Logic: Implemented
useImagePreloaderto handle heavy asset fetching anduseParallaxfor scroll calculations. - Component Construction: Built modular sections (Hero, Product, FAQ) using ShadCN UI primitives.
- State Integration: Created
VariantContextto link the Hero switcher with downstream sections. - Refinement: Adjusted Parallax timing (Extended height to 400vh) to fix overlap issues.
- Optimization: Reduced frame count from 240 to 200 for better performance.
| ID | Area | Command / Action | Expected Output | Status |
|---|---|---|---|---|
| T-01 | Core | npm run dev |
Server starts on port 3000 without error. | ๐ข PASS |
| T-02 | Parallax | Scroll down 3000px | Animation plays smoothly through frame 200 before content covers it. | ๐ข PASS |
| T-03 | Responsiveness | Resize width to 375px | Buttons stack vertically, layout adjusts to single column. | ๐ข PASS |
| T-04 | State Management | Click "Next" variant | Hero color, hero image, and "Our Story" product image update simultaneously. | ๐ข PASS |
| T-05 | Production Build | npm run build |
Build completes with valid static generation and no lint errors. | ๐ข PASS |
The following tools were used to verify the integrity of the implementation:
- ESLint: Static code analysis for finding problems.
- TypeScript Compiler (tsc):: Type checking verification.
- Browser DevTools: Network throttling and z-index visualizer.
- Browser Subagents: Automated navigation and DOM inspection agents used during development.
- Issue: Hydration Mismatch. Fix: Ensured no browser-extension specific attributes were interfering, and synchronized server/client rendering logic.
- Issue: Next Section Overlap. Fix: Increased Hero section height from 300vh to 400vh to accommodate the full 200-frame animation sequence.
- Issue: Missing Images. Fix: Verified Supabase URLs and configured
next.config.ts(if needed for external domains, though basicimgtags were used for raw frames).
- No sensitive API keys are exposed in the client bundle.
- Asset URLs are public and read-only.
next.config.tsis configured to be secure by default.
The project is optimized for Vercel deployment:
- Push code to GitHub.
- Import project in Vercel Dashboard.
- Framework Preset: Next.js.
- Build Command:
next build. - Install Command:
npm install. - Click Deploy.
# Start Dev Server
npm run dev
# Build for Prod
npm run build
# Lint Code
npm run lint- Ensure a stable internet connection for asset loading (images are fetched from remote storage).
- The parallax effect relies on scroll events; extensive throttling is applied for performance, but very fast scrolling may skip frames visually.
- Lazy Loading: Content sections below the fold are standard React components.
- Image Optimization: WebP format used for all animation frames.
- Memory Management:
useImagePreloadermanages the buffer to prevent memory leaks, though caching is leveraged for smoothness. - Code Splitting: Next.js App Router automatically splits routes and components.
- Context API: Introduced
VariantContextto decouple component communication. - Z-Index Layering: Architectural change to allow content to "slide over" the fixed hero background.
- Future: Add more flavors by simply updating
variants.ts. - Future: Implement a backend CMS for dynamic text updates.
- Maintenance: Regularly update
npmdependencies to patch security vulnerabilities.
Successfully transformed a static concept into a scalable, interactive application. Maintained high visual fidelity while introducing strict engineering practices (Type safety, CI/CD readiness).
The application follows a standard Next.js App Router topology. page.tsx serves as the composition root for the homepage, injecting the ParallaxHero and subsequent sections. Data flows unidirectionally from the variants configuration file into the state context, which then distributes it to subscribers.
nextjs-parallax-web-experience/
โโโ src/
โ โโโ app/
โ โ โโโ globals.css # Tailwind & Global Styles
โ โ โโโ layout.tsx # Root Layout & Providers
โ โ โโโ page.tsx # Composition Root
โ โโโ components/
โ โ โโโ hero/ # Hero & Parallax Components
โ โ โโโ layout/ # Header & Footer
โ โ โโโ sections/ # Modular Page Sections
โ โ โโโ ui/ # Reusable UI Primitives (ShadCN)
โ โโโ contexts/ # React Context Definitions
โ โโโ hooks/ # Custom Business Logic Hooks
โ โโโ lib/ # Utilities & Constants
โ โโโ types/ # TypeScript Interfaces
โโโ public/ # Static Assets
โโโ package.json # Project Manifest
To showcase the project features in a live demo:
- Open terminal in
nextjs-parallax-web-experiencedirectory. - Run
npm run dev. - Open
http://localhost:3000. - Action 1: Reload page to show Loading Screen.
- Action 2: Scroll slowly to demonstrate Parallax and Layering.
- Action 3: At the top, click "Next" to switch variants - point out the color and image change.
- Action 4: Scroll down to "Our Story" - point out the matching product bottle.
- Action 5: Open DevTools (F12), toggle Device Toolbar, set to "iPhone 12", and show responsive layout.
This report confirms that the Olipop Next.js Website project meets all specified technical requirements. The system is robust, performant, and ready for deployment. All code generated adheres to modern web standards and best practices.