How joseph-1989/homecareexperts-next works
Project Type and Purpose
• This is a Next.js–based, TypeScript monorepo serving a multi-section web application (homepage, community, customer-support, property/service listings, user pages, admin panel). It’s primarily a frontend UI layer, using Apollo Client to fetch data from an external GraphQL backend. It also bundles responsive SCSS styling and i18n.
File-Structure Analysis
• Top-level folders:
• pages/ – Next.js route definitions (including pages/_admin for admin UI).
• apollo/ – GraphQL client setup, grouped by “admin” and “user” query/mutation modules.
• libs/ – Shared code: UI components (React), hooks, enums, types (GraphQL schemas, inputs), utilities, and auth helpers.
• public/ – Static assets (images, videos, localization JSON).
• scss/ – Global and per-page responsive style definitions for mobile/PC.
• Config/build files: next.config.js, next-i18next.config.js, tsconfig.json, docker-compose.yml, deploy.sh.
README Insights
• Bootstrapped via create-next-app: standard dev commands, SSR/SSG, API routes (although none under pages/api here).
• Emphasizes Next.js features (font optimization, dynamic routing) and Vercel deployment.
a. Main Components
• Client browser (User Agent)
• Next.js frontend server (SSR/SSG, static-file server)
• Apollo Client layer (in-browser/cache, fetch logic)
• External GraphQL API service
• Database (e.g., PostgreSQL/MySQL behind the GraphQL API)
• CDN or static‐file storage (serving public/ assets)
• Optional Auth service (JWT issuer/validator)
b. Relationships & Data Flows
1. User → HTTP(S) → Next.js server (renders pages SSR or serves static HTML/CSS/JS).
2. Next.js page/component → Apollo Client → GraphQL API → Database.
3. Client reads/writes via Apollo cache; invalidations flow back to UI.
4. Static assets (images, videos) served via CDN or Next.js public folder.
5. Localization JSON fetched by next-i18next at SSR time or client side.
c. Architectural Patterns
• Monorepo modularization (libs folder for shared code).
• Component-based UI (React + TSX in libs/components + pages).
• GraphQL client-server pattern (Apollo).
• SSR/SSG hybrid rendering (Next.js).
• Responsive design (SCSS mobile/PC splits).
d. Key Technologies
• Next.js (routing, SSR, static export)
• React + TypeScript (UI)
• Apollo Client (GraphQL queries/mutations in apollo/*)
• SCSS (responsive styling under scss/)
• next-i18next (i18n)
• Docker & docker-compose (containerization)