Brian Mena
All cases

Perito Psicólogo Madrid

Perito Psicólogo Madrid

Online authority on autopilot for specialized professionals

The problem

Forensic psychology practices compete in a legal-medical niche where buyers (lawyers and individuals in legal proceedings) search with high commercial intent. Generic agency websites fail to rank for high-value keywords.

What I did

Hub & Spoke architecture with 3 thematic hubs and 15+ spoke pages that transfer authority to commercial service pages. Autonomous pipeline with 10 daily cron jobs that selects keywords, enriches with news signals, generates articles with Claude, and distributes across 4 social networks.

The result

From zero to 35+ indexed pages and a pipeline generating 18 daily content pieces without intervention. The Hub & Spoke model ensures every new article reinforces its corresponding hub authority, creating a compound effect where content published today improves the entire site ranking tomorrow. With 730 potential articles per year versus 2-4 published manually, the competitive advantage in the niche is exponential.

The same, for your business

  • A clinic that shows up first when people search «dentist near me».
  • A garage that gets calls from Maps.
  • A law firm that comes up when someone asks an AI assistant.
Technical details

Architecture

  • Hub & Spoke SEO: 3 thematic hubs with 15+ spokes transferring authority to commercial pages
  • Autonomous 5-stage pipeline: topic selection, news enrichment, Claude generation, Sanity publishing, social distribution
  • Anthropic prompt caching to reduce costs on recurring Claude API calls
  • Supabase Vault for secure secret management in cron jobs, avoiding the current_setting() antipattern
  • Vercel Fluid Compute: 300s timeout on Hobby plan for long-form article generation

Technical decisions

  • Sanity CMS over WordPress: schema as TypeScript code, programmatic API for AI pipeline, Studio embedded at /studio
  • pg_cron over GitHub Actions: schedule lives alongside data, no queue delays or deactivation risk from inactivity
  • Claude Haiku over Sonnet: indistinguishable quality for Spanish SEO articles, with prompt caching for further optimization
  • Hub & Spoke over flat structure: controlled authority transfer from educational content to commercial pages
  • HSTS with preload: irreversible decision made after confirming client DNS HTTPS-only configuration

How it was built

Built in 5 phases: from the TypeScript strict foundation with trauma-informed design (no red colors, no urgency CTAs), through the Hub & Spoke content architecture justifying every internal link, to a fully autonomous AI pipeline. The most frustrating bug was discovering that pg_cron with current_setting() fails silently on Supabase managed Postgres, solved by migrating to Vault secrets. Choosing Claude Haiku over Sonnet proved that for Spanish SEO articles with a detailed prompt, the lighter model produces indistinguishable results at a fraction of the cost.

Tech stack

  • Next.js 16
  • Sanity CMS
  • Supabase
  • Claude Haiku 4.5
  • Tailwind CSS
  • Vercel
  • Late API

Features

  • SEO authority that builds itself - daily articles optimized for your niche keywords
  • Presence on 4 social networks effortlessly - posts adapted to each platform automatically
  • Visual panel for your team - publish and edit content without code from Sanity Studio
  • Interactive tools that convert - fee calculator and needs assessment quiz
  • Professional-grade security - HSTS, strict CSP, and Vault authentication for the pipeline
Subscribe to Brian's NotesGet weekly engineering and business lessons