from Hacker News

Show HN: Node.js and React -app as a Windows service with .msi

by trewqasdf on 11/1/23, 1:18 PM with 0 comments

One of my previous side projects was to build a small web app meant to be run on enterprise Windows server environment. The type of place where software is still installed manually by clicking through an installer. I wanted the app to run as a Windows service, and to have a minimal .msi -installer, so that more or less anyone could install the software.

Instead of being smart and writing the app in C# and get the full tooling of Microsoft... I choose to do a modern web app with Node.js and React.

I thought, how hard can it be to package it into a Windows service?

It turned out to be pretty hard. And not for any good reason, just a disparate ecosystem.

Finally, I managed to do a basic app and package it as an .msi, but all my creative energy to continue was gone.

To salvage a little of the project, I decided to upload a complete template app to Github (including build scripts). If someone wants to do the same thing, they just might save some time! The code is MIT licensed.

Three essential things I struggled with were: - How to make the Node.js-app write local files (textfiles, SQLite..) - Node.js interacting with the Windows service daemon - Set up the service automatically when running the installer, including ARGV