The screenshot is taken from Adminer, which I use as a web interface to interact with my PostgreSQL database. I find it great for basic tasks, although there are probably better alternatives.
Next, I created a separate folder that works as an extension inside my ERP system. This is where the API endpoints reside. Its purpose is to accept POST requests:
POST /extension/machine-tracking/store-reading
Then I defined the payload (Codex actually helped generate it):
{
"machine_id": "BM301",
"reading": 1234,
"time": "2026-03-13T10:30:00.000Z"
}
There are three main variables:
- the machine ID
- the reading value
- the timestamp
The machine I started this integration with is designed to bend metal, as shown below.
Technically, there are many metrics that could be captured, such as the total number of cycles, power on/off signals, and others. However, simplifying the integration to a single parameter does not necessarily reduce the quality of telemetry.
So I decided to track just one metric, which is the number of bends. Specifically the number of times the metal beam moves up and down.
Each time the value changes, an API request is triggered and the backend stores the reading. Once multiple readings are collected over time, charts can be generated to visualize how busy the machine is throughout the day.
3. Building API
Well, prompts again. I sent the following prompt to Codex.
Not much is happening here. We simply extend an Express route and perform basic validation of the incoming data before passing the payload to the store method.
const response = await store(req.body, db, logger);
In the store.js file, we pass the three payload parameters to the PostgreSQL database.
4. Getting Data From the Machine
Now that the API and database are set up, the next question is: where do we get the data from?
My first thought was to use sensors connected to a Raspberry Pi acting as a gateway that would forward the payload over the internet to my ERP server.
However, since I understand how the machine’s UI operates (it’s a relatively simple browser interface communicating with the PLCs), I decided to tweak the interface itself to extract the reading without installing any additional hardware.
Even though I had deployed everything to production, the information was still not being transmitted from the machine. I opened the browser’s inspect panel on the machine interface and discovered that it was a CORS issue.
6. Visualisation
This is the most fascinating part, because we can now start thinking about meaningful insights from the collected data (I waited for 3 days before getting to this part) and how to visualize them. I defined three possible views:
- Shift heatmap
- Production rate trend
- Per-machine counter trend
Then I sent another prompt. Here’s what we got.

SOCIAL SHARE CARD GENERATOR