How zhyi-source/zhouyi-admin works
Project type and purpose
• This is a pure‑front‑end single‑page application (SPA) admin template (“ZHOUYI·ADMIN”) built with Vue 3 + ElementPlus + JavaScript + Pinia + Vite.
High‑level architecture
• Developer Environment
• Node.js + npm/Yarn for dependency management
• Vite as dev/build tool and local server
• Deployment
• Production build → static assets (HTML/CSS/JS) → served via any static host (Nginx/CDN)
• Runtime (Browser)
• Vue 3 application loaded in the browser
• Vue Router drives view transitions
• Pinia manages application state
• Axios‑based API modules communicate with external REST endpoints
Main components
a. Developer Tooling Layer (outside the browser)
• Node.js & Vite dev server (npm run dev)
• Build step (npm run build) → outputs /dist
b. Static Hosting Layer
• Web server or CDN serving the built assets
c. Client (Browser) Layer – group as one large container labelled “Vue 3 SPA”
1. Entry Point (index.html + main.js)
2. Routing (src/router)
3. UI Layer (src/components, src/layout, src/views)
4. State Management (src/stores via Pinia)
5. API Service Layer (src/api)
– server.js configures Axios (base URL, interceptors)
– modules/api.*.js define REST calls (login, users, roles)
6. Assets & Styles (src/assets, SCSS abstracts, themes)
d. External Services
• Backend REST API (authentication, user/role management, logs)
• (Optionally) Third‑party services—analytics, SSO, CDN for fonts/images
Relationships & data flows
• Developer → (npm run dev) → Vite dev server → Browser
• Browser loads SPA → Router navigates → Views composed from Components
• Components dispatch actions to Pinia stores → commit/mutate state
• Store or Components invoke API modules → Axios → External REST API → JSON responses → back through Axios → update store/UI
• Built assets → deployed to Static Hosting → consumed by end users
Architectural patterns & design principles
• Component‑based UI: reusable Vue single‑file components
• MVVM‑like separation: Views/Components (View), Pinia (ViewModel), API modules (Model)
• Layered architecture: presentation (components), application logic (store/routes), integration (API layer)
• Theming & abstraction: SCSS partials for variables, mixins, themes
Essential elements
• Clear labels for: Dev Machine, Vite Dev Server, Build Output, Static Host, Browser (SPA), External REST API
• Grouped modules inside containers with titles (e.g., “src/components”, “src/stores”)