How meeds-io/pwa works
Project type and purpose
• This is a multi-module Maven project delivering a Progressive Web App (PWA) addon for a Java portal platform.
• It comprises a build/packaging module, a Maven plugin for analytics and notification‐hook injection, a backend microservice exposing PWA REST endpoints, and a portlet‐based webapp client that serves the PWA manifest, service worker, and settings UI.
Top-level modules & their roles
• pwa-plugin: a Maven plugin that hooks into the host app’s event bus (gamification, social, tasks, wallet, etc.) to collect statistics and emit push notification payloads.
• pwa-service: a Spring-style backend microservice providing REST endpoints for manifest retrieval, push subscription management, service-worker registration, and push notification dispatch. It persists subscriptions and notification records.
• pwa-webapp: a portlet/web module (with Vue.js components) that runs in the portal, loads the PWA client scripts, displays settings screens, interacts with the pwa-service REST API, and registers the service worker in the browser.
Main components
a. Developer/CI system (Maven + GitHub Actions)
b. pwa-plugin (Maven extension during build)
c. pwa-packaging (assembly step produces static assets)
d. Artifact repository/Docker registry (optional)
e. pwa-service (Java microservice)
– REST API layer (PwaManifestRest, PwaPushSubscriptionRest, PwaNotificationRest, ServiceWorkerRest)
– Service layer (PwaManifestService, PwaSubscriptionService, PwaNotificationService, PwaSwService)
– Storage layer (PwaSubscriptionStorage, PwaNotificationStorage)
– Plugins SPI (PwaNotificationPlugin implementations, DefaultPwaNotificationPlugin)
– Event listeners (WebNotificationSentListener)
f. Database (or key‐value store) backing subscription and notification records
g. pwa-webapp (Portlet client)
– Portlet container (eXo/GateIn) hosting the portlet UI and configuration files (portlet.xml, web.xml)
– Vue.js frontend (PwaSettings, UserSettings components)
– Static assets (manifest.json, service-worker.js) served from classpath / resources
– Browser (Chrome, Firefox) running the PWA UI and registering service worker
h. Web Push Service (browser push endpoint, e.g., Mozilla WebPush, FCM)
Interactions & data flows
1. CI / Developer kicks off Maven build → pwa-plugin executes, gathers event hooks, generates plugin artifacts → pwa-packaging bundles manifest and service worker → artifacts published.
2. Deployment: pwa-service deployed to app server (or container); pwa-webapp deployed to portal.
3. User opens portal page → pwa-webapp serves HTML + JS → Browser fetches manifest.json & service-worker.js.
4. Browser registers service worker → service-worker uses Push API to subscribe user → subscription object sent to pwa-service via PwaPushSubscriptionRest.
5. Events occur in host system (e.g., new content, task assigned) → pwa-plugin captures the event payload → pwa-service’s plugin SPI processes and sends push messages via WebPush (VAPID keys).
6. pwa-service persists subscription & notification messages → WebNotificationSentListener logs success/failure → pwa-service REST notifies client if needed.
7. Browser service worker receives push notifications → displays via Notification API.
Architectural patterns & principles
• Multi-module Maven: clear separation of build/plugin, packaging, backend service, and client UI
• Plugin SPI & listener pattern for extensibility (new notification plugins can be added under pwa-plugin)
• Layered architecture in pwa-service (REST → service → storage → external push)
• PWA best practices: manifest.json, service worker caching, Push API and Notification API
• MVC/Portlet for the webapp layer, combined with a modern Vue.js single-page settings UI