Engineering
Systems I've designed and operated in production — architecture decisions, trade-offs, and real constraints.
Problems Solved in Production
Frontend performance
A B2B SaaS inbox loading ~20,000 conversations at once (~6.7 MB per request) — cursor-based pagination + list virtualization, ~19 KB payload and no more UI freezes
API latency
Marketplace API timeouts causing cascading failures in a dropshipping operation's checkout — circuit breaker with fallbacks and monitoring (full implementation on the blog)
Marketplace inconsistencies
Mercado Livre and Shopee APIs returning inconsistent product data — adapter pattern normalizing both schemas into a unified model
Legacy migration
An aesthetics platform with 50k+ users moving off a PHP 5.3 monolith to React + Next.js without downtime — incremental, screen-by-screen migration (strangler fig)
Performance at scale
Response times degrading as the user base of a web + mobile health platform grew — query optimization, strategic caching and parallel calls
Cross-platform UX
Keeping UX consistent between React (web) and React Native (mobile) in the same product — shared design tokens and component contracts
Data consistency
Financial modules of a pet shop SaaS (sales + commissions + payments) drifting out of sync — atomic transactions with PostgreSQL advisory locks
AI Systems in Production
Not chatbots — production pipelines where AI is a component in a larger system, with fallbacks, monitoring, and real data flowing through.
WhatsApp AI Agent
LLM-powered agent handling customer service, product recommendations and sales completion. Messages processed async, data registered back into PostgreSQL. Fallback to rule-based matching when LLM is unavailable.
RAG Pipeline (LangChain + pgVector)
Document ingestion → chunk splitting → embedding generation → vector storage in PostgreSQL with pgVector → semantic search with top-K retrieval as LLM context.
Read full implementation →Frequently Asked Questions
What is cursor-based pagination and when should you use it?
Instead of OFFSET/LIMIT, each page is fetched from a cursor — a stable pointer to the last loaded record (e.g., created_at + id). This keeps read cost constant on large lists and prevents duplicated or skipped items when new records arrive mid-navigation. It's the right choice for feeds and inboxes; the trade-off is losing direct jumps to an arbitrary page.
What is multi-tenant architecture?
A design pattern where multiple organizations share the same application and database, but each tenant's data is isolated. The most common approach in modern SaaS is shared database with tenant_id column and PostgreSQL Row Level Security (RLS) as a safety net.
How to handle payment webhooks reliably?
Use a layered approach: validate signatures on every event, enforce idempotency with stored event IDs, ack immediately and process in background, validate state transitions with a state machine, run periodic reconciliation jobs, and route failed events to a dead letter queue.
How to integrate AI into production systems?
Treat AI as a system component, not a standalone feature. Process messages asynchronously, register data back into your database, implement fallbacks for when the LLM is unavailable, and monitor response quality. The key is reliability — the system must work even when the AI provider has issues.
What is the circuit breaker pattern?
A resilience pattern for third-party API integrations. When an external API starts failing, the circuit breaker 'opens' and returns fallback responses instead of cascading the failure through your system. After a cooldown period, it allows test requests to check if the service recovered.
Deep Dives
React Inbox at Scale
Cursor, virtualization, 6.7 MB → 19 KB per request
Circuit Breaker in Node.js
State machine, fallbacks, retry and monitoring
Webhook Architecture for Payments
Idempotency, reconciliation, PIX flows
Multi-tenant Architecture
Shared DB, RLS, partitioning
RAG with LangChain
Embeddings, pgVector, semantic search
Design Systems at Scale
Shadcn UI, tokens, component contracts
Docker for Frontend Devs
Dockerfile, multi-stage builds, dev/prod
Getting Started with TypeScript
Types, interfaces, generics, utility types
