How buildtruck/frontendwebapps works
Project type and purpose
• This is a single-page front-end application built with Vue 3 and Vite.
• It implements a multi-role management dashboard (admin, manager, supervisor) that consumes RESTful APIs (real or mock) to manage configurations, incidents, machinery, materials, personnel, projects, reports, and stats.
• It’s deployed as static assets via Firebase Hosting and, for local development, can use a JSON-server backend (server/db.json).
File structure
• Top level:
• index.html, public/, style.css → static assets and entry point
• src/ → application source
• server/db.json → mock data for JSON-server
• firebase.json, .firebaserc, .firebase/ → Firebase Hosting configuration
• Inside src/:
• core/ → shared components, base services, HTTP & user-API service, admin sub-module
• auth/ → authentication service and login view
• context/ → feature-based subdirectories for each domain (configuration, documentation, incidents, machinery, materials, personnel, projects, reports, stats) and user-role modules (manager, supervisor) with their own views, layouts, router, models, and API services
• router/index.js → client-side routing
• i18n.js + locales/ → internationalization
• App.vue & main.js → root component and bootstrapping
• Configuration/build:
• package.json, vite.config.js → dependencies and build tooling
• .env → environment variables (API endpoints, auth keys)
README for additional insights
• Confirms Vue 3 + Vite stack
• Emphasizes script-setup SFCs and scaling guidance
a. Main components
• Client (Browser) running the Vue 3 SPA
• Firebase Hosting (static asset CDN)
• Development JSON-server (server/db.json) or external REST API
• Authentication service (custom auth-API or Firebase Auth if configured)
• i18n engine for localization
• Shared core services (HTTP, base, user-API)
• Feature modules (contexts + core/admin)
• Vue Router for navigation
b. Relationships & interactions
• Browser ←(HTTP GET)→ Firebase Hosting serves index.html + JS/CSS
• Browser → (Vue Router) → dynamic component / view loading from src/
• Components → (service calls via HTTP service) → JSON-server or external API
• Auth views/services manage sign-in, obtain auth token, attach to API calls
• i18n engine loads locale files, injects into components
c. Architectural patterns & design principles
• Feature-based modular architecture (“context” folders)
• Service-layer pattern: each feature’s API service wraps HTTP calls
• Shared Core module for cross-cutting concerns (UI controls, notification, HTTP wrapper)
• Composition API & script-setup SFCs for lightweight, maintainable components
d. Key technologies/frameworks
• Vue 3, Vue Router, Vite, Composition API
• JSON-server for local mock backend or external REST endpoints
• Firebase Hosting for deployment
• i18n via vue-i18n