How zahidrajudev/next-gmn works
1. This repository is a Next.js application organized around the older pages/ router, with a large shared UI/component layer and many route-level feature pages. It appears to power a content/media-oriented platform with public marketing pages, commerce/checkout flows, and a multi-role dashboard.
2. The application boundary is mostly frontend: page files under pages/ assemble screens, while reusable presentation and interaction logic lives under components/, layouts/, hooks/, and lib/. A small pages/api/ area and a top-level server.js suggest there is at least one custom Node server endpoint or server wrapper, but the bulk of the repo is client-facing UI.
3. There are three major route surfaces:
- Public site pages such as home, about, services, news, shop, live/video pages, policy pages, and contact/help pages.
- Authentication and checkout pages for login/register, email verification, password reset, and payment status/checkout.
- A large authenticated dashboard area under pages/dashboard/ with many subdomains for news/article management, media, payments, subscriptions, promotion, users/roles, settings, and versioned dashboard variants (v2, v3, v4, v5).
4. Layout composition is role-based. The layouts/ folder contains separate shells for the main public site and several dashboard personas: affiliate, author, team, user dashboard, and a general dashboard layout. These layouts likely define the persistent chrome—headers, sidebars, footers, and content framing—while individual pages provide the inner content.
5. The shared component system is the core architectural layer. components/elements/ contains generic UI primitives such as buttons, modals, drawers, tables, pagination, breadcrumbs, accordions, loading states, and router links. Higher-level blocks like headers, footers, sidebars, widgets, and partials build on those primitives to create reusable page sections.
6. State and app-wide coordination are concentrated in custom hooks and context:
- components/AppContext.jsx and hooks/appService.ts indicate shared application state and service wiring.
- hooks/lan_theme_currency_cart.ts suggests global preferences such as language, theme, currency, and cart-like state.
- hooks/global_media_gallery.tsx provides a cross-page media selection/gallery mechanism.
- hooks/tracking/ contains viewport and size-tracking utilities used by UI behavior and animation logic.
7. API/data access is abstracted through lib/. The presence of lib/api.js, lib/admin_api.js, and lib/user_api.js implies the app talks to different backend surfaces or permission tiers. Pages and hooks likely call these helpers rather than hitting network endpoints directly, which keeps page components thin and centralizes authentication/role-specific request logic.
8. Checkout and payments are their own subsystem. Under components/checkout/ are separate integrations for Stripe, bKash, and Nagad, plus add-card/subscription flows and backups. This is mirrored by dashboard payment pages for gateway management, transactions, affiliate earnings/payouts, and subscription logs, indicating a split between customer-facing checkout and admin/payment operations.
9. The dashboard is not a single monolith; it is organized by functional domains. Major admin areas include news/articles, products, press releases, packages/add-ons, media management, roles/users, email config, language, subscriptions, promotions, and AI-related gmnai pages. The v2–v5 dashboards suggest iterative UI generations or product lines that coexist in the same codebase.
10. Media and content workflows are first-class. There are pages for news editing, article creation, media libraries, trash/folder management, press content, live episodes, and brand/product archives. Shared components like uploaders, image boxes, media areas, and archive widgets show that content selection and asset reuse are core flows in the application.
11. Several specialized UI integrations are present but remain bounded in their own components:
- components/partial/echart.tsx for charting/analytics.
- components/elements/map_libre.tsx for map rendering.
- components/partial/gtranslate.tsx for translation.
- Animation helpers and sliders for richer marketing pages.
These are treated as reusable capabilities rather than page-level concerns.
12. Static assets are extensive and domain-specific. The public/ tree contains branded media, flags, logos, and many topic-specific image folders for home/about/news/live/promotion/service/write flows. This indicates the frontend relies heavily on local static media rather than dynamically generated imagery.
13. Styling and build tooling are standard Next.js ecosystem pieces: tailwind.config.js, postcss.config.mjs, styles/globals.css, TypeScript configuration, and the Next.js app/document bootstrap files. The stack mixes .tsx, .jsx, and .js, which suggests an incremental migration rather than a fully uniform TypeScript codebase.
14. For an architecture diagram, the most important boundaries are: public site vs authenticated dashboard; shared UI library vs page composition; local state/context/hooks vs remote API helpers; and checkout/payment providers vs in-app order/subscription management. The app is fundamentally a modular frontend shell over multiple content, commerce, and admin workflows.
Main entry points: dashboard/index.tsx Dashboard shell · pages/index.tsx Public pages · api.js API clients · MainLayout.tsx Layouts
Components 19
Shared app layer
Reusable UI, state, and data access used across routes.
- Server entry · Custom Node wrapper and API endpoint surface.
server.js - App bootstrap · Global Next.js bootstrapping and document wiring.
pages/_app.tsx - UI kit · Shared elements, inputs, icons, and reusable interaction primitives.
components/elements/button.tsx - Layouts · Main and role-based page chrome for public and dashboard areas.
layouts/MainLayout.tsx - State hooks · Global app context, preferences, gallery state, and viewport tracking.
hooks/appService.ts - API clients · Shared API helpers for public, admin, and user-tier requests.
lib/api.js
Public site
Marketing, media, and public content surfaces.
- Public pages · Home, about, services, media, policies, and content pages.
pages/index.tsx - Content routes · News, episodes, live video, brand, and write-for-GMN pages.
pages/news/[...slug].tsx - Shop pages · Shop catalog and item detail routes for public purchasing.
pages/shop/index.tsx
Auth and commerce
Login, verification, checkout, and status flows.
- Auth pages · Login, register, email verification, password reset, and status pages.
pages/login/index.tsx - Checkout flow · Checkout and checkout status surfaces used by customers.
pages/checkout/index.tsx - Payment providers · Stripe, bKash, Nagad, add-card, and subscription checkout integrations.
components/checkout/stripe/index.tsx
Dashboards
Authenticated admin and role-specific workspaces.
- Dashboard shell · Entry point for the authenticated dashboard and role-based variants.
pages/dashboard/index.tsx - Content admin · News, articles, press releases, brand, product, and package management.
pages/dashboard/news/index.tsx - Media library · Media browsing, uploads, trash, folders, and archive widgets.
pages/dashboard/media/index.tsx - Payments admin · Gateways, transactions, earnings, payouts, and subscription logs.
pages/dashboard/payments/gateway/index.tsx - Promotion admin · Promotion settings, Google integration, reports, and referrals.
pages/dashboard/promotion/index.tsx - Users and roles · User, role, journalist, and team-oriented dashboard management.
pages/dashboard/user/index.tsx - Dashboard variants · Versioned dashboard experiences and specialized workspaces such as v2-v5 and GMN AI.
pages/dashboard/v2/index.tsx
Connections 26
- App bootstrap → Public pages: renders · Bootstraps the public page tree.
- App bootstrap → Auth pages: renders · Bootstraps authentication and status pages.
- App bootstrap → Dashboard shell: renders · Bootstraps authenticated dashboard routes.
- Public pages → Layouts: uses · Public pages share the main layout shell.
- Content routes → Layouts: uses · Content-heavy pages use the main site layout.
- Shop pages → Layouts: uses · Shop pages share the public shell.
- Auth pages → State hooks: uses · Auth flows rely on shared state and preferences.
- Checkout flow → Payment providers: uses · Checkout screens delegate to payment integrations.
- Checkout flow → API clients: calls · Checkout status and order updates use API helpers.
- Payment providers → API clients: calls · Gateway-specific logic uses shared request abstractions.
- Dashboard shell → Content admin: routes to · Dashboard splits into domain-specific admin areas.
- Dashboard shell → Media library: routes to · Dashboard exposes media workflows.
- Dashboard shell → Payments admin: routes to · Dashboard exposes finance workflows.
- Dashboard shell → Promotion admin: routes to · Dashboard exposes promotion workflows.
- Dashboard shell → Users and roles: routes to · Dashboard exposes users and roles.
- Dashboard shell → Dashboard variants: routes to · Versioned dashboard branches coexist alongside the main admin shell.
- Content admin → UI kit: uses · Admin editors and tables are built from shared primitives.
- Media library → UI kit: uses · Media managers use uploaders, drawers, tables, and image widgets.
- Payments admin → API clients: calls · Payment ops pages rely on admin/user API helpers.
- Promotion admin → API clients: calls · Promotion tools use shared backend access wrappers.
- Users and roles → State hooks: uses · Role-aware dashboard state and context support people management.
- Public pages → UI kit: uses · Public pages assemble from shared components.
- Dashboard shell → Layouts: uses · Admin pages use dashboard-specific layouts and sidebars.
- Dashboard shell → State hooks: uses · Dashboard behavior is coordinated through shared app state.
- Public pages → API clients: calls · Public screens fetch shared backend data through lib helpers.
- Public pages → Server entry: served by · The custom server/API wrapper sits under the app boundary.