How junlog/vue-shop-admin works
Project Identification
• The project is a full-stack application that provides an e-commerce management backend using a Vue.js front-end (vue_shop) with Element-UI and a Node.js/Express API server (vue_api_server).
• There is also a separate server component (vue_shop_server) used to serve the built (dist) static files for the front end, indicating that the project employs different deployment stages (development vs. production builds).
Main Components
a. Frontend:
• Vue Shop (vue_shop): This is the Vue.js single-page application. It contains components (views for Home, Login, Goods, Order, Report, etc.), router configurations, global assets, and plugins (Element-UI, timeline, etc.).
• Use of modern Vue.js practices such as dynamic component loading (used for lazy routing) and CDN integration as discussed in the README.
b. Backend API Server:
• Vue API Server (vue_api_server): This Node.js/Express backend provides RESTful API endpoints for various resources (categories, goods, orders, reports, rights, roles, users, etc.).
• The file organization includes configuration files (config/default.json), a modular architecture with directories for DAO (data access objects), models, routes, services, and auxiliary modules (like database connection, authorization, logging, ueditor integration). This shows adherence to a layered design (controller/routes → service logic → data access objects & models).
c. Web Server for Production Build:
• Vue Shop Server (vue_shop_server): This is used to serve the production build of the Vue front-end. It includes assets under the “dist” folder (HTML, CSS, JavaScript, images) and is powered by an Express server that handles HTTP requests.
d. Database:
Relationships and Interactions
• The Vue Shop front-end fetches data from the Vue API Server via AJAX/RESTful HTTP requests.
• The Vue API Server interacts with the MySQL database (using a DAO model layered with Models and Services).
• The Vue Shop Server (production Express server) serves the static built version of the front-end assets, so it’s an alternative to development serving from the Vue CLI.
• Auxiliary integrations like UEditor (for rich text editing) are part of the public assets served by the API server, and they interact directly with front-end pages that require text editing.
Architectural Patterns and Design Principles
• Separation of Concerns: Frontend and backend are completely separated. Within the backend, the use of DAO, Model, and Service layers ensure logical separation.
• MVC/MV* Concepts: Although not a strict MVC, the API server’s directory structure (models, dao, routes, services) resembles MVC layered architecture.
• Use of external libraries and build tools (Element-UI, vue-cli, babel configurations, PM2 for production process management) can be noted as part of the technology stack.
Final Reminders for the Principal Software Engineer
• Component and sub-layer is clearly delineated and labeled.
• Relevant technologies: Vue.js, Element-UI, Node.js/Express, MySQL, and supporting libraries like babel-plugin-transform-remove-console.