Photo by Phillip Glickman on Unsplash

I love Lua. I also love NGINX. The three of us get along just great. Like every relationship, we’ve had our highs and lows (yes, I’m looking at you Lua patterns), but overall life was perfect. Then, NGINX JavaScript Module (NJS for short) came along.

Photo by Agnis Leznins on Unsplash

This is part 3 in a three-part series. Read part 1 here and part 2 here.

With a working API layer under our belt, it's time to put in the final piece of the puzzle: the presentation layer. This layer consists of static resources (HTML, CSS, JavaScript) and API calls to display and add confessions.

✏️ As this tutorial is not frontend focused, I wanted to keep things simple and use vanilla JavaScript, HTML and CSS. I will also not go into too much detail with why or how these are implemented, as we are not really here for frontend…

Photo by David Watkis on Unsplash

This is part 2 in a three-part series. Read part 1 here.

We previously left off with our server able to handle static content, but that is about all. In order to store and retrieve confessions, our app needs to interact with a database. That’s where Diesel comes to our aid!

In order for Diesel to interact with a database, a database instance needs to already exist. Make sure you have access to a Postgres instance (local or cloud based, both work) before moving forward.


1. We begin with installing diesel_cli - a tool that helps us manage…

Photo by Hanbyul Jeong on Unsplash

It’s 1:00 AM (🎵 soft jazz music). You’re lying in bed trying to get some sleep. The city lights shine into your bedroom, softly illuminating the wall in front of you. You can hear the rain outside and the sound of people going about their late-night business. You can’t fall asleep. Something is bothering you, and you feel like you have to get it off your chest. You have to tell someone, but you don’t want to do it on social media. You want to spill your guts but remain completely anonymous. …

Photo by Mae Mu on Unsplash

Time flies when you’re having fun. Today is our last stop on the SFRA development train, and its an exciting one for sure! In today’s post, we will play around with ISML templates, or in other words, the visual representation layer of our storefront.

Let’s Talk About Cache, Baby

Templates are used a lot, but by default, they are not cached. That being said, there may be times where we want to cache the template for better performance. For cases like these, ISML comes to our aid with the iscache element. …

Photo by Joshua Rodriguez on Unsplash

Yesterday we created a job that keeps our storefront sitemap updated and fresh, and we did that using the out-of-the-box createSiteMap step. Whenever you can use a premade step like that, that’s awesome! But, there are times that you may want to create a step customized to your own needs. Meet the ExecuteScriptModule step — the ⭐️of today’s post!

The One With the Static Assets

Let’s consider the following situation: you are using a JavaScript library in your storefront, which you download from a third-party CDN, for example: React: <script crossorigin src=""></script>

If a visitor with an Ad Blocker configured to block third-party scripts comes to…

Photo by Anne Nygård on Unsplash

There may come a time where we want to run code automatically and repeatedly on our storefront (think Linux cron job). Such a job could be to update a local database with values, import or export product catalogs or even update a local resource on our site. SFCC provides us with a wonderful and accurately named framework — the Jobs framework — that enables us to handle these tasks.

Automate All the Things!

So what actually is an SFCC job? Well my young Padawan, an SFCC job is really a set of steps (actions) that are executed in order (flow) on a fixed time…

Photo by Adam Solomon on Unsplash

🎼 Now this is a story all about how
My code got triggered only once
And I’d like to take a minute - just sit right there
I’ll tell you how I spent my day registering to events 🎼

So far in our SFCC journey, we saw how to write code that gets triggered by an action (for example, browsing to a route); but what if we want to run code that corresponds to an event? …

Photo by Lefteris kallergis on Unsplash

Yesterday we built our first service using the Services framework, and as much joy as we got from the dad jokes it returned, there was something much less funny about the whole thing: it was static 😱. We had one URL we were calling and that is. No paths, no on-demand headers, no query params — nothing. Well, today we are going to change all that! …

Photo by Kate Townsend on Unsplash

A common use case for cartridges is to retrieve data from outside sources, and our cartridge is no different. Today, we are going to add a random dad joke below our magic gif because, well, nothing captures the essence of magic like a good dad joke, does it?

Creating a Service

The Services Framework helps us manage calls to external web services and analyze their performance. It is a site-wide setting and is accessible from the Administration section of the Business Manager. …

Johnny Tordgeman

Full stack Software Engineer @PerimeterX, DIY home automation enthusiast, Gamer at heart!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store