</>CodeWithKarani
The archive

All articles

485 articles on AI, ERPNext, Frappe, Linux and shipping software. Search the full archive or filter by topic.

485 articles · showing 1-9 (page 1 of 54)

Frappe/ERPNext15 min read

One tap at the till, five documents: the submit chain behind ERPNext retail

I recorded an hour and twenty minutes of UpeoRetail and refused to cut the boring parts, because the eight seconds at the counter is the easy bit. What one submit really writes: stock ledger, GL, a serial and batch bundle, a payment, and two integrations that live outside the transaction.

Read
Mobile Engineering14 min read

Your spare Android phone is a payment gateway: an offline-first SMS relay for M-Pesa

M-Pesa till confirmations arrive as an SMS, and Daraja is not open to every merchant. So we turned a spare Android phone into a self-hosted SMS-to-HTTP gateway: encrypted on-device, HMAC-signed on the wire, and built so that it never loses a message.

Read
AI Engineering6 min read

Metering, model routing and the regression suite that stops your agent rotting

Two questions decide whether an AI feature survives its first year: does each request make money, and will a prompt edit break something silently? An append-only credit ledger, two-tier routing, and a suite that asserts question-to-metric mappings are the answers.

Read
Mobile Engineering16 min read

Six ways Android will eat your background service, and what actually worked

A broadcast receiver is a lie, WAL journalling wedged openDatabase on OxygenOS, and one polite database close in a WorkManager teardown silently stopped the whole gateway. Six real failure modes from a production Android SMS gateway, and the fix for each.

Read
Security12 min read

Exactly-once over an unreliable pipe: HMAC, nonces, and a byte-exact contract

A per-request nonce and a per-content hash look like the same idea and are not. One says this request arrived twice, the other says this message arrived twice, and a payment pipeline needs both. The signing design behind a production SMS gateway.

Read
Mobile Engineering9 min read

Shipping an Android app that can never be on the Play Store

Play forbids READ_SMS for anything that is not the default SMS handler, so this app was never going to be listed. Then a silent fallback to the debug keystore and a versionCode stuck at 1 turned every update into an uninstall. Two traps, one incident.

Read
Frappe/ERPNext13 min read

Deploying Frappe apps to a client server you're not allowed to touch

The client will not give you access to their dev server, so every code change means someone on their side pulls and migrates by hand. Here is the complete fix: a self-hosted runner they install, a deploy script they own, and no credential to their environment on your side at all.

Read
Mobile Engineering9 min read

The OEM autostart rabbit hole: deep-linking into a dozen undocumented settings screens

Android has no API for the autostart allowlist your phone's manufacturer invented. So you keep a list of undocumented component names, try them in order, and design the failure case properly, because Transsion, which is enormous in Africa, exposes nothing at all.

Read
Frappe/ERPNext12 min read

Bolting a phone onto ERPNext: custom routes, guest endpoints and HMAC auth in Frappe

Frappe claims every /api/* path before website routing, so a fixed third-party path 404s. Here is the before_request rewrite that fixes it, including the cached property you also have to bust, and why allow_guest endpoints can still be strongly authenticated.

Read