I’m working on a similar project and have had some success. I found this post here Automating "unsmart" IR devices which describes how to set up lirc_web to make it accesable via a REST api call. This didn’t work for me because lirc_web is kinda old and didn’t work on raspbian buster.
What worked for me was installing node-red on the lirc device, and then downloading and setting up the lirc-module for node-red (https://flows.nodered.org/node/node-red-contrib-lirc), and makIng it listen to my mqtt server. I’ve set up topics like lirc/tv and lirc/receiver for each remote and set up each remote in node red, then you just send the command to the topic/remote you want. You don’t need to send the full lirc cli command, node-red does most the work, so when the message KEY_POWER goes to topic lirc/tv, it turns the tv on and off.
I’ve downloaded the Generic Remote Control Card on the HACS community store and used that to publish the mqtt messages. I have just finished testing my setup out on a Pi4 but will be moving it over to a Pi ZeroW soon. When I do I’ll do a step by step guide on how to set everything up.