How lyqht/mini-qr works
Main Components
• Frontend / PWA Layer:
• Entry point: index.html; application startup via src/main.js that bootstraps the Vue application (App.vue).
• UI Components: Organized into “src/components” and specifically grouped reusable UI pieces under “src/components/ui” (dialogs, drawers, popovers, button groups, etc).
• Assets & Presets: Static preset configurations and style presets under “src/assets/presets” which define predefined QR code styles.
• Internationalization: Managed via the “locales” folder containing language JSONs for over 30+ languages.
• Testing & Quality:
• Playwright e2e tests in “tests/e2e” guarantee front-end functionality.
• Linting and formatting configurations (e.g., .eslintrc.cjs, .prettierrc.json) ensure code quality.
• Deployment & DevOps:
• Dockerfile, docker-compose.yml, and GitHub workflows (under .github/workflows) streamline builds, containerization, and CI/CD pipelines.
• PWA support integrated into the application, with service worker and manifest configurations (likely generated/handled by Vite PWA plugins and public folder resources).
Relationships and Interactions
• The entry point (index.html and src/main.js) boots the Vue app, which renders the App.vue component.
• App.vue orchestrates routing, state management, and renders different UI components that are responsible for specific functions such as QR code creation (components like QRCodeCreate.vue), scanning (QRCodeScan.vue, QRCodeCameraScanner.vue) and previewing (StyledQRCode.vue).
• The presets (QR code styling configurations) from src/assets/presets are applied within the UI to offer customizable designs.
• Interaction with the device’s camera (for scanning) or clipboard (for copying) happens within specialized components.
• E2E tests simulate typical user flows, ensuring that user interactions trigger the correct internal component communication.
• Deployment is containerized using Docker, ensuring that the entire front-end can be hosted easily (self-hosting option described in the README).
Architectural Patterns & Design Principles
• Component-Based Architecture: The project extensively uses Vue’s component system, splitting the UI into reusable parts.
• Separation of Concerns: Clear folder delineation between presentation (UI components), business logic (utils, lib), assets (presets, images) and configuration (Docker, Vite, ESLint).
• Internationalization: The inclusion of many locale files emphasizes the need to design a system that readily supports multiple languages.
• PWA Design: Capturing service worker, offline capabilities, and an installable app experience.
• DevOps & CI/CD: With Docker files and GitHub actions, an automated build and test process is integrated to support continuous deployment.
Elements
• "Entry Point (index.html & main.js)"
• "Vue Application (App.vue)"
• "UI Components (QR Code Creation, Scanning, etc.)"
• "Business Logic & Utilities (QR Code generation, i18n, etc.)"
• "Assets & Presets (Static configurations for QR styles)"
• "Testing (Playwright e2e)"
• "Docker Configuration" (Dockerfile & docker-compose)
• "CI/CD Pipeline" (GitHub workflows)
• Data flow from the user triggering events (e.g., scanning or creating a QR code) through UI components to business logic.
• Interaction between i18n utilities and UI components.
• Build/test/deploy flows from source code through Docker and GitHub Actions.
Final Recommendations
• To include annotations next to each component explaining its main responsibilities.