# GoodGo Frontend Exploration - Complete Documentation ## πŸ“ Generated Files All files are saved to your Desktop. Read them in this order: ### 1. **README_EXPLORATION.txt** (16 KB) ⭐ START HERE - **Purpose**: Overview & quick summary - **Contents**: - Key findings (10 major insights) - Dependencies summary - Component import patterns - Quick start guide - Notable implementation details - Pro tips & file size reference - Next steps for development ### 2. **ARCHITECTURE_OVERVIEW.txt** (24 KB) - **Purpose**: Visual diagrams & data flows - **Contents**: - Routing & layout hierarchy (ASCII tree) - Listing detail page component flow - API & state management data flow - Neighborhood components detail - Chart components stack - Component import patterns (static/dynamic) - Mapbox GL initialization flow - i18n flow diagram - SEO & metadata generation flow ### 3. **FRONTEND_QUICK_REFERENCE.txt** (19 KB) - **Purpose**: Quick lookup reference - **Contents**: 15 sections covering: - Project structure - Core tech stack - Neighborhood features detail - Mapbox GL patterns - Chart components - API client architecture - React Query hooks - Listing detail page flow - State management layers - Design system components - i18n setup - Performance optimizations - Key file paths - Coding patterns - Debugging tips ### 4. **FRONTEND_EXPLORATION_REPORT.md** (16 KB) - **Purpose**: Deep technical dive - **Contents**: 12 comprehensive sections: 1. Overall directory structure 2. App Router structure 3. Components directory (23 domains) 4. Existing neighborhood components 5. Mapbox GL integration 6. API client setup 7. Hooks & React Query integration 8. Chart components (Recharts) 9. Listing detail page structure 10. State management patterns 11. Key file patterns & conventions 12. Performance & SEO optimizations --- ## πŸ—ΊοΈ Quick Navigation ### For different needs, use: **"I want a 5-minute overview"** β†’ Read: **README_EXPLORATION.txt** (Key Findings section) **"I need to understand the architecture"** β†’ Read: **ARCHITECTURE_OVERVIEW.txt** (start with the diagrams) **"I need to find a specific file or pattern"** β†’ Search: **FRONTEND_QUICK_REFERENCE.txt** (Use Ctrl+F) **"I need complete technical details"** β†’ Read: **FRONTEND_EXPLORATION_REPORT.md** (full reference) --- ## πŸ“Š Project Stats - **Framework**: Next.js 15.5.14 with App Router - **Components**: 23 domains with 15+ major feature areas - **Mapping**: Mapbox GL 3.21.0 (3 map components) - **Charts**: Recharts 3.8.1 (6 chart types) - **Neighborhood Features**: Fully implemented (3 components) - **API Modules**: 12+ domain-specific clients - **React Query Hooks**: 10+ custom hooks - **Routes**: Public, Auth, Dashboard, Admin (all locale-aware) - **Listing Detail Page**: 39 KB client component with 9 sections --- ## 🎯 Key Takeaways ### Architecture - βœ… Domain-based component organization - βœ… Separated concerns (API, hooks, stores, components) - βœ… Locale-aware routing with i18n - βœ… Dynamic imports for performance - βœ… Type-safe API client with CSRF protection ### Features - βœ… Neighborhood scoring (6 categories, 0-10 scale) - βœ… POI mapping (6 categories with SVG icons) - βœ… Price history charts - βœ… Theme switching (light/dark) with Mapbox - βœ… Multi-language support (Vietnamese/English) ### Tech Stack - βœ… React 18 + Next.js 15 App Router - βœ… Tailwind CSS + CVA for styling - βœ… React Query + Zustand for state - βœ… Mapbox GL for mapping - βœ… Recharts for data visualization - βœ… next-intl for internationalization --- ## πŸ” Key Files ``` lib/ β”œβ”€β”€ api-client.ts # Base HTTP client (CSRF, 401 refresh) β”œβ”€β”€ listings-api.ts # Listing endpoints β”œβ”€β”€ analytics-api.ts # Analytics/market data β”œβ”€β”€ mapbox-style.ts # Theme-aware map styles └── hooks/ └── use-analytics.ts # React Query pattern example components/ β”œβ”€β”€ listings/ β”‚ └── listing-detail-client.tsx # Main detail page (39 KB) β”œβ”€β”€ neighborhood/ β”‚ β”œβ”€β”€ neighborhood-poi-map.tsx # Mapbox POI layer (11 KB) β”‚ β”œβ”€β”€ neighborhood-radar-chart.tsx # Recharts radar (2 KB) β”‚ └── types.ts # Neighborhood types β”œβ”€β”€ map/ β”‚ β”œβ”€β”€ listing-map.tsx # Listings on map β”‚ └── location-picker.tsx # Location selection β”œβ”€β”€ charts/ β”‚ β”œβ”€β”€ price-area-chart.tsx # Area chart β”‚ β”œβ”€β”€ district-heatmap.tsx # Heat visualization β”‚ └── ... └── design-system/ # UI components & patterns app/ └── [locale]/ β”œβ”€β”€ (public)/listings/[id]/page.tsx # Detail page (Server RSC) β”œβ”€β”€ (dashboard)/ # Protected routes └── (admin)/ # Admin routes ``` --- ## πŸ’‘ Important Patterns ### API Usage ```typescript const data = await apiClient.get('/endpoint'); ``` ### React Query Hook ```typescript export function useData(param: string) { return useQuery({ queryKey: ['key', param], queryFn: () => api.getData(param), enabled: !!param, }); } ``` ### Dynamic Component Import ```typescript const Component = dynamic(() => import('...'), { ssr: false, loading: () => }); ``` ### Mapbox Integration ```typescript 'use client' const style = useMapboxStyle(); // light/dark const map = new mapboxgl.Map({ style }); ``` --- ## πŸš€ Commands ```bash npm run dev # Dev server (port 3000) npm run build # Production build npm run lint # ESLint check npm test # Vitest tests npm run typecheck # TypeScript check ``` --- ## πŸ“ Notes - All reports are **self-contained** - you can read any of them independently - File paths are **absolute** from `/apps/web` - Component sizes range from **2 KB** (radar chart) to **39 KB** (listing detail) - Neighborhood features are **already implemented** and ready to use - Mapbox GL requires **'use client'** directive - All charts use **CSS variables** for theming - i18n uses **[locale]** route parameter (vi/en) --- ## πŸ“ž Quick Reference **What does NeighborhoodPOIMap do?** β†’ Section 3 of README, or QUICK_REFERENCE section 3 **How do I add a new chart?** β†’ QUICK_REFERENCE section 5 (Chart Components) **Where's the API client?** β†’ QUICK_REFERENCE section 6 (API Client Pattern) **How does state management work?** β†’ README section "State Management Layers" or QUICK_REFERENCE section 9 **What about performance?** β†’ QUICK_REFERENCE section 12 (Performance Optimizations) --- Generated: April 21, 2026 Base Path: `/Users/velikho/Desktop/WORKING/goodgo-platform-ai/apps/web`