How ccu-class/frontend works
Main Components
• Browser / Client:
• Represents the end user’s browser where index.html is loaded and the Vue application starts.
• Vue Application Entry Point:
• Src/main.ts as the bootstrapping file that initializes the app.
• Routing:
• src/router/index.ts, which sets up navigational logic and maps paths to different views.
• State Management:
• The src/store directory (e.g., ccuplus.ts, course.ts, general.ts) that manages application state.
• Views & Pages:
• Components under src/views (e.g., page_home.vue, page_login.vue, page_main.vue, page_admin.vue, etc.) acting as container components that render full pages.
• UI Components:
• Components in src/components (organized into common elements, layout elements like navbar.vue and footer.vue, and page-specific components in pages folder).
• Business Logic & Helper Functions:
• Files under src/functions (such as course_add.ts, course_search.ts, token.ts) which appear to handle API calls, course operations, and other logic (likely interacting with a backend API, as indicated by the README instructions on renaming samole.env to .env).
• Styling & Build Configurations:
• Tailwind (tailwind.config.js, postcss.config.js) and Vite (vite.config.ts) configurations that affect rendering and build processes.
Establishing Relationships and Data Flow
• The Vue instance integrates with:
• The router that directs navigation to different views (e.g., home, main, login, tutorial).
• The store that manages shared state across components.
• Views render results, which then incorporate various UI components from the components directory.
• The UI components, in turn, may call business logic functions in the functions/ directory to handle tasks such as course operations, token management, or backend API interactions.
• A connection exists between the functions (service layer) and the backend API, which is configured via environment variables (using .env as indicated by the README).
Architectural Patterns and Design Principles
• Component-based Architecture:
• The project is structured in a modular way with reusability in mind (as seen in subfolders like common, layout, and pages).
• Separation of Concerns:
• Clear isolation between view rendering (components and views), routing (router), state management (store), and business logic (functions).
• Configuration-based Deployment:
• Use of .env files and configuration files (Vite, Tailwind, PostCSS) to separate environment-based settings from business logic.