Back to blog

We are merging our app and marketing site

Oct 26, 2022
Blog author

Alex Bjørlig

ab@21risk.com

The traditional architecture

Let's start with a bit of history. Before this change, 21RISK was deployed like many other web applications:

  • 21risk.com was hosting everything marketing-related.

  • app.21risk.com was hosting our web application.

The historical reason for this was straightforward. The web application was written in Angular , an application framework, and the marketing web page was built with WordPress. Angular felt like a good choice for building an enterprise web application, and WordPress was the default choice for building marketing web pages.

A better way to build web applications

It was challenging with Angular to build a performant application. We were missing features like server-side-rendering and static pre-rendering. To overcome this, we decided to adopt Sveltekit . This change was amazing, it was now easy to build an extremely performant website. And best of all, using the same tools for the web application and website, made it easy to knowledge share.

However, the web application was still a project isolated from the website. This raised a couple of frustrating things:

  • We could not use relative links to our documentation, because the documentation was hosted at the marketing website on a different domain. Very inconvenient when developing the documentation together with the code locally.

  • If we wanted to embed or illustrate features from our application, we had to use an advanced mono-repo setup to code-share widgets. This is especially inconvenient when the objective is to demonstrate software features.

  • Keeping the design and look-n-fell right was difficult because synchronization needed to be done between the two projects.

The solution

To solve the above problems, we now have only one Sveltekit project that contains both the web application and website. We use cookies for our session management, so if you visit the marketing website but are logged in we give you the opportunity to "change" to the web application.

To make everything "just work", we use Cloudflare page redirects to make sure users that have bookmarked app.21risk.com are correctly redirected to 21risk.com. In the coming time we are thrilled about the possibilities to empower the marketing website even more:

  • Adding statically rendered pages with risk models and checklists

  • "Embedded" parts from the web application, so people navigating the website can experience the look and feel of the software.

With this change we are also looking into partnering with a new cloud provider, to ensure the best possible performance for both website and application users. Stay tuned for more updates on this part later 😎