Best approach for adding custom web service functions?

Hi all! New to OpenWRT. I'm running it on a little x86 mini-pc and it's working well. I'm interested in creating a little custom web service to run my own functions. I can't just use the existing JSON-RPC service as I'm hoping to do some custom stuff like have a sqlite db that stores schedules and ip ranges and flip them on and off or edit them via remote API calls. I'm trying to figure out what would be the easiest approach to add these functions would be.

I've been looking around and so far I've kind of seen a few of possible solutions (forgive me if any of these don't make sense - I'm pretty new to OpenWRT and looking through a ton of stuff all at once). Would any of these be a good approach?:

  1. Somehow add functions to the existing JSON-RPC API?
  2. Add functions to UBUS with my own custom .so and then call them over the UBUS API?
  3. Just install something like node and write and run everything completely separate and make CLI calls to UCI? (in other words, run a separate web server)
  4. I've noticed I can drop an html file in the www folder and LuCI will serve it. I'm not yet familiar with what server and libraries it's using to know if I could somehow drop in some sort of custom web service easily though?

Honestly, I can do more research on my own. I'm just looking for a general nudge towards what approach to research so I don't have to waste a ton of time. Is there a clear best solution to this or maybe a past post I missed in my searching that someone could point me to?

You can easily add your own code accessible via RPC calls:

1 Like

There‘s also an example app available here:

A revised example app with more functionality coverage is proposed here:

1 Like