Engineering blog
Flows from real apps, explained
Each post takes one flow I built (payments, events, auth, real-time calls, RAG, offline storage) and walks through the sequence, the core code, the design decisions and the mistakes. Steal the patterns.
Pro E-Farmer
Variety-aware crop timelines: a farm-science engine as pure, offline TypeScript
A maize field planted with a 90-day hybrid shouldn't get the same phase dates as a 120-day local composite. Here's the small, dependency-free library behind E-Farmer's crop timelines, how it scales stages per variety and re-plans from what actually happened, and why one copy of the data beats three.
Offline farm jobs and native alerts without a server: idempotent, debounced and deduped
With no backend cron in offline mode, the app itself has to age the animals, open heat windows and remind farmers to log their eggs. Here's how I run those jobs in Electron's main process and in an Expo background task, so they're safe to run any number of times and never nag twice.
A locked-down Electron app with a typed IPC bridge and a transactional local API
An offline farm app needs SQLite, a keychain and native notifications, but the page that renders it should touch none of them. Here's how I split E-Farmer desktop into a sandboxed Angular renderer, a whitelisted preload and a main process that validates every call and runs it in a transaction.
From relational tables to a RAG knowledge base: render markdown, chunk by shape, rebuild on a schedule
Vector stores don't understand foreign keys, so an assistant over farm data needs its records turned into text first. Here's the pipeline in Pro E-Farmer: a NestJS cron renders one markdown document per animal and crop cycle, and a disposable Django/Chroma index chunks them by document shape.
A farm-scoped RAG assistant: tenant filters, capped retrieval and prompts that refuse to guess
A farming assistant that answers from the wrong farm's records, or from the whole corpus, is worse than no assistant. Here's how Sora in Pro E-Farmer routes questions through canned actions, intent detection and a multi-tenant RAG service that only sees the farmer's own data.
QLoRA on a 133-sample domain dataset: what fine-tuning Phi-3-mini taught me about when not to
I tried fine-tuning Phi-3-mini-4k-instruct with QLoRA so Pro E-Farmer's assistant could run on a small local model. Here's the setup, the bugs a small dataset hides, and why RAG is what's live while the adapter stays an experiment.
MboaMeet
A write-behind view counter with two Lua scripts and one Postgres UPDATE
Counting video views with one UPDATE per view turns your hottest table into a lock queue. Here's how MboaMeet dedupes views in Redis with a single Lua round trip, buffers them in a hash, and flushes them to Postgres every five minutes in one statement, plus the failure mode I accepted and how I'd remove it.
A payment webhook inbox that can't double-credit: RevenueCat, Stripe top-ups and an AI billing saga
Payment providers retry webhooks, deliver them out of order and sometimes send the same event twice, and every one of those cases can turn into free tokens or a lost purchase. Here's the inbox pattern I use in MboaMeet: store the raw event under a unique id, process it later from a background worker, and make every credit and refund idempotent by reference.
An HLS video ladder on a single VPS: H.264 + HEVC tiers, aligned keyframes and Nginx doing the serving
A scrolling video feed needs fast starts and small files, and a CDN-backed media pipeline is a lot of infrastructure for an early product. Here's the pipeline I built for MboaMeet's feed: client-side compression, a Hangfire + FFmpeg ladder with three tiers in two codecs, and Nginx serving the segments straight from disk.
P2P-first 1:1 calls that fall back to an SFU mid-call without hanging up
Peer-to-peer WebRTC is cheap and private until a carrier NAT breaks it, and an SFU always connects but costs server bandwidth on every call. Here's how MboaMeet starts calls P2P with Coturn, and switches both phones to a self-hosted LiveKit room on the same call id when ICE fails.
Incoming calls that ring when the app is dead: VoIP push, CallKit and data-only FCM in React Native
A calling app is only as good as its ring, and a ring that needs a live WebSocket fails the moment iOS or Android kills your process. Here's the push-only pipeline I built for MboaMeet: PushKit reported to CallKit in native Swift before JavaScript boots, data-only FCM on Android, and a server that routes each token to the right transport.
Qashio Expense Tracker
Refresh-token rotation that doesn't log out users with five tabs open
Rotating refresh tokens on every use is good security, but a naive implementation turns parallel requests into random logouts. Here's the Redis lock, grace-replay cache and client-side single flight I use so concurrent refreshes all get the same new tokens.
Saving a transaction exactly once: idempotency keys from the form to the database
A double click, a timeout retry or two racing requests can each record the same expense twice. Here's how an Idempotency-Key that the client derives from the form, a strict server-side replay and a soft lookalike check together make 'Save' safe to press again.
Domain events that never get lost: a transactional outbox fanned out to BullMQ
Saving a row and publishing an event are two writes, and one of them will eventually fail. Here's the outbox → relay → one-job-per-handler pipeline I built so budget alerts fire exactly once, even through crashes and retries.