How prophet-99/ng-conf-rxjs-cache works
Main components
• Frontend (Angular 18)
– App Shell (AppModule + AppComponent)
– HTTP Interceptor (http-security.interceptor.ts)
– Services
• AuthService
• DemoService
– State Services (RxJS stores)
• apiKeyStateService
• accessTokenStateService
• jwtStateService
– UI Components
• AuthComponent
• DemoComponent
• MockComponent
• Backend (NestJS 10)
– Modules
• ApiKeyModule
· api-key.controller.ts
· api-key.service.ts
· api-key.guard.ts
• AuthModule
· auth.controller.ts
· auth.service.ts
· jwt.strategy.ts
· jwt-auth.guard.ts
• DemoModule
· demo.controller.ts
· demo.module.ts
– Application Entry
• main.ts
• AppModule (app.module.ts)
• (Optional) Persistence Layer
– In-memory or external store for API keys/tokens (not explicit in code but represent as “Cache Store / DB”)
Relationships and data flow
• Frontend → HTTP Interceptor → AuthService / DemoService → RxJS State Services → API calls
• Interceptor attaches API key or JWT token from the relevant state service before dispatching HTTP requests.
• Backend Controllers receive requests → Guards validate API key or JWT → Services handle business logic → (Cache store) → Return responses
• Demo flow: DemoComponent triggers DemoService → interceptor attaches credentials → demo.controller returns dummy data.
Architectural patterns
• Frontend
– Module-component-service pattern
– Centralized state management using RxJS (behavior subjects, shareReplay, retryWhen, etc.)
– Single HTTP interceptor for cross-cutting concerns (security headers, token attachment)
• Backend
– Modular design (API Key / Auth / Demo modules)
– Guard-based authorization (API key guard, JWT guard)
– Strategy pattern for JWT validation (Passport JWT strategy)
– Dependency Injection for controllers and services
Technologies & frameworks to annotate
• Angular 18 (TypeScript, RxJS)
• NestJS 10 (TypeScript, Express under the hood, Passport for JWT)
• RxJS operators (shareReplay, switchMap, catchError, retry)
• JWT for authentication
• In-memory caching or external cache (represent generically)