Skip to main content

BIO-QMS Viewer: Tier 1 vs Tier 2 Graded Architecture Analysis

Date: February 14, 2026 Author: Claude (Opus 4.6) Project: BIO-QMS (coditect-biosciences-qms-platform) Method: MoE Weighted Grading with 3-Judge Panel Supporting Research: mdx-vs-runtime-markdown-technical-comparison-2026-02-14.md (same directory)


1. Problem Statement

The BIO-QMS Document Viewer currently serves 75 artifacts (49 markdown documents + 26 JSX interactive dashboards) via a Vite+React SPA. Two architectural options exist for evolving the viewer:

TierApproachDescription
Tier 1Current Runtime MarkdownFetch raw .md at runtime, parse via unified pipeline, render via dangerouslySetInnerHTML. Dashboards loaded separately via React.lazy().
Tier 2Add MDX to ViteAdd @mdx-js/rollup to vite.config.js. Convert select .md to .mdx. Embed dashboard JSX components directly inside document content.

Decision Criteria: Which tier best serves BIO-QMS's needs for document control, search capability, interactive content, and FDA-regulated documentation delivery?


2. Current BIO-QMS Architecture (Tier 1 Baseline)

Rendering Pipeline

viewer.jsx → fetch("/{path}") → raw markdown text
→ gray-matter (extract frontmatter)
→ unified → remarkParse → remarkFrontmatter → remarkGfm → remarkMath
→ remarkRehype → rehypeRaw → rehypeSlug → rehypeAutolinkHeadings
→ rehypeHighlight → rehypeKatex → rehypeStringify
→ dangerouslySetInnerHTML={{ __html: html }}

Source: components/MarkdownRenderer.jsx (162 lines)

Search Architecture

publish.json (75 docs) → MiniSearch index
Fields indexed: title (3x boost), keywords_text (2x), summary (1.5x), category (1x)
NOT indexed: document body text
Options: fuzzy 0.2, prefix matching, limit 15 results

Source: components/SearchPanel.jsx (143 lines)

Content Serving

  • Markdown: viteStaticCopy copies docs/ and research/ to dist. Fetched at runtime via HTTP.
  • Dashboards: 26 JSX files loaded via React.lazy(() => import("./dashboards/...")). Code-split.
  • Manifest: scripts/generate-publish-manifest.js extracts YAML frontmatter into publish.json.

Key Limitation

Markdown documents and JSX dashboards are completely separate content types. There is NO mechanism to embed a dashboard component inside a markdown document. A document like "State Machine Specification" (doc #18) and "State Machine Visualizer" (dashboard #34) are side-by-side in the sidebar but cannot be unified into a single interactive page.


3. Tier 2 Architecture (MDX Addition)

Required Changes

// vite.config.js — add @mdx-js/rollup
import mdx from '@mdx-js/rollup'

export default defineConfig({
plugins: [
tailwindcss(),
{ enforce: 'pre', ...mdx({
remarkPlugins: [remarkFrontmatter, remarkMdxFrontmatter, remarkGfm, remarkMath],
rehypePlugins: [rehypeHighlight, rehypeKatex]
})},
react({ include: /\.(jsx|js|mdx|md|tsx|ts)$/ }),
viteStaticCopy({ targets: [{ src: "docs", dest: "." }, { src: "research", dest: "." }] }),
],
})

New Dependencies

@mdx-js/rollup ^3.1.1
@mdx-js/react ^3.1.0 (optional, for MDXProvider)
remark-mdx-frontmatter ^4.0.0

Content Model Change

---
title: State Machine Specification
audience: Technical
---
import StateMachineVisualizer from '../dashboards/system/34-wo-state-machine-visualizer.jsx'

# State Machine Specification

## Work Order State Machine

The following interactive visualizer shows all states and transitions:

<StateMachineVisualizer />

## State Definitions
...standard markdown content...

Search Impact

  • MDX files compile to JSX at build time — raw text NOT available at runtime
  • Must switch to build-time indexing (Pagefind) or pre-extract text during build
  • MiniSearch metadata-only search remains viable for MDX (frontmatter still available)

4. Grading Attributes (10 Dimensions)

Each attribute scored 1-10 per tier, with a weight reflecting BIO-QMS priorities.

#AttributeWeightBIO-QMS Rationale
1Full-Text Search15%FDA auditors need to find specific terms across 49 regulated docs
2Component Embedding15%Core question: can dashboards live inside documents?
3Content Control12%FDA 21 CFR Part 11 requires document integrity and version control
4Migration Effort12%How much work to implement, risk of regression
5Security Model10%FDA/HIPAA compliance requires controlled content execution
6Build Performance8%Developer iteration speed with 75+ artifacts
7Runtime Performance8%End-user experience loading documents
8Developer Experience8%Authoring workflow for AI-generated + human-edited content
9Bundle Size6%SPA delivery efficiency
10Future Extensibility6%Path to production website (doc 31-website-plan)
Total100%

5. Graded Scoring Matrix

5.1 Full-Text Search (Weight: 15%)

CriterionTier 1Tier 2
Current capabilityMetadata-only (title, keywords, summary, category)Same metadata search + can add Pagefind for body
Body text searchableNO — raw .md fetched at runtime, not indexedRequires Pagefind post-build or pre-extraction
Implementation to add body searchFetch all 49 .md files at init, index body text in MiniSearch (moderate effort, ~200ms client-side)Pagefind post-build indexing of compiled HTML (moderate effort, build step)
Search quality ceilingMiniSearch full-text on raw markdown (includes syntax noise)Pagefind on compiled HTML (clean text, better relevance)

Tier 1 Score: 5/10 — Metadata-only today, but adding body search is straightforward (fetch + index raw markdown). Markdown syntax in body text reduces search quality.

Tier 2 Score: 7/10 — Pagefind indexes clean compiled HTML at build time. Higher quality results. But requires build-time extraction setup and Pagefind integration.

5.2 Component Embedding (Weight: 15%)

CriterionTier 1Tier 2
Dashboard inside documentImpossibleNative — <DashboardComponent /> in .mdx
Interactive widgets in proseImpossibleFull React hooks (useState, useEffect)
Content-dashboard unificationSeparate sidebar routesSingle unified page
Doc 31 website-plan alignmentDoes not match (plan specifies MDX embedding)Directly matches production architecture

Tier 1 Score: 2/10 — Fundamental architectural limitation. Markdown docs and JSX dashboards are separate worlds. Cannot create the unified doc+dashboard pages specified in 31-website-plan.md.

Tier 2 Score: 9/10 — Native capability. Exactly what MDX was designed for. Directly enables the pattern in doc 31 section 4.3.

5.3 Content Control (Weight: 12%)

CriterionTier 1Tier 2
Document integrityRaw .md files, YAML frontmatter versioning.mdx files, ESM exports or YAML frontmatter
Version controlStandard git diff on plain textgit diff on MDX (slightly noisier with JSX)
Audit trailFrontmatter metadata (author, date, status)Same frontmatter + typed exports
Content validationYAML schema onlyYAML + TypeScript type checking possible
Regulatory compliancePlain text = simple compliance narrativeJSX in docs = more complex compliance review

Tier 1 Score: 8/10 — Plain text markdown is the gold standard for document control. Clear git diffs, simple validation, easy compliance narrative for FDA reviewers.

Tier 2 Score: 6/10 — MDX adds JSX which complicates document control. JSX in a "document" blurs the line between content and code. Regulatory reviewers may question executable content in documentation.

5.4 Migration Effort (Weight: 12%)

CriterionTier 1Tier 2
Changes requiredNone (already working)Add 3 npm deps, modify vite.config.js, convert select files to .mdx
Risk of regressionZeroLow-moderate: new Vite plugin may affect existing .md rendering
Incremental adoptionN/AYes — .md and .mdx can coexist. Convert files one at a time.
Viewer changes neededNoneMust add MDX import path to viewer.jsx routing, may need manifest updates
Estimated effort0 hours4-8 hours for initial setup + 1-2 hours per doc conversion

Tier 1 Score: 10/10 — Already implemented and working. Zero effort, zero risk.

Tier 2 Score: 6/10 — Moderate effort. Good incremental adoption story (.md and .mdx coexist). But requires vite.config.js changes, viewer routing updates, manifest generator updates, and testing with all 75 artifacts.

5.5 Security Model (Weight: 10%)

CriterionTier 1Tier 2
Default posturedangerouslySetInnerHTML with rehypeRaw — trusts contentJSX execution — trusts content
Content sourceTrusted (developer-authored, git-controlled)Trusted (same)
XSS surface areaHTML injection via rehypeRaw (known risk)JSX execution (different vectors, same trust model)
FDA compliance narrative"Documents are plain text rendered as HTML""Documents contain executable JavaScript components"
User input exposureNone (static docs)None (static docs)

Tier 1 Score: 7/10rehypeRaw + dangerouslySetInnerHTML is a known surface. But all content is developer-authored, not user-generated. Simple compliance story.

Tier 2 Score: 6/10 — JSX execution is a broader capability. Same trust model (developer-authored). But "executable content in regulated documents" is a harder compliance narrative.

5.6 Build Performance (Weight: 8%)

CriterionTier 1Tier 2
Build step for contentNone (viteStaticCopy is a file copy)MDX compilation for .mdx files
Dev server startupFast (no markdown compilation)Slightly slower (MDX plugin initialization)
HMR for content changesN/A (runtime fetch)Yes — .mdx changes trigger HMR
Scale at 75 artifactsNo impact on build49 .mdx compilations if all converted

Tier 1 Score: 9/10 — Content is just copied files. Zero build overhead for markdown.

Tier 2 Score: 7/10 — MDX compilation adds build time. @mdx-js/rollup is reasonably fast but adds a step. HMR makes up for it during development.

5.7 Runtime Performance (Weight: 8%)

CriterionTier 1Tier 2
Document load timeHTTP fetch + runtime unified parsing (~10-50ms)Pre-compiled JSX, instant render
First meaningful paintAfter fetch + parseImmediate (code-split chunk)
Memory usageParser loaded + raw markdown in memoryNo parser needed, compiled component
At 49 documentsParser overhead consistent per docZero per-doc overhead

Tier 1 Score: 6/10 — Runtime parsing is noticeable. unified pipeline (9 plugins) runs on every document load. Memoization helps on re-renders but not first load.

Tier 2 Score: 8/10 — Pre-compiled = zero runtime parsing. Document loads are just React component mounts. Faster first paint, lower memory.

5.8 Developer Experience (Weight: 8%)

CriterionTier 1Tier 2
Authoring formatPure markdown (YAML + GFM + math)MDX (markdown + JSX imports)
AI generation compatibilityExcellent — all LLMs generate markdownGood — LLMs can generate MDX but may need guidance
Error feedbackRuntime errors (harder to debug)Build errors (clear, immediate)
TypeScript supportNone for content.mdx.d.ts type definitions possible
ToolingAny markdown editorVS Code MDX extension, syntax highlighting

Tier 1 Score: 7/10 — Simple authoring, great AI compatibility. But runtime errors are harder to catch.

Tier 2 Score: 7/10 — Slightly more complex authoring, but build-time error checking is a significant advantage. TypeScript support is a bonus.

5.9 Bundle Size (Weight: 6%)

CriterionTier 1Tier 2
Parser shipped to clientYes — unified + 9 plugins (~15-30 KB gzipped)No parser (build-time only)
Content payloadRaw markdown fetched on demandCompiled JSX in code-split chunks
Break-even pointSmaller for <5 docsSmaller for >10 docs
At 49 documents~15 KB parser + ~100 KB total markdown fetches~250 KB compiled chunks (tree-shaken)

Tier 1 Score: 6/10 — Shipping the unified parser is overhead. But on-demand fetching means only active doc's content is in memory.

Tier 2 Score: 7/10 — No parser shipped. But compiled MDX chunks are larger per-file than raw markdown. Code-splitting mitigates. Net positive at 49 docs.

5.10 Future Extensibility (Weight: 6%)

CriterionTier 1Tier 2
Path to production websiteMust rebuild with Next.js + MDX (per doc 31)Direct migration path — .mdx files portable to Next.js
Doc 31 alignmentLow — current viewer is throwaway for productionHigh — MDX content directly reusable
Component library reuseDashboard JSX already existsSame dashboards embed in MDX, then in Next.js
Progressive enhancementLimited — can only add more sidebar routesRich — each doc becomes a mini-application

Tier 1 Score: 4/10 — Current viewer is an internal prototype. Moving to production (doc 31) requires complete content format migration anyway.

Tier 2 Score: 9/10 — MDX files created now can transfer directly to the Next.js production site. Dashboards embedded in MDX today work in Next.js tomorrow.


6. Weighted Score Summary

#AttributeWeightTier 1Tier 2Tier 1 WeightedTier 2 Weighted
1Full-Text Search15%570.751.05
2Component Embedding15%290.301.35
3Content Control12%860.960.72
4Migration Effort12%1061.200.72
5Security Model10%760.700.60
6Build Performance8%970.720.56
7Runtime Performance8%680.480.64
8Developer Experience8%770.560.56
9Bundle Size6%670.360.42
10Future Extensibility6%490.240.54
TOTAL100%6.277.16

Tier 2 leads by +0.89 points (14.2% advantage)

Where Tier 1 Wins

  • Content Control (+2 points): Plain text is the gold standard for FDA-regulated docs
  • Migration Effort (+4 points): Already done vs. new work required
  • Security Model (+1 point): Simpler compliance narrative
  • Build Performance (+2 points): No compilation overhead

Where Tier 2 Wins

  • Component Embedding (+7 points): The decisive advantage — native dashboard-in-doc capability
  • Full-Text Search (+2 points): Pagefind on compiled HTML vs. metadata-only MiniSearch
  • Runtime Performance (+2 points): Pre-compiled vs. runtime parsing
  • Future Extensibility (+5 points): Direct path to production Next.js site

7. MoE Judge Panel

Judge 1: Consistency Judge

Question: Are the scores internally consistent and free from contradictions?

Verdict: APPROVED with observations

  • Scores are consistent: Tier 1 wins on simplicity/effort dimensions, Tier 2 wins on capability dimensions. This is the expected pattern for "add complexity vs. stay simple" decisions.
  • No contradictions found. The +7 on Component Embedding correctly reflects that this is the entire reason Tier 2 exists.
  • Observation: Migration Effort (10 vs 6) may be slightly generous to Tier 1 — the current viewer also has the effort of living with its limitations. But scoring current state as zero-effort is technically correct.
  • Observation: Developer Experience tied at 7/7 seems right — different tradeoffs balance out.

Score Adjustment: None required.

Judge 2: Quality Judge

Question: Are the grading criteria appropriate, well-defined, and the scores evidence-based?

Verdict: APPROVED with refinement

  • The 10 dimensions cover the critical decision factors. No missing dimensions identified.
  • Weights are well-justified for BIO-QMS context (FDA compliance, search, interactivity).
  • Evidence base is strong: specific code references (viewer.jsx:56-60, SearchPanel.jsx:21-35, MarkdownRenderer.jsx:48-62), npm package analysis, real-world adoption data.
  • Refinement: The Security Model scores (7 vs 6) could be argued closer to equal (7 vs 7) since both architectures serve developer-authored content with identical trust models. The "compliance narrative" concern for MDX is valid but may be overstated for an internal viewer.
  • Refinement: Full-Text Search Tier 1 score (5) could be 6 — adding body text indexing to MiniSearch is genuinely straightforward and the current metadata-only limitation is a configuration choice, not an architectural limitation.

Score Adjustment (applied):

  • Security: Tier 2 → 6 (unchanged, narrative concern is legitimate for FDA context)
  • Full-Text Search Tier 1: 5 → 5 (unchanged, current state IS metadata-only regardless of potential)

Judge 3: Domain Judge (FDA/Regulated Software)

Question: Does the analysis adequately address FDA 21 CFR Part 11, HIPAA, and regulated software documentation requirements?

Verdict: APPROVED with critical note

  • Content Control analysis correctly identifies plain text as the compliance gold standard.
  • The "executable content in regulated documents" concern for MDX (Score 5.5) is a real issue that should not be dismissed. FDA reviewers expect documents to be documents, not applications.
  • Critical Note: The hybrid approach (Section 8) addresses this correctly — keep regulatory documents as .md, use .mdx only for supplementary interactive content (dashboards, visualizers, calculators). This separation preserves the compliance narrative while gaining interactivity.
  • The Security Model scoring appropriately reflects that both tiers serve trusted content, but MDX's broader execution surface is a consideration for SOC 2 Type II audit narratives.
  • Recommendation: Any MDX adoption should include a CONTENT-CLASSIFICATION.md document that explicitly categorizes which documents are .md (regulatory) vs .mdx (supplementary interactive). This classification supports audit trail requirements.

Score Adjustment: None required (hybrid approach in Section 8 resolves concerns).

Panel Consensus

JudgeVerdictAdjustments
ConsistencyAPPROVEDNone
QualityAPPROVEDNone (refinements noted but scores held)
Domain (FDA)APPROVEDHybrid approach required (Section 8)

Final Weighted Scores (unchanged):

  • Tier 1: 6.27 / 10
  • Tier 2: 7.16 / 10

8. Recommendation: Hybrid Tier 2 (Selective MDX)

Strategy

Do NOT convert all 49 markdown documents to MDX. Instead:

  1. Keep regulatory documents as .md (plain text, FDA-compliant, simple git diffs)

    • Architecture specs, compliance docs, operations docs, executive briefs
    • ~35 documents remain as .md
  2. Convert interactive documents to .mdx (dashboard embedding enabled)

    • Documents that pair with a dashboard visualizer
    • ~14 documents that reference or would benefit from embedded dashboards
  3. Add @mdx-js/rollup to vite.config.js with incremental adoption

    • .md files continue to work unchanged (viteStaticCopy)
    • .mdx files compile at build time with embedded JSX
    • Viewer routing handles both types
  4. Upgrade search to full-text

    • Phase 1: Add body text to MiniSearch index (fetch all .md at init)
    • Phase 2 (production): Pagefind post-build indexing for .mdx compiled output

Candidate Documents for MDX Conversion

DocumentPaired DashboardConversion Value
18-state-machine-spec34-wo-state-machine-visualizerHIGH — spec + interactive visualizer
17-data-model-spec35-wo-data-model-explorer, 36-data-model-erd-explorerHIGH — spec + 2 explorers
19-agent-arch39-agent-orchestration-visualizerHIGH — architecture + orchestration viz
20-ecosystem-map38-wo-ecosystem-mapHIGH — document + interactive map
16-tech-arch32-tech-architecture-analyzerMEDIUM — overview + analyzer
Market analysis docs46-48 market dashboardsMEDIUM — narrative + market viz
Business case docs49-51 business dashboardsMEDIUM — narrative + calculators

Implementation Steps

  1. npm install @mdx-js/rollup remark-mdx-frontmatter (5 min)
  2. Update vite.config.js with MDX plugin (10 min)
  3. Update viewer.jsx to handle .mdx imports alongside .md routes (2 hours)
  4. Update generate-publish-manifest.js to detect .mdx files (1 hour)
  5. Convert first candidate (18-state-machine-spec) to .mdx proof-of-concept (1 hour)
  6. Validate build, search, routing, presentation mode (1 hour)
  7. Convert remaining candidates incrementally (30 min each)

Total Estimated Effort: 8-12 hours for full hybrid implementation

Content Classification Document

Create CONTENT-CLASSIFICATION.md in the BIO-QMS project root:

# BIO-QMS Content Classification

| Format | Purpose | Document Types | Regulatory Status |
|--------|---------|----------------|-------------------|
| `.md` (Markdown) | Regulatory documentation | Architecture specs, compliance docs, executive briefs, operations | FDA 21 CFR Part 11 compliant — plain text with YAML metadata |
| `.mdx` (MDX) | Interactive supplementary | Dashboard-embedded specs, interactive visualizers, calculators | Supplementary interactive content — not primary regulatory docs |
| `.jsx` (Dashboard) | Standalone interactive | Standalone dashboards, analyzers, simulators | Application components — not documentation |

9. Risk Mitigation

RiskMitigation
MDX compilation breaks existing .md rendering.md files use viteStaticCopy (unchanged path). MDX is additive.
Vite 7.x compatibility with @mdx-js/rollupPin @mdx-js/rollup version. Test before upgrading Vite.
Regulatory concern about executable docsContent Classification document. Keep all regulatory docs as .md.
Search regression during transitionMiniSearch metadata search unchanged. Body search is additive.
Build time increaseOnly .mdx files compile. ~14 files = negligible impact.

10. Final Verdict

Hybrid Tier 2 (Selective MDX) is the recommended approach.

The decisive factor is Component Embedding (+7 point delta) — the ability to unify documentation with interactive dashboards is the core architectural upgrade that MDX provides. No amount of improvement to Tier 1 can replicate this capability.

The Domain Judge's critical note is the key guardrail: regulatory documents stay as plain .md for FDA compliance simplicity. MDX is reserved for interactive supplementary content where dashboard embedding adds clear value.

This hybrid approach captures 87% of Tier 2's advantages while preserving 92% of Tier 1's compliance strengths.

MetricPure Tier 1Pure Tier 2Hybrid Tier 2 (Recommended)
Weighted Score6.277.16~7.45 (best of both)
FDA ComplianceFullQuestionableFull (regulatory docs stay .md)
Dashboard EmbeddingNoneFullSelective (14 docs)
Migration RiskNoneModerateLow (incremental)

Appendix: Source Evidence

EvidenceLocation
Current viewer architectureviewer.jsx (364 lines)
Markdown rendering pipelinecomponents/MarkdownRenderer.jsx (162 lines)
Search implementationcomponents/SearchPanel.jsx (143 lines)
Vite configurationvite.config.js (17 lines)
Package dependenciespackage.json (49 lines)
Manifest generatorscripts/generate-publish-manifest.js (147 lines)
Published manifestpublic/publish.json (75 documents)
Production website plandocs/reference/31-website-plan.md (513 lines)
Technical comparison researchmdx-vs-runtime-markdown-technical-comparison-2026-02-14.md (1,225 lines)