Programming
Thirty years ago I was writing the software for the counter. Today that counter goes on selling after the shutters come down. The story of a sync, two bugs caught in time, and why I did not use somebody else's platform.
Full image ↗
MyShop has been around since 1995. It was born for the counter: receipts, stock, customers with their surname written in biro on a loyalty card. Over thirty years it has taken in electronic cash registers, e-invoicing, bank card terminals. But the question my customers have been asking me for at least ten years is always the same: "Nanni, what about the website?"
The website, quite. For years I answered with connectors: NopCommerce, PrestaShop, the marketplaces. They work, but something about them never fully convinced me: the shop lives in one place, the site in another, and in between there is you, playing postman between two worlds that never really speak.
So I did what a programmer of my generation does when something does not convince him: I wrote it myself. An e-commerce site of my own, PHP and MySQL, the kind that runs on hosting costing a few euros a month. And above all a sync that keeps it fastened to the management system like a shadow.
There is one principle, and I have never broken it: the management system is the source of truth. The site owns nothing — it reflects. Products, photographs, variants, stock, prices, promotions: all of it is born in MyShop and reaches the web on its own, in half a minute or so, through a queue of events that records every change and transmits only that. Sell one at the till? It can no longer be ordered online. An order comes in from the site? A numbered document appears in MyShop with the goods reserved, ready to be picked like any counter order.
This summer I closed the circle with the piece I had been waiting years for: the customers. Not "the site's users" — the customers, the real ones, the ones with the loyalty card.
Now anyone who registers online with the same email address they gave in the shop is recognised automatically. Anyone with a different address asks the shopkeeper for their customer number and types it in once. From that moment they are the same person in both worlds: they see the loyalty points they earned at the till, the vouchers waiting to be collected, the promotions reserved for their category, their personal discount applied across the whole catalogue — with the same precedence rules the person at the till would use. And the shopkeeper, on the other side, sees web orders filed under the right customer record, not under a duplicate with the same name.
Passwords and tax details never travel: only the bare minimum goes to the web, and turnover only as an aggregate total. On that I was immovable, and it lets both me and my customers sleep better.
One story, because it is in the details that you see how the trade has changed. The orders module looked ready: written, reread, convincing. Then, testing the whole flow with Claude — a real order, from the cart through to the document inside the management system — two bugs surfaced that had been waiting quietly for the first real customer: an identity column that refused an explicit insert, and a foreign key on the province that would have rejected every new address.
Two small mistakes, of the kind that code which compiles hides beautifully. In production they would have gone off on the first order, on a Saturday evening, with the customer sitting in front of the cart. Found instead in half an hour, on a test database, with no casualties. I wrote about this a few weeks ago: I do not delegate the thinking, I delegate the tedium. And I would add: the tests carried right through to the end, the ones you always put off when you are on your own.
Now, when a shopkeeper asks me "what about the website?", the answer is that the website is his shop. Same catalogue, same stock, same customers, same loyalty card. Only that at half past seven, when he pulls the shutters down, the shop goes on selling.
Thirty years ago I was writing CALC.BAS. Nothing has changed: it is still a matter of making the figures add up. Only now they add up at night as well.
The technical detail of the sync, for anyone who wants all of it, is on myshopweb.it.