Skip to content

punkouter26/PoHappyTrump

Repository files navigation

Po.HappyTrump

Blazor Server app that transforms RSS news headlines into upbeat, positive talking points using Azure OpenAI GPT-4o. Built on .NET 10 with Vertical Slice Architecture, MediatR CQRS, and full observability via Serilog + Application Insights + OpenTelemetry.

.NET Blazor Azure OpenAI

Live Application

Quick Start

# 1. Clone
git clone https://github.com/punkouter25/PoHappyTrump.git
cd PoHappyTrump

# 2. Configure secrets
cd src/Po.HappyTrump.Web
dotnet user-secrets set "AzureOpenAI:Endpoint" "https://your-resource.openai.azure.com/"
dotnet user-secrets set "AzureOpenAI:ApiKey" "your-key"
dotnet user-secrets set "AzureOpenAI:DeploymentName" "gpt-4o"

# 3. Run
dotnet run --project src/Po.HappyTrump.Web

# 4. Browse to https://localhost:5001

Documentation

Document Purpose
ProductSpec.md PRD, success metrics, business logic
Architecture.mmd C4 System Context diagram
Architecture_SIMPLE.mmd High-level architecture view
ApplicationFlow.mmd User journey & navigation flow
ApplicationFlow_SIMPLE.mmd Simplified app flow
DataModel.mmd Entity relationships & schema
DataModel_SIMPLE.mmd Core data model
ComponentMap.mmd Frontend & backend component tree
ComponentMap_SIMPLE.mmd High-level component view
DataPipeline.mmd Data workflow & processing
DataPipeline_SIMPLE.mmd Simplified data flow
DevOps.md CI/CD pipeline & deployment
LocalSetup.md Day 1 setup & development guide
ImprovementSuggestions.md Top 5 improvement recommendations

Architecture Overview

flowchart TB
    subgraph Azure["Azure Cloud"]
        App["Po.HappyTrump Web App<br/>Blazor Server + .NET 10"]
        OpenAI["Azure OpenAI<br/>GPT-4o"]
        Speech["Azure Speech<br/>TTS"]
        Insights["Application Insights"]
    end
    
    User["End User"] -->|"Browse / Listen"| App
    App -->|"Transform Content"| OpenAI
    App -->|"Synthesize Audio"| Speech
    App -->|"Telemetry"| Insights
Loading

Key Architectural Decisions

  • Vertical Slice Architecture: Features organized by capability, not layer
  • MediatR CQRS: Commands and queries with handlers
  • Strategy Pattern: Fallback services for AI and TTS
  • Minimal APIs: Lightweight API endpoints
  • Blazor Server: Interactive server-side rendering

Technology Stack

Layer Technology
Frontend Blazor Server, Radzen, CSS Variables
Backend .NET 10, Minimal APIs, MediatR
AI Azure OpenAI GPT-4o
Audio Azure Speech Services
Telemetry Serilog, Application Insights, OpenTelemetry
Hosting Azure App Service
CI/CD GitHub Actions

Project Structure

PoHappyTrump/
├── src/
│   └── Po.HappyTrump.Web/          # Single-project Blazor Server app
│       ├── Components/              # Razor components (Pages, Layout)
│       ├── Features/                # Vertical slices (Messages, Health, Diagnostics, TTS, DevAuth)
│       ├── Services/                # AI transformation + RSS feed services
│       ├── Middleware/              # Correlation ID + security headers
│       ├── Common/                  # Key Vault manager, request ID generator
│       └── Models/                  # DTOs
├── tests/
│   ├── Po.HappyTrump.UnitTests/    # xUnit unit tests
│   ├── Po.HappyTrump.IntegrationTests/  # WebApplicationFactory integration tests
│   └── e2e/                        # Playwright E2E tests
├── docs/                           # Architecture docs, diagrams, runbook
├── .github/workflows/              # CI/CD pipeline
├── infra/                          # Bicep infrastructure templates
├── azure.yaml                      # Azure Developer CLI config
└── Directory.Packages.props        # Centralized NuGet versions

Features

  • AI-Powered Transformation: GPT-4o rewrites news with positive sentiment
  • Flip-Card UI: Compare original and transformed content
  • Audio Narration: 4 voice characters with news anchor styling
  • Positivity Scoring: 1-10 scale with visual indicators
  • Health Monitoring: Comprehensive diagnostics and health checks
  • Dark/Light Themes: Automatic and manual theme switching

Testing

# Unit tests
dotnet test tests/Po.HappyTrump.UnitTests/Po.HappyTrump.UnitTests.csproj

# Integration tests
dotnet test tests/Po.HappyTrump.IntegrationTests/Po.HappyTrump.IntegrationTests.csproj

# E2E tests
cd tests
npm install
npx playwright install chromium --with-deps
npm test

Deployment

GitHub Actions (Primary)

Push to master triggers automatic deployment to Azure App Service.

azd pipeline config --principal-type WorkloadIdentityFederated --provider github --branch master

Azure Developer CLI

azd auth login
azd up

See DevOps.md for detailed deployment configuration.

Configuration

Required Settings

Setting Description
AzureOpenAI__Endpoint OpenAI endpoint URL
AzureOpenAI__ApiKey OpenAI API key
AzureOpenAI__DeploymentName Model deployment name (e.g., gpt-4o)

Optional Settings

Setting Description
AzureSpeech__ApiKey Azure Speech API key for TTS
AzureSpeech__Region Azure Speech service region
ApplicationInsights__ConnectionString Telemetry connection string
KeyVaultName Azure Key Vault name

Screenshots

See the /docs/screenshots/ folder for visual references of the application.

License

MIT License - See LICENSE file for details.


Built with .NET 10, Blazor Server, and Azure OpenAI

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors