RSSAmplifier

Blog

Pedro Alonso RSS

Product engineer building payments and billing, search and RAG on Postgres, AI assistants, and real-time systems. Builder of modl and Reframe. Writing production-grade guides on Stripe, PostgreSQL, and Next.js.

pedroalonso.netRSS feed ↗76 posts

Latest posts

Running MiniMax H3 Locally on One RTX 4090: A Storybook Becomes a Film

I ran the open-weights MiniMax H3 (Hailuo 3.0) video+audio model on a single 24 GB RTX 4090 and turned six storybook illustrations into a 31-second film with sound. Measured findings: why prompt structure beats resolution 14x, how first/last-frame mode invents narrative in between, and the ComfyUI node bug that fakes a 6x speedup.

One Day of LLM Agent Observability: Five Production Bugs, Three JSONL Files

I gave my kids' book agent proper logging in a morning — three plain files — and spent the afternoon fixing what the logs immediately caught: 73% of GPU time wasted, books in the wrong language, and two ways the model broke its own tool calls. Real numbers, same-day payback.

Logging Email to a CRM: What AI Actually Changed (and What It Didn't)

I built a BCC-to-CRM email intake pipeline and ran it entirely on a single RTX 4090: deterministic threading, dedup, and quote-stripping, with a local Qwen3.6-27B doing exactly one job — turning a cleaned thread into a schema-valid activity entry. 40 out of 40 real threads produced valid structs. Here's the architecture, the measured numbers, and the three gotchas.

Style Prompts Without the Artist's Name: Three Ways It Breaks, and the Fixes

Naming a living illustrator in a prompt is the lazy way to get a style — and it makes the model forge their signature. I spent 126 images on Krea 2 Raw trying to describe a style without naming anyone. It failed three distinct, reproducible ways, each with a specific fix. Here's the failure map, the seed replication, and the prompt that finally worked.

I trained a 3B model to rival Claude Opus at text-to-SQL on one GPU. Here is exactly where that holds, and where it breaks

I RL-tuned a 3B model on a single GPU to tie Claude Opus 4.8 on text-to-SQL, then went query by query to show why an equal score doesn't mean an equal model.

Do You Need a Glean? I Self-Hosted Onyx and Rebuilt It on Postgres — Same Corpus, Same Local LLM

The enterprise-knowledge-search question is really build-vs-buy: pay for Glean, self-host the open-source Onyx, or build RAG on the Postgres you already run. Instead of a feature table, I stood up the full Onyx platform AND wrote the entire Postgres alternative in ~80 lines, pointed both at the same local Qwen 27B over the same company knowledge base, and asked the same questions. Both gave…

Durable LLM Agent Workflows on SQLite — and the Exact Line Where You Graduate to Temporal

Multi-step LLM agents fail halfway, wait on slow tools, and pause for human approval — so they need durable execution. The reflex is to reach for Temporal or Inngest on day one. I built crash-safe, resumable, human-pausable LLM workflows in ~200 lines on plain SQLite, then measured exactly where it runs out: a hard crash mid-run replays the finished steps and saves half the tokens, and the durable…

Case Study: Reframe — Building an AI Shopify App Solo, From First Commit to Paying Merchants

How I built and run Reframe, an AI product-photo app for Shopify merchants: the architecture decisions that let one person operate a GPU pipeline in production, how session recordings drove churn down, and what it took to make an AI system merchants trust. Outcomes, decisions, and trade-offs — not a tutorial.

Don't Make an LLM Find Your At-Risk Customers. Make It Explain Them.

The tempting move is to hand an LLM your customer data and ask which accounts are about to churn. That's the expensive, unreliable way to do the one thing classic ML is great at. I built the whole pipeline on a real 1M-row e-commerce dataset: a one-line SQL rule already catches 75% of churners in the top-flagged 20%, gradient boosting nudges it up — and the LLM's only job is to explain and route…

Your Customer List Is Full of Duplicates. Here's How to Find Them in Postgres.

Every CRM quietly fills up with the same person entered three different ways — and you pay for it in wasted marketing, wrong reports, and split histories. I measured three ways to find the duplicates on 5,000 labeled records: plain exact match, Postgres fuzzy matching, and AI embeddings. The boring one won — exact numbers, where each method wins, and why you don't need a data-quality platform.

Which Patients Will Ghost? Predicting Dental No-Shows Without the AI Hype

Empty chairs are pure lost revenue, and 'just text everyone a reminder' is the advice every practice gets. I ran 110,000 real appointments through plain, old-fashioned machine learning — no LLM in sight — and found the reminder advice is half a trap. Here's who actually no-shows, why the obvious reading of the data is wrong, and the dollar value of calling the right 20% instead of everyone.

How Much of Your LLM Bill Is the Same Question Twice? I Measured It.

A semantic cache on pgvector deletes the LLM calls you're paying for twice — but only if you tune it. I replayed 6,000 real questions through a warming Postgres cache and measured the hit rate, the dollars, and the part nobody benchmarks: how often a 'close enough' match serves a confidently wrong answer.

When Does a Knowledge Graph Beat Vector Search — and When Do You Actually Need Neo4j?

Everyone answers questions over their data with vector search. But some questions aren't 'what's similar' — they're 'what's connected,' and vectors fall off a cliff. I measured vector search, graph traversal, and a hybrid of the two on 1,800 multi-hop movie questions, then settled the Postgres-vs-Neo4j question with real numbers: Postgres wins neighborhood reachability by ~4x, Neo4j wins…

I Built a Recommendation Engine in Pure Postgres. The Embeddings Lost to ORDER BY count(*).

Everyone reaches for an AI vector database to build 'people also bought.' I did too — then measured it on real Amazon data and watched the fancy approach lose to a few lines of SQL that just count what customers actually buy together. Here's the honest, plain-English comparison: what wins, what doesn't, and why you probably don't need the extra infrastructure — all in one database.

Evaluating and Monitoring LLM Workflows in Production: What to Use and How

A practical guide to proving your LLM feature actually works — tracing, offline evals, and online monitoring — with an honest tour of the mid-2026 tooling landscape: Langfuse, Opik, Phoenix, DeepEval, Ragas, promptfoo, and where Trigger.dev fits.

Geospatial RAG on Postgres: One Query for "Where" and "What Kind"

Site selection is two search problems wearing a trenchcoat — where (spatial) and what-kind (semantic). You don't need a vector database next to PostGIS. Here's how to fuse PostGIS proximity and pgvector similarity in a single Postgres query, feed it to an LLM agent, and put it on a map — built and measured on real grid data.

Every Supplier Invoice in Your Accounting System, Same Day

What it actually looks like to stop typing invoices into your accounting system: what week one looks like, what it costs, what still needs a human, and what breaks. Written for the business owner, not the developer.

Invoice Extraction Is Solved. The Pipeline Around It Isn't.

I ran three real invoices — a 1906 hardware bill, the handwritten Fabergé invoice for two Imperial Easter eggs, and a photographed Persian receipt — through a frontier vision model. The extraction took one API call. This post is about everything that one API call doesn't do: validation, schema design, vendor normalization, and the failure modes that actually bite in production.

Automating E-Commerce Photography with AI

Why generative image editing failed for product photos, and the multi-model architecture that actually works — covering GPU deployment, cold starts, and the Build vs. Buy tradeoff.

Building a Support Copilot with RAG on Postgres (No Vector Database)

A practical, architecture-level guide to building a customer-support copilot with retrieval-augmented generation on Postgres alone — pgvector, BM25, and row-level security — and why big context windows changed RAG's job rather than killing it.

Speculative Decoding on a Single RTX 4090: MTP Nearly Tripled Qwen3.6-27B

I benchmarked MTP speculative decoding for Qwen3.6-27B in llama.cpp on one 24GB RTX 4090 — it nearly tripled generation speed, and helped even on cold generation. Here's the result, why MTP isn't in mainline llama.cpp yet, and an honest note on what 'fast' does and doesn't buy you.

My Remote AI Dev Workflow: Claude Code + tmux + 4090 Server From Anywhere

How I use Claude Code on a headless RTX 4090 server with tmux, git worktrees, and Tailscale to ship code from my laptop, iPad, or phone. Fire a prompt, close the lid, reconnect later. The actual workflow I use daily.

BM25 Search in PostgreSQL: The Missing Piece for Hybrid Search

Bring production-grade BM25 ranking into PostgreSQL with pg_textsearch. Combine keyword precision with semantic understanding for hybrid search—no Elasticsearch required.

LangChain Evolution Part 4: The 12-Factor Agent Methodology

Moving beyond implementation to engineering discipline. Learn the 12-Factor Agent methodology that transforms stochastic scripts into reliable, production-grade AI systems by treating LLMs as components within strict architectural patterns.

Building My AI Home Lab: From Laptop to Dedicated Server

How I built a dedicated RTX 4090 AI server running Pop!_OS, and how it has evolved since: Tailscale, Docker Compose profiles, local LLMs with Ollama and llama.cpp, image generation, self-hosted Immich, and driving coding agents from my phone over mosh and tmux.

Multi-Tenant Search in PostgreSQL with Row-Level Security

Build a secure, scalable multi-tenant SaaS architecture with PostgreSQL's Row-Level Security (RLS), Prisma, and Next.js. Isolate customer data and implement tenant-aware search that just works.

PostgreSQL LISTEN/NOTIFY: Real-Time Without the Message Broker

Build real-time search and live updates in your Next.js app using PostgreSQL's native LISTEN/NOTIFY, Prisma, and WebSockets. No complex message brokers needed.

Next.js Server Actions: The Complete Guide

Ditch API routes and build forms, mutations, and async operations with zero API endpoints using Next.js Server Actions - the modern way to handle server-side logic

I Let GitHub Copilot Remotely Debug My Live Ubuntu Server

A real-world case study on using GitHub Copilot to diagnose and solve a persistent logging issue on my live Dokku server. A look into the future of AI-driven DevOps.

LangChain Evolution Part 3: Production-Ready Agentic Systems

With a dynamic graph in place, we now focus on making our agent robust, scalable, and ready for production. This post covers persistence, multi-agent collaboration, and advanced error handling.

LangChain Evolution Part 2: From Hardcoded Workflows to Dynamic Graphs

In Part 1, we replaced a monolithic prompt with a stateful agent. Now, we're taking the next step: evolving our agent's hardcoded logic into a flexible, scalable, and truly autonomous graph with LangGraph.

LangChain Evolution Part 1: From Monolithic Prompts to Intelligent Agents

Learn how to migrate from a fragile, monolithic prompt to a maintainable, intelligent agent architecture using specialized tools, state management, and human-in-the-loop patterns with LangChain.

Building Your AI-Powered Sales Engine Part 2: From Lead Generation to Client Acquisition

Technical deep dive into automating client acquisition with AI agents - complete code for lead generation, cold email personalization, and scaling your automation business

AI Automation Business for Developers - Part 1

How developers can dominate the automation market by building AI agents they'd actually use - and turning them into profitable services

Real-Time Notifications with Server-Sent Events (SSE) in Next.js

Learn how to implement real-time server-to-client updates using Server-Sent Events in Next.js - a simpler alternative to WebSockets for one-way data streaming

Stripe Payment Links and Customer Portal in Next.js 15

Learn how to implement Stripe Payment Links and Customer Portal in Next.js 15 for the easiest payment integration with self-service customer management

Stripe + Next.js 15: The Complete 2025 Guide

Build production-ready payment systems with Stripe and Next.js 15 using Server Actions - from one-time payments to subscriptions and credit systems

Redis Queues and Pub/Sub in Next.js - A Practical Guide

Learn how to use Redis lists, queues, and pub/sub patterns in Next.js for real-time features and background processing

WebSockets with Next.js Part 4: Going Native - Ditching Socket.IO

Learn how to implement WebSockets with Next.js using native WebSocket APIs instead of Socket.IO - better performance, zero dependencies, and full control

Implementing Pre-paid Usage Billing with Next.js and Stripe

Learn about Implementing Pre-paid Usage Billing with Next.js and Stripe

Dokku Migrations: Introducing the Open Source Dokku Migration Tool

Learn about Dokku Migrations: Introducing the Open Source Dokku Migration Tool

Building Practical AI Agents: From Tools to Workflows

Learn about Building Practical AI Agents: From Tools to Workflows

Extending LLM Capabilities with Custom Tools: Beyond the Knowledge Cutoff

Learn about Extending LLM Capabilities with Custom Tools: Beyond the Knowledge Cutoff

Building a Self-Healing LLM JSON Processor with Zod and Ollama (Deepseek 8b)

Learn about Building a Self-Healing LLM JSON Processor with Zod and Ollama (Deepseek 8b)

Background Processing in Next.js Part 1

Learn about Background Processing in Next.js Part 1

Advanced Background Processing in Next.js Part 2

Learn about Advanced Background Processing in Next.js Part 2

RAG Systems Deep Dive Part 3: Advanced Features and Performance Optimization

Learn about RAG Systems Deep Dive Part 3: Advanced Features and Performance Optimization

RAG Systems Deep Dive Part 2: Practical Implementation with LangChain

Learn about RAG Systems Deep Dive Part 2: Practical Implementation with LangChain

Next.js APIs with tRPC: A Developer's Guide to End-to-End Type Safety

Learn about Next.js APIs with tRPC: A Developer's Guide to End-to-End Type Safety

RAG Systems Deep Dive Part 1: Core Concepts and Architecture

Learn about RAG Systems Deep Dive Part 1: Core Concepts and Architecture