Skip links

Create a private NPM registry: The journey begins

A good amount of projects use the same components in the front end: a custom login, some menus, and of course a 3D viewer (ForgeIFC,js).

To make the process leaner, we start searching for our package management, an npm-like solution to handle all our components.

This is the starting point of a series where we research different options to solve this problem.

The first approach, Verdaccio

As established on its website Verdaccio is “a lightweight Node.js private proxy registry”, open source and documented. Easy to deploy on-premise or in the cloud.

To deploy it to an AWS EC2, is as simple (or complex) as this:

1 – Create an AWS EC2 instance,

2 – Open the port in the security Inbounds setup,

3 – Open the port using the command. Depending on the version of Linux you are running, you need to call iptables. 

				
					sudo iptables -A INPUT -p tcp --dport 4873 -j ACCEPT,
				
			

4 – Follow the documentation to deploy the instance https://verdaccio.org/docs/aws/

5 – Remember: Create static access to your registry. You could create an API gateway or a Route53 implementation to access your registry. You don’t want to change the URL every time you reboot the instance (based on real experiences).

If everything goes as expected, you will be seeing a web like this:

Add the repository to your local NPM

To consume this new repository from your computer, you need to add it to the npm registry along with your Verdaccio credentials:

				
					npm set registry [<http://someIp.compute-1.amazonaws.com:4873/>]
(<http://ec2-34-238-233-245.compute-1.amazonaws.com:4873/>)npm login
				
			

Add a new Package

Publishing a package is as simple as follows.

				
					npm publish --registry [<http://someIp.compute-1.amazonaws.com:4873/>]
(<http://ec2-34-238-233-245.compute-1.amazonaws.com:4873/>)
				
			

Conclusions

While we got the repository up and running quickly, the final product is not totally what we wanted.

PROS

✔️  Documentation is good, and being an open source the community helps a lot.

✔️ Once everything is set up, the repository works like a charm.

CONS

❌ Having an EC2 just for this service feels like an overkill.

❌ Little complicated for non-technical users. (Linux commands all over the place)

❌ The GUI is limited in terms of configurations, if you need something custom you need to check under the hood. (Actually, it’s not bad per-se but it would be nice to have a few permissions settings accessible thru the interface)

What do you think? Have you tried Verdaccio?

Our next test will be creating an npm repository using Github and Github Actions, so stay tuned!

79 Views
Author

I'm an Architect who decided to make his life easier by coding. Curious by nature, I approach challenges armed with lateral thinking and a few humble programming skills. Love to work with passioned people and push the boundaries of the industry. Bring me your problems/Impossible is possible, but it takes more time.

This website uses cookies to improve your web experience.
Explore
Drag