Hide & Seek Code: Part II

vjnvisakh

Visakh Vijayan

Posted on May 24, 2021

Hide & Seek Code: Part II

If you are new here, then please visit our earlier article over here for some context.

After the last article we were trying to find out ways to improve upon the approach but at the same time didn't want to do anything crazy either.

That is when we found out about Buddy. Buddy is one of those easy DIY devops tools out there. Best part is the UI and how easy it is to create a deployment pipeline.

Modifying package.json

Okay so back to our task. We added this line in our package.json file under the build script.

"build": "nest build && mkdir -p build && node obfuscate.js && find ./build -name '*.ts' -type f -delete && cp package.json build/",
Enter fullscreen mode Exit fullscreen mode

The above line creates a folder called build, obfuscates(make it unreadable) and remove all the .ts files. We also had to copy our package.json file into the build folder so that we can install our dependencies at our destination.

Let's lay some pipes

Then we setup a pipeline in Buddy.
Alt Text

We made 3 actions. Actions are more like a sequence of steps.

  1. The first one "Execute" created a build folder and obfuscated code.
    Alt Text

  2. The second one copied the build folder to the client's server.
    Alt Text

  3. The third one basically started the project.
    Alt Text

Feel good moment

Once the actions were setup we started our pipeline and kept looking at this "feels good" UI while it was running.
Alt Text

After the pipeline completed, we logged into our server and were able to see our instance running. Phew!!! And this is how our code looks now. Not the best of encryption, but pretty hard to read/modify.

Alt Text

What we feel

This solved our problem to a major extent. The only drawback we found was the speed of execution. It takes around 2-3 minutes for the entire process to complete. But we are sure there are ways to optimize it. So we are looking forward to it.

Let us know your comments.

Happy programming!!!

💖 💪 🙅 🚩
vjnvisakh
Visakh Vijayan

Posted on May 24, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Hide & Seek Code: Part II
nestjs Hide & Seek Code: Part II

May 24, 2021

Don't keep me waiting
nestjs Don't keep me waiting

May 23, 2021