How minhhkhoa/next_bazaar works
Project type and purpose
• From the README (“bootstrapped with create-next-app”) and the file tree (next.config.ts, src/app/..., src/api/..., public/, etc.), this is a Next.js full-stack (frontend-centric) application.
• The directory names (dien-thoai, laptop, serum, thoi-trang, tin-tuc, auth, etc.) and components (Products, News, Contact) indicate an e-commerce/news portal with server-rendered pages, client-side interactivity, and simple API routes serving local JSON data.
File structure
• Top-level config+meta: .gitignore, package.json/lock, tsconfig.json, next.config.ts, postcss.config.mjs, eslint.config.mjs.
• public/: static assets (images, banner files).
• src/app/: Next.js App Router pages, sub-folders represent route segments, each with page.tsx for SSR/SSG.
• src/api/: Next.js API routes (News/getDetailNews.ts, Products/getProductByCategoryId.tsx) providing JSON data to pages.
• src/components/: Reusable UI components (Header, Footer, Products, News, Contact, Swiper, etc.).
• src/redux/: Redux Toolkit store and slices for global state (newsSlice, productSlice).
• src/data/: Local JSON files for news and product/category data.
• src/hook/: Custom hooks (scroll, window size).
• src/ultils/: Utility functions for menu building and price formatting.
• Build and styling: postcss, SCSS, global CSS in src/app.
README for additional insights
• No external database: data is local JSON under src/data.
• Client → App Router (page request)
• App Router → API Route (fetch data)
• API Route → Data Store (read JSON) → API Route (return JSON) → App Router → Client
• Blue for server-side components (Next.js, API routes)
• Green for client-side components (React UI, Redux)
• Gray for data (JSON files, public assets)
• Rectangles for modules/services
Final advice
• Be exhaustive: break the system into all logical parts (routing, data, UI, state) but avoid clutter.
• Flow of a single page request, then overlay client-side navigation and data fetching.