Spaces:
Sleeping
Sleeping
Guardian Agent
Overview
Guardian Agent is a manipulation blocker for the modern web β a Chrome extension companion web app that detects and visualizes dark patterns used by e-commerce sites to extract money from shoppers.
Stack
- Monorepo tool: pnpm workspaces
- Node.js version: 24
- Package manager: pnpm
- TypeScript version: 5.9
- Frontend: React + Vite + Tailwind CSS (artifacts/guardian-agent)
- API framework: Express 5
- Database: PostgreSQL + Drizzle ORM
- AI: Anthropic Claude (claude-haiku-4-5) via Replit AI Integrations
- Validation: Zod (
zod/v4),drizzle-zod - API codegen: Orval (from OpenAPI spec)
- Build: esbuild (CJS bundle)
Key Commands
pnpm run typecheckβ full typecheck across all packagespnpm run buildβ typecheck + build all packagespnpm --filter @workspace/api-spec run codegenβ regenerate API hooks and Zod schemas from OpenAPI specpnpm --filter @workspace/db run pushβ push DB schema changes (dev only)pnpm --filter @workspace/api-server run devβ run API server locally
Pages & Features
Landing Page (/)
Full marketing page: hero, stats bar, interactive browser mock demo, "How It Works", dark patterns catalog, trust leaderboard, testimonials, dual CTA
Live Scanner (/demo) β Hackathon Demo Key Page
- 4 preset scenarios (Booking.com, United Airlines, Amazon, Etsy clean) β one click runs real Claude AI analysis
- Custom input mode β paste any checkout text
- Real-time animated results: all 6 dark pattern categories with evidence
- Auto-saves to DB and updates domain trust rating after each scan
Extension Preview (/extension)
- Interactive browser chrome mockup showing Guardian overlay UI
- 3 switchable demo states: Booking.com (5 patterns), Etsy (clean), United Airlines (upsell gauntlet)
- Shows every Guardian action: timer warnings, auto-unchecked add-ons, rewritten buttons
Fee Calculator (/fee-calculator)
- 4 quick presets (booking.com, spirit.com, airbnb.com, enterprise.com)
- Custom domain + merchant type + listed price β Claude estimates true total
- Shows itemized fee breakdown, savings opportunity, confidence level
Command Center (/dashboard)
- KPI cards with 30s auto-refresh
- Live detection feed with hidden fee amounts
- Pattern distribution pie chart
- Top offenders leaderboard
- Quick action shortcuts
Intelligence Pages
/trustβ Domain trust ratings with filtering/trust/:domainβ Per-domain detail with scan history/reportsβ Detection report feed/reports/:idβ Full report detail with all 6 pattern breakdowns/patternsβ Dark patterns encyclopedia/statsβ Analytics with bar charts and offenders table
API Endpoints
POST /api/analysis/detectβ Raw Claude dark pattern analysisPOST /api/analysis/classify-upsellβ Classify upsell pagesPOST /api/demo/scanβ All-in-one: detect + save report + update trust ratingPOST /api/demo/fee-estimateβ Claude estimates true price with fee breakdownGET /api/trustβ List trust ratingsPATCH /api/trust/:domainβ Upsert trust ratingGET /api/trust/:domainβ Domain detailGET /api/reportsβ List detection reportsPOST /api/reportsβ Create reportGET /api/reports/:idβ Report detailGET /api/stats/summaryβ Total statsGET /api/stats/pattern-breakdownβ Per-type countsGET /api/stats/top-offendersβ Worst domains
Features
Dark Patterns Detected
- False Urgency β Fake countdown timers and "deal expires soon" banners
- False Scarcity β Fabricated "only 1 left" and "42 people viewing" claims
- Confirm Shaming β Guilt-tripping decline button text
- Hidden Fees β Resort fees, service fees, and surcharges hidden until checkout
- Pre-Checked Add-Ons β Travel insurance, newsletters pre-selected by default
- Misdirection β Visually hidden decline options and exit paths
App Pages
/β Marketing landing page/dashboardβ Command center with live stats and recent detections/trustβ Domain trust ratings table/trust/:domainβ Domain-specific trust profile/reportsβ Detection reports feed with filtering/reports/:idβ Individual report detail view/patternsβ Dark patterns encyclopedia (educational)/statsβ Analytics with charts and top offenders
API Endpoints
POST /api/analysis/detectβ AI-powered dark pattern detection (Claude)POST /api/analysis/classify-upsellβ Upsell page type classification (Claude)GET/PUT /api/trust/:domainβ Domain trust ratingsGET/POST /api/reportsβ Detection reportsGET /api/stats/summaryβ Overall statisticsGET /api/stats/pattern-breakdownβ Pattern type countsGET /api/stats/top-offendersβ Most manipulative domains
DB Schema
trust_ratingsβ Per-domain trust scores and manipulation historydetection_reportsβ Individual dark pattern scan results
Architecture Notes
- AI integration uses Replit AI Integrations proxy for Anthropic β no API key needed
- No PII sent to AI: only anonymized page text for classification
- Frontend imports hooks from
@workspace/api-client-react(generated via Orval) - Backend imports Zod validators from
@workspace/api-zod(generated via Orval)