How aas-chinmaya/whatsflow-tenant-client works
Main Components
• Client Application (Next.js Frontend)
• Public Module: Representing pages and layout starting from src/app/(public)/page.js and layout.js.
• Protected Module: Representing secured pages such as dashboard, agents, campaigns, customers, etc. These pages might rely on middleware (src/middlewares/authMiddleware.js) to enforce authentication rules.
• Layout & UI Components:
• Layout components (AdminLayout, Sidebar, TopNavbar in src/components/layouts) indicate the primary structure of the application.
• UI components like Button, Card, and Input (in src/components/ui) form the building blocks of the user interface.
• Container components (within src/components/containers) organize different domains (agents, billing, customer, subscription, etc.) by wrapping and composing UI components.
• State Management:
• Redux store configuration (found in src/store, including provider and slices like authSlice.js and notificationSlice.js) which is key for maintaining application state and handling data flow.
• API Services:
• The services layer (e.g., src/services/api.js) abstracts calls to external APIs or back-end services.
Relationships & Data Flow
• Use of middleware for authentication that intercepts requests to protected routes.
• Flow from UI components (rendered on pages) to container components that mediate business logic and then interact with the Redux store. From the store, actions are dispatched that eventually call the API services for backend communication.
• Integration points where API responses update the Redux store, which in turn updates the UI components.
Architectural Patterns & Design Principles
• File-Based Routing: Emphasize the Next.js approach where the folder structure (including designated folders for public and protected content) determines route paths.
• Container and Presentation Pattern: Note the separation between container components (handling complex state logic) and presentational/UI components (handling visual elements).
• State Management: Showcase the use of Redux (separate slices and a centralized store) to support application-wide state updates.
Technologies & Libraries
• Next.js: For server-side rendering and routing.
• React: As the base framework for building components.
• Redux: For state management, with defined slices for authentication and notifications.
• Additional Tools: ESLint (eslint.config.mjs), CSS and PostCSS (src/app/globals.css, postcss.config.mjs) for styling, and Next.js configurations.