How andreud/push-beam-widget-vuespa works
• Enable personalized notifications for specific users (via the BeamsAuthUser component) or
• Enable subscriptions to public interest groups (via the BeamsSubscribeInterest component).
Main Components
• Frontend Application:
• Represented by the Vue SPA contained in the “src” directory. This includes the main application file (App.vue), various Vue components (e.g., BeamsAuthUser.vue, BeamsSubscribeInterest.vue), composables (useBeamsClient.ts), and styling/assets.
• The entry point (index.html) loads the Vue app, with initialization in main.ts.
• Vite is used to bundle and build the application (as indicated by vite.config.ts and related tsconfig files).
• Service Worker (PWA-related):
• Located in “public/service-worker.js” to manage caching and possibly background tasks.
• Backend/Serverless Component:
• The project includes “netlify/functions/beamsauth.mts”, which is a Netlify serverless function to handle authentication logic for personalized notifications. This function acts as the backend API endpoint for the BeamsAuthUser component.
• Testing Infrastructure:
Architectural Patterns and Design Principles
• Separation of Concerns:
• The frontend is solely responsible for the UI and user interactions.
• All security-sensitive or authentication-related logic is encapsulated in the serverless function.
• Component-Based Architecture:
• Each widget (BeamsAuthUser and BeamsSubscribeInterest) is a self-contained component that encapsulates its own business logic, making the design modular and extensible.
• Use of a Build Tool and TypeScript:
• Vite and TypeScript configurations indicate a modern development stack that supports fast development cycles and typed code.
Technology Details
• Vue for building the user interface.
• Vite for bundling and development.
• TypeScript for type safety (as seen in multiple tsconfig files).
• Netlify functions for serverless backend logic.
• Playwright and Vitest for end-to-end and unit testing, respectively.
• Pusher Beams as the external notifications service.