Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to bundle NodeJs Application?

Consider I have been done with my NodeJs with Express and MongoDB Application. I can bundle up my application to deliver the same to client but in that case client have to install all required npm modules and change mongoDB connection url. So to counter this issue:

Is there any other way to bundle my application so client do not need to install any npm modules to run application? If yes, then how client can connect to his mongodb?

like image 257
user2672420 Avatar asked Jan 27 '26 09:01

user2672420


1 Answers

pkg by Vercel works really well for me. It bundles everything into a single executable that runs out of a terminal. This makes it really easy to distribute.

To connect to a Mongo instance, you would have to have some kind of configuration file that the user edits. I recommend putting into the user data folder (Application Support on Mac and AppData on Windows), but you could have it sit right next to the packaged executable.

like image 158
Alex Anderson Avatar answered Jan 29 '26 00:01

Alex Anderson