How bensonliao/avc-camera-webui-fe works
Project type and purpose
• This repository is a full-stack web application, combining a Node.js/Express “backend” that exposes REST-style handlers (account, asset, snapshot, system) with a rich single-page frontend (under src) built with component modules, SCSS styling, i18n support, and bundled via Webpack.
• The README focuses on the “webserver-frontend” setup and build, but the presence of backend/server.js, routers, and handlers indicates the Express service also serves APIs and static assets.
File structure
• Top-level “backend” folder:
• server.js – entrypoint for Express server
• routers/web-router.js – mounts API endpoints
• handlers/*-handler.js – implements controller logic
• models/errors.js – domain-level error types
• Top-level configuration:
• config/default.js – runtime settings
• .gitlab-ci.yml, Gruntfile.js, webpack.config.js – build & CI pipelines
• Frontend source under src:
• src/core – shared utility modules, state store, custom UI components, validations, i18n, drawing-canvas editor
• src/web – page containers, routing, and page-specific logic
• src/style – SCSS files, theming & layout
• i18n & languages – translation infrastructure and locale files
• Testing:
• cypress/ – end-to-end tests (fixtures, integration, plugins)
• tests/e2e/ – environment-specific E2E test suites
README for additional insights
• Development workflow (npm start, npm build) runs the Webpack dev server and Express backend.
• Branching strategy hints at multi-flavor releases (master vs. avn).
• Links to UI spec (Figma, Behance) confirm the SPA’s design focus.
a. Main components
• Client (Browser SPA)
• Webpack Dev Server / Static Asset Host
• Node.js/Express Backend
• Routers & Handlers (API Layer)
• Configuration Service (reads config/default.js)
• External Dependencies (e.g., device SDKs, file system, translation files)
• Cypress E2E Test Harness
b. Relationships & interactions
• Browser SPA → HTTP(S) → Express API endpoints
• Express Routers delegate → Handler controllers → (optional) Models or external services
• SPA uses src/core/apis/web-api.js to invoke backend, and i18n modules for translations
• Build pipeline (Grunt/Webpack) packages src → dist, then Express serves dist
• Cypress tests simulate user flows against the running dev server
c. Architectural patterns
• MVC-like routing: router → controller/handler → model
• Component-based UI (React or custom view library) under src/core/components and src/web/pages
• Centralized state/store (src/core/store.js)
• Layered separation: config, service, business logic, presentation
d. Key technologies
• Node.js, Express.js
• Webpack, Grunt
• SCSS (styled modularization)
• Cypress (E2E testing)
• i18next (localization)
• Formik (form management)
Detailed but not over-engineered
• Shared modules (src/core) as reusable library components.
• Keep external services (e.g., device SDK or file storage) clearly labeled but abstracted.
• End-to-end flow: code → build → serve → run → test.