How map-rank/residat-front-office works
Project Type and Purpose
• This is a full-stack climate-risk platform’s frontend repository (“residat-front-platform”), implemented as a Vue 3 Single-Page Application (SPA) built with Vite.
• It delivers interactive GIS dashboards, community reports, chatrooms, and push notifications. The frontend consumes backend REST APIs, leverages Firebase Cloud Messaging, and loads static GeoJSON data for maps.
File-Structure Analysis
• Top-level:
• public/ – static assets (GeoJSON, images, service worker for FCM)
• src/ – application source
– api/ (axios wrappers & endpoints)
– components/ (base UI & common components)
– features/ (domain-oriented Views: Auth, ChatRoom, Community, etc.)
– services/ (business-logic wrappers over API calls)
– stores/ (Pinia/Vuex stores for state management)
– router/, langs/, plugins/, utils/, model/
• Config files: Dockerfile, Vite, PostCSS, Tailwind, GitHub Actions workflows – indicate CI/CD, containerization, and static-site deployment.
Key Architecture Insights from README
• SPA front-end interacts with microservices exposing endpoints for Auth, Posts, Events, Notifications, Reports, etc.
• Uses Firebase for push notifications (service worker registered in public/).
• Serves static GeoJSON from public/assets and storage/, plus dynamic spatial data from backend.
Main Components
A. Client Layer (Browser/Mobile)
• Vue 3 SPA (App.vue, Features, Components)
• Pinia stores (state)
• Vue Router (navigation)
• Localization (i18n)
• Service Worker (public/firebase-messaging-sw.js)
B. Static Asset Hosting
• CDN / S3 or NGINX (serves index.html & JS bundles, static GeoJSON)
C. Backend API Services
• Auth Service
• Post Service
• Event Service
• Report Service
• Notification Service
• Disaster / Zone / Sector Services
• Each exposed as REST endpoints (https://api.residat.com/…)
D. Real-Time & Push Infrastructure
• Firebase Cloud Messaging (for mobile/Web pushes)
• (Optionally) WebSocket / Socket.IO or Firestore Real-Time DB for ChatRooms
E. Data Stores
• Primary Database (e.g., PostgreSQL/PostGIS for spatial data)
• Blob/Document Storage (for reports, images)
• Cache / CDN for GeoJSON tiles
F. External GIS/Mapping Services
• Tile Provider (OSM, Mapbox)
• GeoJSON file hosting (in public/assets, storage/)
Relationships & Data Flows
• Browser → (HTTPS) → CDN → index.html & JS bundle
• Vue App → (HTTP/REST) → Backend API endpoints → Database
• Vue App → (WebSocket or Firebase SDK) → Real-Time Chat service
• Vue App → (FCM SDK) → Firebase Cloud Messaging → Device notification
• Vue App → (Direct fetch) → Static GeoJSON in public/ or S3/Storage
• Backend → (DB queries) → PostGIS spatial queries → serves JSON
Architectural Patterns & Principles
• Feature-based modularization (src/features)
• Component library + atomic/base components (src/components/base)
• Service abstraction (src/services & src/api)
• State management with Pinia (stores folder)
• Separation: View (Vue components) ←→ State (stores) ←→ API (services)
• CI/CD: Docker build → Static Deployment (GitHub Actions)
• Testing: Vitest for unit & integration tests