How vieduckk/trade-master works
Project type and purpose
• This is a Next.js-based full-stack web application that uses React and the new “app” router.
• It provides a multilingual marketing/site front-end (EN/VI) with server-side rendering (SSR)/static-site generation (SSG).
• It hosts static assets (images, fonts, audio, video) in the public/ folder and uses Tailwind CSS for styling.
File structure
Top-level files & folders:
• next.config.mjs, middleware.ts – Next.js configuration and edge/middleware logic
• public/ – static assets (fonts, images, videos, audio) served directly by Next.js
• src/app/ – the “app” directory, organized by locale ([lng]) with React components, pages, layouts
• src/app/i18n/ – internationalization logic, locale files and settings
• src/configs/ – site-wide configuration (fonts, navigation, news data)
• tailwind.config.ts, postcss.config.mjs – CSS/build configuration
• tsconfig.json, package.json – TS and dependency management
Patterns & architectural hints:
• i18n routing: src/app/[lng]/layout.tsx plus middleware.ts to redirect based on locale
• Component hierarchy: shared UI pieces under components/ (Header, Footer, Button, IntroVideo, etc.)
• Data/config entry points: JSON files under src/app/i18n/locales/…, src/configs/*.ts
• Static asset serving: fonts, videos, images under public/ with direct URL mapping
Extract insights from the README
• Standard create-next-app project – no custom backend beyond Next’s SSR/SSG.
• Deploys on Vercel (edge functions, static hosting).
• Uses next/font for Google Font optimization.
Detailed breakdown of components
• Build Pipeline
– Tools: TypeScript compiler, PostCSS, Tailwind, next/font optimizer
– Outputs: compiled server code, client bundles, optimized assets
• Next.js Server / Edge
– Middleware.ts: language detection and rewrite rules
– Routing: src/app/[lng]/layout.tsx → page.tsx
– SSR/SSG: loads React components + JSON config + locale files
• Config & i18n Store
– src/configs/*.ts: navigation, fonts, news data
– src/app/i18n/locales/*/*.json: field-level translations
• Component Library
– UI primitives (Button, Header, Footer) under components/
– Page-specific components (Roadmap, Tokenomics, News, IntroVideo)
• Static Asset Host
– public/: directly served assets (fonts, images, videos, audio)
– CDN layer in front of public/ for caching