How lingeorge88/admin_dashboard works
Project type and purpose
• This is a full-stack analytics/dashboard application.
• The “client” folder holds a React single-page application (SPA) that renders charts, grids, and navigation.
• The “server” folder contains an Express.js REST API using Mongoose models to persist users, products, transactions, and statistics in MongoDB.
File structure
• Top-level:
• client/ – React UI (public/, src/, package.json)
• server/ – Node/Express API (controllers/, models/, routes/, data/, index.js)
• Client src/ organizes code by reusable components (charts, grid helpers) and scenes (dashboard, breakdown, customers, etc.), plus a Redux-style state folder (api.js, geoData.js).
• Server follows an MVC-like pattern: routes → controllers → models.
• Configuration files: client/jsconfig.json, both package.json’s, .gitignore’s.
Main components
a. Client (React Browser SPA)
• UI Components (StatBox, OverviewChart, Sidebar…)
• Scenes (Dashboard, Breakdown, Transactions…)
• State Management (Redux store / RTK Query in src/state/api.js)
b. Server (Express API)
• Routes (client, general, management, sales)
• Controllers (client.js, sales.js, management.js, general.js)
• Data layer (server/data/index.js – sample or seed data)
• Models (User, Product, Transaction, AffiliateStat, OverallStat, ProductStat)
c. Database
• MongoDB cluster (external service)
d. External services (if any)
• Auth provider, analytics platform (not shown – optional placeholders)
Relationships and interactions
• Browser → HTTP(S) requests → Express Routes
• Routes invoke Controllers → Mongoose Models → MongoDB
• Responses (JSON) return to Client → RTK Query cache/store → UI components re-render
• Static asset serving: client/public builds served by a CDN or directly by the server in production build
Architectural patterns and design principles
• Client: Component-based UI, container/presentational separation, centralized state with RTK Query, code-splitting by scenes.
• Server: RESTful API, MVC separation, single responsibility in controllers, schema definitions in models.
• Clear separation of concerns: UI vs. application logic vs. data persistence.