</>CodeWithKarani
All topics
Topic

Engineering Craft

38 articles in this topic.

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
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
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
Software Design11 min read

A payment source, not a payment parser: what keeping the pipe dumb actually buys

The SMS gateway could have extracted the M-Pesa transaction code on the phone. It deliberately does not. Here is what that bought, what it cost, and the boundary question every integration eventually has to answer: where does meaning belong?

Read
DevOps & Containers8 min read

GitHub Actions from scratch: workflows, jobs, steps and triggers

A workflow file is four ideas stacked on each other. Learn them in the right order, understand why push to main is the wrong deployment trigger, and you can write your first deploy pipeline today.

Read
Security8 min read

Access is a liability, not a convenience

Every SSH key you hold on a client's server is a credential you now have to defend, insure and explain. The strongest position in an enterprise procurement conversation is not having it at all.

Read
Engineering Craft8 min read

Git for Two: The Branching Model a Small Team Actually Needs

Git Flow is costume jewellery for a two-person team. Here is the smallest workflow that stops you clobbering each other: short-lived branches, protected main, rerere, squash merges, and revert-forward.

Read
Engineering Craft7 min read

Docker, Finally: A Practical On-Ramp for Developers Who Kept Putting It Off

You are not scared of containers, you are tired of the vocabulary. The mental model in four sentences, four commands, a real multi-stage Dockerfile, a Compose v2 file, and the five things that will confuse you.

Read
Engineering Craft7 min read

Ship to Your Own VPS: GitHub Actions CI/CD Without the Cloud Bill

A complete pipeline for a 10-dollar server: test, build to GHCR, deploy over SSH, health check, roll back. Real workflow YAML with current action versions, plus the details that quietly break deploys.

Read
Engineering Craft8 min read

Six API Design Mistakes That Will Cost You Six Months

API mistakes are expensive because they are public. Status codes in the body, offset pagination, contradictory booleans, leaked schemas, no versioning plan, and float money - with the fixes that are free today.

Read
Engineering Craft7 min read

Your Migration Will Run Twice: Write It That Way

Retried deploys, scaled replicas and tired humans all re-run migrations. Advisory locks, idempotent DDL, resumable batched backfills, the CREATE INDEX CONCURRENTLY trap, and a CI check that runs it three times.

Read
Engineering Craft8 min read

How to Read a Codebase You Did Not Write, Without Panicking

Never try to understand a codebase. Answer one question about it and let understanding be a side effect. Run it first, find the edges, trace one request, read the schema, and mine Git history for the answers.

Read
Mobile Engineering9 min read

React Native Version Mismatch: Rebuilding Is Only Half the Fix

The redbox compares two build artefacts, not two package.json entries, and only major.minor. How to find which side is stale, pin react correctly, and stop it recurring.

Read
Payments & Fintech6 min read

Daraja Error 1032 'Request Cancelled by User' Is Not a Bug in Your M-Pesa Integration

M-Pesa STK Push ResultCode 1032 means the customer pressed Cancel, not that anything broke. Stop paging on it and handle it as the user action it is.

Read
Engineering Craft9 min read

CI Auto-Retry Is Hiding Your Flaky Tests, Not Fixing Them

Retry-on-failure keeps CI green by throwing away the one thing you need to diagnose flakiness. Here is how to make flakes visible, quarantine them, and root-cause the real nondeterminism.

Read
Python & FastAPI9 min read

pytest-asyncio 'event loop is already running': there is no patch coming

request.getfixturevalue() on an async fixture crashes pytest-asyncio, nest_asyncio no longer saves you, and upstream has no fix. Here is the test architecture that works instead.

Read
Payments & Fintech7 min read

Testing Payment Integrations When the Sandbox Itself Is Flaky

M-Pesa, Stripe and Paystack callbacks are where payments break, and the sandbox that fires them is unreliable. Stop chasing it: record the payloads once and test your handler against fixtures.

Read
Engineering Craft7 min read

How to Actually Read a Stack Trace: Finding Your Code in the Noise

Stop reading stack traces top to bottom. Find the deepest frame in your own code, read direction by language, and turn a wall of red text into a two-minute fix.

Read
Security9 min read

Laravel 419 Page Expired in Production: A Diagnostic Order, Not a Fix List

The intermittent Laravel 419 TokenMismatchException has five common causes that look identical. Here is the order to diagnose them so you fix it once.

Read
Mobile Engineering6 min read

React Native Android 'Duplicate Class': Finding Which Two Dependencies Conflict

The Duplicate class error names a class, not the package causing it. Read the dependency tree, force one AndroidX version, and stop excluding libraries at random.

Read
Engineering Craft8 min read

Flaky CI Tests From Live Third-Party APIs: Mock the Boundary, Don't Rerun

Retrying a flaky test that calls a live payment or SMS API makes CI slower and less honest. Mock the boundary, verify the real integration on a schedule, and track flake rate.

Read
Engineering Craft7 min read

What to Log So 3am-You Can Actually Debug It

Generic logging advice never shows the one line that ends an incident. A real failure walked through, the five fields that turn 'operation failed' into a diagnosis, and a PR checklist.

Read
upeo.academy2 min read

Securing Deliveries: How Technology is Transforming the Way Businesses Protect Delivery Notes

In today’s fast-moving business environment, delivery notes play a critical role in confirming the dispatch and receipt of goods. Yet across industries, we are witnessing a worrying trend: the abuse…

Read
Technology3 min read

How to Transfer Files from a Remote Ubuntu Server to Local Using SCP (Password Authentication)

Introduction Transferring files between a remote server and your local machine is a common task for developers, system administrators, and database managers. One of the most secure and efficient ways…

Read
Technology3 min read

Interactive Frappe And WhatsApp Integration: WhatsApp and Frappe Framework for Real-Time Data Management

In the digital age, businesses and developers are constantly seeking innovative ways to streamline operations and enhance customer interactions. Today, we’re excited to share an impressive…

Read
Frappe/ERPNext2 min read

Installing ERPNext via Docker for Beginners - A Step-by-Step Guide

Installing ERPNext via Docker is a convenient way to set up the platform without needing to deal with complex dependencies and configurations. Below are highly simplified steps to guide you through…

Read
Engineering Craft1 min read

How to solve the Integrity Error(1062) issue when installing a frappe app

If you've ever encountered the frustrating "module integrity issue" while installing a Frappe app, you're not alone. This error can often be a roadblock to getting your app up and running.…

Read
Frappe/ERPNext1 min read

Effective Error Reporting in Frappe Framework and ERPNext Development

Error reporting is a fundamental aspect of the development process when working with the Frappe Framework and ERPNext. As a developer, encountering errors is not a matter of "if" but "when." How you…

Read
Engineering Craft1 min read

PDF Printout Doesn't Show Header in Frappe/ERPNext

It is quite frustrating to have your printouts looking all well only to get broken when you try to render them into a PDF that can be downloaded. If you have a similar case in your ERPNext or Frappe…

Read
Frappe/ERPNext1 min read

Custom Buttons - Client Scripts in Frappe Framework and ERPNext

Client scripts are powerful! They give you the flexibility to control how you want your application to behave. With these pieces of code we can even alter how our application works currently. In this…

Read
Technology2 min read

Unknown log format "main" - Nginx

This error can occur during installation of ERPNext as nginx: [emerg] unknown log format "main" in /etc/nginx/conf.d/frappe-bench.conf:101. This error can also occur when setting up nginx outside…

Read
Frappe/ERPNext7 min read

How to Manage Frappe/ERPNext Custom Code via GitHub

Your customisations belong in your own app, and that app is a git repository from the moment bench creates it. Here is the whole loop: local bench to GitHub to the server, including the half of your work that lives in the database and never reaches git on its own.

Read
upeo.academy2 min read

Will Tech Giants Kill Startups In Africa?

It is important to consider this topic since we have been having technology giants around for some time now. More and more are expressing their interests to join the African movement, promising…

Read
Engineering Craft10 min read

How to avoid Burnout as a Software Developer

When I graduated from college and landed a Software Developer job at Futuristic, I was all in. I was so enthusiastic about code that finding time to have my lunch was becoming difficult by the day. I…

Read
Python & FastAPI6 min read

Python 2 Dies in January: The Migration Plan I Wish I Had Started Sooner

Python 2 reaches end of life on 1 January 2020. Here is the order I move a real codebase in, the bugs that only appear in production, and what to do if you truly cannot finish.

Read
Databases7 min read

Error 1055: MySQL 5.7 Rejected the GROUP BY Query That Worked for Years

ONLY_FULL_GROUP_BY is on by default in MySQL 5.7 and it broke half the reports in a legacy app. Why the old query was always wrong, and the four ways to fix it ranked by regret.

Read