Our blog

Page 1 of 3

  • Generating end-of-life static archives of CMS-based websites

    Author
    Prateek Rungta
    Published
    Event
    Dot All 2025
    Location & Date
    ·Lisbon, Portugal

    Most of our attention regarding websites is around creating new ones, but we cannot escape the reality of having to deal with retiring old or existing websites as well. After facing this scenario a few times at Miranj we built a tool to handle the end-of-life stage for websites. This tool attempts to crawl all publicly accessible URLs for a site and create a static archive, much like the Internet Archive’s Wayback Machine. It has a few built-in smarts to detect and capture the many different ways assets are referenced in modern markup. It generates a folder structure that retains clean URLs, as well as intelligently handles URLs with query parameters.

    While the tool is not yet publicly available, we have been using it internally and some of the static archives generated by the tool of erstwhile CMS-based sites have been running smoothly in the wild for years.

    email hidden; JavaScript is required if you’re interested in archiving a content-heavy site of your own. Always happy to help or exchange ideas around digital archival1.

  • Demystifying the Craft CMS API

    Author
    Prateek Rungta
    Published
    Event
    Dot All 2023
    Location & Date
    ·Barcelona, Spain

    The Pixel & Tonic team were kind enough to invite me back on the Dot All stage1 to share some of our learnings with a room full of people in Barcelona. This time, I spoke about leveraging some of the power and tools that Craft already ships with — filters, functions, collections, helpers, services, caches, and much more — right from within Twig.

    The talk covers three broad areas:

    • We start by looking at the benefits of leveraging Craft (and Yii) APIs in general and the ways in which that makes us more efficient developers, and our code more reliable and performant.

    • Having established the why, we move on to examining commonly occurring scenarios during the development lifecycle and identifying patterns where we can start falling back to and integrating more of the API.

    • In the third and final part, we look at ways to identify the appropriate Twig filters and functions, or Craft helpers, services, and components that can be plugged in these scenarios.

    Demystifying the Craft API for Twig Developers by Prateek Rungta on Vimeo.

    In order to demonstrate some of these more richly with relatable examples, I created a bare-bones site for a fictional Dot All Music Festival. The code for this site is up on GitHub.

    Prateek speaking at Dot All 2023 Audience listing to the "Demystifying the Craft CMS API" talk at  Dot All 2023

    Photographs from the event. 

    This talk is based upon my own developer journey using Craft CMS over the years. I also drew from the experience of witnessing first-hand the individual development journeys of my teammates, and spotting common patterns between their paths and my own.

    I hope this helps you discover and use more of the powerful tools available to use inside a Craft CMS Twig template file. email hidden; JavaScript is required if you found any of the techniques useful or discovered something new that you could use.


    1. We have previously delivered talks on Fortifying Craft CMS for High Traffic at Dot All 2019 in Montréal, and Modular Architecture for Building Content Websites at Dot All 2018 in Berlin. ↩︎

  • Micro-caching in Nginx for High Performance

    Author
    Prateek Rungta
    Published
    Event
    Bangalore Site Speed 6th Edition
    Location & Date
    ·Online

    In the vast, multi-layered subject area of web performance, server response time is an important metric. From a CMS standpoint, however, it is one of the most significant. Best practise recommends a 200ms or lower time-to-first-byte. For medium to high-traffic sites, server load is another vital statistic.

    We were invited to talk about our learnings from optimising and hosting high-traffic sites such as Guiding Tech at the sixth edition of the Bangalore Site Speed Meetup.

    Bangalore Site Speed Meetup 6th Event on YouTube.

    In this talk we go over caching as a broad performance strategy, before dive into micro-caching as a specific approach to handle loads of 10 to 100 concurrent requests per second. We cover the filter, storage, and invalidation implementations1 of this caching strategy in Nginx. The talk concludes by comparing metrics of our caching strategy against a target of achieving sub-200ms TTFB response times for all visitors.

    This talk is a newer revision of the Fortifying Craft CMS for High Traffic talk from 20192 which, as it says on the tin, was specifically tailored for Craft CMS based workflows. In this edition we focus on just micro-caching as a strategy and look at it independent of any specific CMS running at the application layer.


    1. The sample Nginx config file from this talk is available on GitHub. ↩︎

    2. Delivered at Dot All 2019 in Montréal, Canada↩︎

  • All our plugins now support Craft CMS 5

    Author
    Prateek Rungta
    Published

    Craft CMS continues to be an indispensable part of our toolbox for building websites here at Miranj. It has gotten even better earlier this year when a host of new content modelling options were added with the Craft 5 release and we’re loving the extra flexibility in creating our data models.

    Aside from using Craft to power our projects, Miranj has also released a few utilitarian Craft plugins over the years. We were quick to update most of them with Craft 5 support immediately after the public release, and we have finally gotten around to updating the last (and most complex) plugin as well:

    In addition to these plugins, we also maintain a public Craft CMS starter project which has also been upgraded with Craft 5 support. Hope you find these useful!

  • Our plugins are Craft CMS 4 ready

    Author
    Prateek Rungta
    Published

    We make no secret of our love for Craft CMS here at Miranj. While we rarely prize a tool or tech over the problem it helps us solve, we greatly value the efficiency of a good tool, and Craft CMS continues to shine on that front. One such aspect is the ease with which one can tap into and extend the core functionality of the CMS. There’s a thriving community of plugins that enhance, boost, and add to the already elaborate set of core features offered by Craft. While we depend on a fair few of them for most of our projects, we have also released some plugins of our own:

    And as of this week, all five of our plugins have been updated to work with the latest release of Craft 4. Some of these plugins (Router, Obfuscator and Cryptographer) date back all the way to 2015 and Craft 2, and we are glad to continue supporting them and making them available for the community to use on their projects as well.

  • Critical CSS for CMS-based, Server-rendered Websites

    Author
    Prateek Rungta
    Published
    Event
    CSS loading and Critical CSS
    Location & Date
    ·Online

    Our sites have undeniably grown in complexity over the years. Each year we send more data, show bigger images and process lots more JavaScript per page than the year before, growing steadily for at least the last decade and outpacing the gains we’re making in computing and network capacity. The bloating of the web hasn’t gone unnoticed though — sites take their own sweet time to load, eat through data allowances, drain out the battery and bring the computer down to a crawl. Thankfully, the web community realises and acknowledges the problem. Performance is no longer an afterthought. Yet it is no easy band-aid either. Performance is impacted by a multitude of factors, so achieving success in this domain requires a multitude of solutions.

    The folks at Hasgeek recently put together an event focused on Critical CSS (under the JSFoo(!) banner) and we got on stage to share how we approach and implement this technique on sites we build at Miranj.

    Critical CSS for CMS-based, Server-rendered Websites on Vimeo.

    We look at an end-to-end solution that we have evolved and battle tested over the years. Starting with a primer on Critical CSS and its place in the larger performance pie, I go over a 4‑part strategy to introduce Critical CSS generation and delivery to a CMS-based website. We look at some performance metrics impacted by Critical CSS, cover identifying target templates and page selection, leveraging the Critical library to extract critical CSS, automating the extraction process using Gulp, reducing response size for repeat visitors, and getting this entire system to work with the caching layer(s) that you may already be using.

  • Fortifying Craft CMS for High Traffic

    Author
    Prateek Rungta
    Published
    Event
    Dot All 2019
    Location & Date
    ·Montréal, Canada

    In the vast, multi-layered subject area of web performance, server response time is an important metric. From a CMS standpoint however, it is one of the most significant. Best practise recommends a 200ms or lower time-to-first-byte (TTFB). That is the time in which a CMS has to figure out what to do with the request, parse templates, query the database, render the HTML, capture it all and send it back as the response.

    Craft CMS — our preferred CMS for content-heavy websites here at Miranj — is quite fast out of the box, but as our pages and content models grow in complexity so does the server response time. Add traffic to that mix and it can quickly lead to poor TTFBs and slow overall experience.

    In this talk we go through a multi-tiered caching strategy using Craft and Nginx that enables a single VPS to consistently deliver sub-200ms response times, even while handling loads of 10 to 100 concurrent requests per second. It covers our learnings from optimising a low-powered server to handle millions of visitors each month on the Guiding Tech website project. We achieve this by caching the website at two places — at the web server level using Nginx’s FastCGI micro-caching, and at the CMS level using flag-based template caches in Craft CMS. We also factor in real-world edge cases such as bypassing the cache, delivering variations to different visitors, etc, that are necessary to account for in a robust, production-ready system.

    Fortifying Craft for High Traffic with Prateek Rungta from Craft CMS on Vimeo.

    We also put out a sample Nginx config for the micro-caching strategy discussed in the slides.


    This talk was prepared for and delivered at Dot All 2019 in Montréal, Canada. This was my first time speaking at a conference outside India, but any nervousness I carried on stage was quickly dispelled by the warm engagement and wonderful conversations with the Craft community.

    Prateek speaking at Dot All 2019 Souvik and Prateek share a laugh with Ben Parizek of Barrel Strength Design

    Photographs courtesy Pixel & Tonic

    I’m extremely grateful to the folks at Pixel & Tonic for extending me an opportunity to present to an international audience, and for placing their trust in us a second time after Souvik’s talk the previous year at Dot All 2018, Berlin.

    I email hidden; JavaScript is required about your mileage from adopting any of the caching strategies mentioned in the talk, or any alternate approaches you have implemented to optimise Craft CMS for heavy loads and high traffic.