Skip to content

Web-hosted plan analysis via Blazor WebAssembly #2

@erikdarlingdata

Description

@erikdarlingdata

Summary

Add a web-hosted version of the plan analysis engine using Blazor WebAssembly. Users paste plan XML or upload .sqlplan/.xml files, and the full analysis runs entirely in the browser — no server, no data leaves the machine.

Motivation

  • Makes the analysis engine accessible without installing the desktop app
  • Privacy differentiator vs. Paste The Plan and similar tools: "your plan XML stays on your browser"
  • Zero hosting cost via GitHub Pages (static files only)
  • Reuses the existing C# analysis pipeline unchanged

Architecture

Core Project Split

PlanViewer.Core currently references Microsoft.Data.SqlClient and Meziantou.Framework.Win32.CredentialManager, which won't compile for WASM. The analysis engine itself has zero server dependencies — it's pure XML parsing + rule evaluation + output formatting.

Split into:

src/PlanViewer.Core.Analysis/     <- NEW: parser, analyzer, formatter, models
src/PlanViewer.Core/              <- keeps SqlClient deps, references Core.Analysis
src/PlanViewer.Web/               <- NEW: Blazor WASM project

Analysis Pipeline (runs in browser)

The entire pipeline is pure computation with no I/O:

var plan = ShowPlanParser.Parse(planXml);
PlanAnalyzer.Analyze(plan, config);
var result = ResultMapper.Map(plan, source);
var text = TextFormatter.Format(result);
var json = JsonSerializer.Serialize(result);

Hosting

  • GitHub Pages from a gh-pages branch or /docs folder
  • Blazor WASM publishes to static files
  • Initial download: ~5-8 MB compressed (cached after first visit)
  • No server, no API, no database

Visual Plan Rendering

SVG is the recommended starting point. The layout engine already computes x/y coordinates — just need to render nodes as SVG elements instead of Avalonia drawing calls.

Out of Scope (for now)

  • Live execution (connecting to SQL Server from browser)
  • Plan sharing/permalinks (would need a server component)
  • Plan comparison (could be added later)
  • Query Store integration (needs SQL Server connection)

Migrated from plan-b#5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions