(Insights)Field notes · 28 publishedWritten for the buyer and the engineer in the same room
28notes · by Krešimir Galić
Decision-stage notes on migrations, costs, stack choices and what we actually ship in production. Real numbers, real trade-offs — no vendor pitch.
LatestPostgres Patterns29 Oct 2026 · 9 min

The archive
All field notes
28 notes
29 Oct 2026Nightly Dumps Are Not a Backup: The Postgres PITR + Restore Drill We Run on Every Payload DeployA pg_dump cron to S3 is a backup the way a sealed fire extinguisher is a fire plan. Here is the WAL archiving + PITR shape we ship on Payload + Next.js deploys, the two Payload-specific traps, and the monthly restore drill with real RPO/RTO numbers.Postgres Patterns9 min13 Oct 2026Supabase Connection Pooling for Payload + Next.js: Supavisor, Transaction Mode, and the Two-Port Rule We ShipSupabase no longer pools with PgBouncer — it ships Supavisor — but the failure modes on Vercel deploys are identical: exhausted connections, 'prepared statement already exists', and Payload migrations that hang in CI. Here is the wiring we ship.Postgres Patterns6 min06 Oct 2026Payload CMS Pricing: What a Production Content Platform Actually Costs in Year OnePayload's license is free. The platform around it is not. Here is the year-one budget we put in front of founders before they sign: build scope, hosting at three traffic tiers, the line items teams forget, and the cases where we talk a prospect out of Payload entirely.Cost Breakdown8 min17 Sept 2026Postgres jsonb vs Relations in Payload: The Schema Decision We Make Before the First MigrationPayload lets you embed anything as jsonb or relate anything as a foreign key — and gives you almost no guidance on where the line is. Here is the decision framework we run before the first migration, plus the index layer that keeps it true at 1M rows.Postgres Patterns7 min16 Jul 2026The Payload Moderation Layer: Wiring Claude Between Draft and Publish for UGC-Heavy PlatformsCommunity platforms drown editors in queues or ship unmoderated garbage. Here is the three-lane Payload moderation pattern we ship — auto-approve, auto-reject, human-review — with Claude as the triage layer between draft and publish.AI Automation7 min13 Jul 2026Claude API Cost on Payload CMS: The Four Levers We Pull Before the Bill Hits €500/MonthMost AI features on Payload do not fail on quality — they fail on a bill that quietly triples in month three. Here is the token budget we set before writing a single hook, and the four levers we pull to hold it.AI Automation8 min04 Jul 2026Payload's Generated Types Are the Contract: The Zod + Server Action Pattern We Ship Instead of DTOsPayload generates the types. Zod derives from them. Server Actions accept the same shape the Local API returns. Here is the pattern, the four failure modes it removes, and the one place we still validate by hand.Payload Engineering8 min01 Jul 2026AI Feature Observability on Payload and Medusa: The Four Signals We Wire on Day OneEvery Claude feature we ship on Payload or Medusa gets four signals wired before it sees production traffic. Skip any of them and the regression will be silent — and expensive.Production Hardening9 min28 Jun 2026Alt Text on Autopilot: The Payload + Claude Vision Pipeline We Ship for 10,000-Image ArchivesAlt text is the AI workflow with the highest ROI and the lowest glamour. Here is the exact Payload upload-hook, queue, and Claude Vision pipeline we ship — including the locales we still refuse to automate.AI Automation8 min22 Jun 2026Claude vs Gemini vs GPT-4o-mini for Catalog and Editorial AI: The €/1k-SKU Cost Framework We UseOperators keep asking which model to wire into their Payload or Medusa pipeline. The honest answer: the model name moves the bill less than batching, caching, and structured outputs do. Here is the framework we use on real client work, with line-item numbers.AI Automation9 min19 Jun 2026Streaming Claude from Server Actions into Payload: The Resume-on-Refresh Pattern We ShipStreaming Claude from a Next.js Server Action looks fine on localhost and falls apart the first week in production. Here is the shape we ship instead: kick off the job, stream into Postgres via Payload, let the client subscribe to the row.AI Engineering8 min13 Jun 2026RAG Support Copilots on Medusa: The Retrieval Shape We Ship Before Claude Sees an OrderSupport copilots do not hallucinate refunds because the model is weak. They hallucinate because retrieval is shaped wrong. Here is the three-call retrieval pattern we wire on Medusa + Payload before Claude generates a token.AI Engineering9 min10 Jun 2026Prompt Injection on Commerce Copilots: Five Guardrails We Wire Before Claude Touches a Medusa OrderCustomer-facing copilots on Medusa and Payload fail in five predictable ways once a stranger can type into them. Here are the guardrails we ship before any tool call mutates an order or publishes a draft.AI Engineering8 min07 Jun 2026AI Translation in Payload: The Publish-Hook Pattern We Ship (and the Locale We Refuse to Automate)Most Payload teams wire Claude into localized fields, ship a flood of machine-translated content, then quietly roll it back. Here is the narrower hook shape we ship instead — locked drafts, editor sign-off, token math, and the one locale we never let a model touch.AI Automation9 min01 Jun 2026Internal Linking on Autopilot: The Payload + Claude Pipeline We Wire for Archives Past 400 ArticlesMost editorial teams stop linking internally after article 50. Here is the Payload afterChange hook, pgvector retrieval, and Claude scorer we wire so suggestions land in the editor — never auto-published — with one-click insert into Lexical.AI Automation9 min30 May 2026Catalog Enrichment on Medusa with Claude: The Import-Time Pipeline We Ship for 2,000+ SKU BrandsBolting AI onto live product pages burns trust by week three. Here is the import-time enrichment pipeline we wire into Medusa with Claude, structured outputs, and a Payload approval queue — including token cost per 1,000 SKUs and the regressions it prevents.AI Automation8 min26 May 2026Four AI Workflows We Wire Into Payload for Editorial Teams (and the One We Refuse to Ship)Content teams keep asking us to 'add AI to the CMS.' That framing buys nothing. Here are the four Payload automations that actually move editorial velocity — and the one we refuse to ship, with the wiring shape and token math for a team publishing 40 articles a month.AI Automation7 min22 May 2026GDPR + Payload: The Field-Level Pattern That Passes a Data Protection AuditThe field-level encryption, automated deletion hooks, and audit trail patterns that make Payload CMS applications survive a data protection officer's review — with the specific schema choices that turn right-to-be-forgotten requests into one-line operations.Production Hardening5 min19 May 2026Stripe Webhook → Postgres Ledger: The 50-Line Pattern That Survives an AuditEvery Series B audit asks the same question about your payment data: can you prove this transaction happened, when it happened, and that you recorded it exactly once? Here's the webhook-to-ledger pattern that passes.Integration Patterns6 min16 May 2026Custom Shipping Rules in Medusa: The Multi-Carrier Pattern That Scales Past Flat-RateWhen D2C brands outgrow flat-rate shipping, they need inventory-aware location routing, weight-based carrier selection, and real-time rate shopping. Here's the Medusa shipping service pattern that handles complex fulfillment rules without losing sales to API timeouts.Medusa Engineering5 min14 May 2026Payload Hooks That Prevent Production Fires: The 8 We Ship on Every ProjectThe specific Payload hook patterns we implement on every project to prevent stale draft caches, orphaned relationships, and broken webhook deliveries before they reach production.Payload Engineering5 min12 May 2026Postgres Connection Pooling on Serverless: The PgBouncer vs Supabase vs Neon Reality CheckWhy 100 concurrent Vercel functions kill your database, and the production patterns that scale to 10K connections without breaking your budget.Postgres Patterns7 min12 May 2026Next.js Server Actions + Payload Local API: The 200-Line Pattern That Replaces tRPCHow to wire Next.js Server Actions directly to Payload's Local API for type-safe mutations, eliminating the need for tRPC or external API routes in content-heavy applications.Integration Patterns8 min12 May 2026Payload Blocks vs Collections: The Content Architecture Decision That Breaks at 1,000 ArticlesWhen to model content as reusable blocks vs separate collections in Payload CMS — with real schema examples and performance implications for content teams publishing at scale.Payload Engineering6 min12 May 2026Stripe vs Adyen vs Mollie for EU D2C: The €500k Revenue Breakpoint (and Hidden Costs)Payment processor economics shift dramatically at €500k annual volume in Europe. Stripe's simplicity costs 0.3-0.8% more than Adyen, but Adyen's complexity tax hits smaller teams hard. Real-world fees, integration weeks, and revenue thresholds where switching pays back.Vendor Choice4 min12 May 2026AI Search on Medusa: When It Beats Algolia (and the $4k/Month Reality Check)Our token economics breakdown for AI-powered search on Medusa JS: when semantic search justifies $4k/month in OpenAI costs vs $400/month Algolia, and the hybrid approach that cuts spend 60% while improving long-tail conversion 23%.AI Rollout3 min12 May 2026Payload vs Sanity for Content Teams: Why We Switched (and the 3-Month Cost Breakdown)Content teams publishing 20+ articles monthly hit workflow friction with Sanity Studio that Payload's admin eliminates. Here's what the switch costs and when it pays back.Vendor Choice5 min12 May 2026Shopify Plus to Medusa: What a 6-Week Migration Actually Costs (and When It Pays Back)Break down the real financial math behind migrating a high-SKU D2C brand from Shopify Plus to Medusa — migration costs, ongoing savings, revenue impact, and the 18-month payback timeline most CFOs need to see.Replatform6 min
Field notes by email
One field note a week. Buyer-readable.
Migrations, costs and trade-offs from real client work. Unsubscribe in one click.





























