How shriramtctallinone1/web-notification works
Project type and purpose
• This is a single-page application (SPA) built with Angular 9.x.
• Its main purpose is to display real-time notifications in the browser, driven by a WebSocket connection and (optionally) REST calls.
• There is no built-in backend in this repo; the app relies on external services (e.g., a notification WebSocket server and possibly a REST API).
File structure
• Top-level build/config files: angular.json, tsconfig*.json, package.json, Karma/Protractor configs.
• src/app/: the AppModule, AppComponent, routing module, plus a shared/ folder.
• shared/constants/: endpoint URL constants.
• shared/model/: TypeScript interfaces (e.g., AppNotification).
• shared/services/: NotificationService (REST or business logic) and WebsocketService.
• src/environments/: environment.ts and environment.prod.ts for endpoint configuration.
• src/assets/: static assets.
• e2e/ and src/**/*.spec.ts: end-to-end and unit tests.
README
• Confirms Angular CLI project.
• No built-in backend; it instructs on building, serving, and testing the front-end only.
Main components
a. Browser (Client)
• Hosts the Angular SPA.
• Users interact via AppComponent → routed child components (if any).
b. Angular SPA (Front-end)
• UI Layer: AppComponent and any generated components.
• Shared Module: houses services, models, constants.
• Environment Config: determines REST and WS endpoints at build time.
c. NotificationService (REST layer)
• Optional HTTP calls to an external REST API (e.g., to fetch past notifications).
d. WebsocketService (Real-time layer)
• Opens a WebSocket connection to an external notification server.
• Emits incoming messages as AppNotification objects.
e. External Services
• WebSocket Server (push notifications)
• REST API Server (optional pull/acknowledge endpoints)
f. (Optional) Data Store/Database
Relationships & Data Flows
• Browser asks Angular Router to display AppComponent.
• AppComponent injects NotificationService and WebsocketService.
• Incoming WS messages flow → WebsocketService → notifies subscribed components.
• If included, show REST API → Database for persistence.
Architectural patterns & design principles
• Modular design: One root AppModule plus a SharedModule.
• Dependency Injection: Angular’s injector provides services to components.
• Environment-based configuration: endpoints vary by environment.ts / environment.prod.ts.
• Separation of concerns: UI vs. data logic vs. connection logic.
Final checklist
[ ] Clear, descriptive labels for each component (e.g., “WebsocketService”).