Inspiration

Every day, students, families, and everyday consumers lose billions of dollars to deceptive UI design ("dark patterns")—sneaky pre-checked add-ons, junk fees revealed only on the final payment step (Drip Pricing), guilt-tripping opt-out copy (Confirmshaming), and cancellation mazes that take one click to join but require a phone call to leave (Roach Motels).

While regulators like the FTC (ROSCA) and the European Union (Digital Services Act Article 25) explicitly prohibit manipulative interfaces, regular users have no real-time way to audit a checkout screen before clicking "Subscribe" or to fight back once trapped. We built DarkPattern X-Ray to give every consumer an instant, visual UX forensics auditor in their browser.

What it does

DarkPattern X-Ray turns any checkout, pricing table, cookie banner, or cancellation flow screenshot into an interactive consumer protection report:

  1. Pixel-Accurate Visual Grounding: Drop a screenshot, paste directly from your clipboard (Ctrl + V), or test built-in real-world trap scenarios. Multimodal Vision pins color-coded bounding boxes directly onto every manipulative UI widget.
  2. True Financial Cost Breakdown: Separates headline advertised pricing from hidden platform fees, pre-checked add-ons, and forced auto-renewals—calculating the exact hidden dollar trap.
  3. Cognitive Bias & Regulatory Mapping: Explains the psychological trigger behind each trap (Default Bias, Loss Aversion, Urgency Panic) alongside the specific statute violated (FTC Section 5, ROSCA, EU DSA Art. 25, CCPA §1798.140).
  4. 1-Click Consumer Defense Drawer: Automatically drafts an editable, statute-citing Cancellation & Refund Demand Notice ready to copy, launch in your email client, or export as a structured JSON audit log.

How we built it

  • Frontend Architecture (Next.js 16 + React 19 + Tailwind CSS v4): Built a split-pane forensics workspace featuring a locked stationary X-Ray canvas on the left and an independently scrollable evidence feed on the right with bidirectional card-to-box highlighting.
  • Offscreen HTML5 Canvas Rasterizer: Normalizes high-resolution retina screenshots and vector mockups into size-optimized PNG payloads client-side before transmission.
  • Constrained Multimodal Vision Pipeline (@google/genai): Server-side Next.js Route Handler validated with Zod sends the image to Gemini Vision with a strict responseSchema and automatic multi-model fallback for high reliability.
  • Resolution-Independent Spatial Grounding: Gemini returns normalized bounding box coordinates $[y_{\min}, x_{\min}, y_{\max}, x_{\max}] \in [0, 1000]$, which our overlay engine maps onto responsive percentages across any screen size:

$$\text{top} = \frac{y_{\min}}{10}\%, \quad \text{left} = \frac{x_{\min}}{10}\%, \quad \text{width} = \frac{x_{\max} - x_{\min}}{10}\%, \quad \text{height} = \frac{y_{\max} - y_{\min}}{10}\%$$

Challenges we ran into

  • Preventing Scroll Drift on Visual Inspection: Initially, clicking a bounding box scrolled the entire viewport, pushing the X-Ray image out of view. We re-architected the workspace with a sticky left visual stage, an isolated scroll container on the right, and a slide-over drawer for the legal notice generator.
  • Zero-Drift Bounding Box Alignment: Standard CSS object-contain introduces letterboxing offsets that shift percentage overlays. Rendering the rasterized canvas at exact w-full h-auto aspect ratio guaranteed 1:1 coordinate fidelity.

Accomplishments that we're proud of

  • Turning complex legal regulations and behavioral psychology into an intuitive, 3-second visual X-Ray that anyone can use without technical setup.
  • Building a resilient, schema-enforced AI pipeline that never hallucinates broken JSON or out-of-bounds coordinates.

What's next

  • Chrome / Edge Browser Extension: Live DOM + visual overlay scanning directly inside active shopping carts before checkout.
  • Community Dark Pattern Ledger: Aggregating anonymized domain manipulation scores to warn shoppers before they even visit predatory websites.

Built With

Share this project:

Updates

Submission history