How analytica-manulife/frontend works
Project type and purpose
• This is an ASP.NET Core Razor Pages web frontend (monolithic) targeting .NET 9.0.
• It delivers a finance dashboard and workflow: user authentication, budget management, invoice upload and parsing, stock portfolio display and trading, and news aggregation.
File structure
• Top-level “Frontend” project contains:
• Pages (Razor views and code‐behind) – the presentation layer
• Model – domain DTOs, JSON converters, naming policy filters
• Service – HTTP client wrappers for downstream APIs
• Middleware – cross-cutting concerns (authentication)
• Filter – JSON parsing and invoice conversion helpers
• wwwroot – static assets (CSS, JS, Bootstrap, jQuery)
• Program.cs / appsettings*.json – host configuration and DI setup
• No DB code here; data storage and business logic live in external APIs.
Key insights from README
• Minimal README; naming implies “Frontend” only.
• Interaction is primarily via REST‐style APIs (BudgetApiService, InvoiceService, NewsService, PortfolioService, StockService, YahooFinanceService, StockSuggestionService, AuthService).
Main components & relationships
A. Browser / Client
• Requests HTML, CSS, JS, and uses forms and AJAX calls to the Razor Pages endpoints.
B. Web Server (ASP.NET Core / Kestrel or IIS)
1. Middleware Pipeline
• AuthenticationCheckMiddleware ensures user identity before hitting pages.
2. Routing → Razor Pages handlers
• Each page (e.g. /Budget, /Portfolio, /MarketWatch, /UploadInvoice) invokes its PageModel (code‐behind).
3. Service Layer
• PageModel calls Service classes (e.g. BudgetApiService) injected via DI.
• Services perform HttpClient calls to external microservices or third‐party APIs.
4. Filter & Converter Modules
• Incoming JSON uses JsonSnakeCaseNamingPolicy, Nullable*Converters for JSON ↔ Model mapping.
• InvoiceParser + InvoiceItemConverter transform raw invoice payloads into domain objects.
5. Models
• DTOs (Account, Budget, Portfolio, StockTransaction, StoryResponse, etc.) represent data in the UI.
C. External Systems (downstream APIs)
• Auth API / Identity Provider
• Budget microservice
• Invoice processing service
• News aggregation API
• Portfolio / Trading API
• Yahoo Finance external API
• Stock suggestion engine
Architectural patterns & design principles
• Layered architecture (Presentation → Application Services → External APIs)
• Dependency Injection for services and filters (built‐in ASP.NET Core DI)
• Middleware for cross-cutting concerns (authentication, error handling)
• DTO / Converter pattern for JSON mapping and domain modeling
• Razor Pages MVC style (Pages + PageModels)
Detail
• Every unique service and filter as its own component.
• Clearly that there is no direct database—it all flows through external microservices.
• Don’t omit the Middleware layer—authentication is core to every page.
• Pages logically (Budget, Portfolio, MarketWatch, News, Invoice Upload) to show feature boundaries.