Tech Lead

TillväxtverketTech Lead

August 2023 to Present

I joined the team at Tillväxtverket to help launch the new version of the Verksamt website. The site provides information and services from several Swedish authorities, with the purpose of helping those who are starting or running a business.

The public-facing parts of the website, which are the ones I've been mostly involved in, is a Nuxt application at its core with a number of Nuxt modules mounted that contains the logic for the different parts of the site. The logged in parts are a traditional Vue.js SPA. The site is multilingual and uses i18n for translations.

Implementing Elasticsearch

Since it's a large site with a mix of editorial content, permits for different authorities and a lot of different services, the search functionality is a crucial part of the site.

My first task was to build this search functionality which consists of a frontend search module that communicates with a backend Elasticsearch cluster.

The search implementation is used in both the Nuxt application and in the Vue.js SPA, thus I built it as a Nuxt module as well as a Vue.js plugin while sharing the logic between them.

The search logic itself lives in a backend-for-frontend built with NestJS, which talks to Elasticsearch so the frontend doesn't have to.

It was important that the search implementation was accessible, that it would be easy to maintain and flexible enough for a lot of different content types. I'm quite happy with how it turned out.

Now I'm extending it with hybrid search, combining classic keyword matching with semantic search. The embeddings come from multilingual-e5-small, an open, MIT-licensed model developed by researchers at Microsoft, which Elastic provides as part of the search platform we already use. That way visitors can find the right answer even when they don't use the exact words the authorities do.

Moving to micro-frontends

As the site grew, having every part of it mounted as a Nuxt module in the same application made releases slow and tightly coupled. I was involved in discussing and planning a new architecture, where features are moved out into standalone Vue apps, built as micro-frontends with Module Federation and loaded by a shell app.

Since then I've built a number of those apps, and each of them can now be released on its own schedule.

Improving content management

The editorial content comes from Drupal. One thing I noticed when working with the editorial pages was that although the content was served from an API by a headless CMS, there were still parts that behaved like a traditional CMS.

To give developers a better experience and to improve the site performance, I built a parser that converts the traditional CMS content into a structured content model.

This makes it possible to decouple formatting from the CMS and ensure that developers can decide exactly what to do with the content and how it should be displayed.

2 second reduction in request times

Unfortunately, the GraphQL API of the CMS was not very well implemented and lacked a working GQL schema. Together with the backend developers, we made sure that the schema was complete and available to the frontend.

The frontend was also sending POST requests, which are not cacheable, to the GQL API. We changed this to GET requests and added a caching layer in the backend.

After this we went ahead and enabled Automatic Persisted Queries, APQ, to make the queries smaller, cacheable and reusable. On the frontend, I extracted the query logic from the Nuxt application into a shared, fully typed utility library.

Paired with a new, site-wide GQL client built on urql that takes care of local caching and reuse of queries, this resulted in an overall 2 second reduction in request times.

A graph showing the request times before and after the GQL improvements
A graph showing the request times before and after the GQL improvements (release at the vertical lines)

Automating vulnerability management

Verksamt is run by 17 government agencies together, and keeping dependencies free of known vulnerabilities is a shared responsibility. Besides running Renovate, I built an automated security workflow in GitLab CI/CD.

Custom scripts use the GitLab API to collect the CVEs listed on GitLab's security dashboard and in the vulnerability findings on merge requests. The workflow then opens merge requests that patch the affected packages with overrides in our pnpm workspace. As a result, Tillväxtverket is now best in class at vulnerability management among the agencies behind the site.

Accessibility and quality

As a public sector website, Verksamt has to meet the accessibility requirements in WCAG and EN 301 549. I usually test new features myself with VoiceOver and the accessibility tools in Chrome before they ship.

Unit and component tests are written in Vitest, end-to-end tests in Playwright, and we use k6 for load testing.

My role

I was initially contracted as a Frontend Developer but got promoted to Tech Lead after a few months. I'm now responsible for the frontend team and heavily involved in the technical and architectural decisions.

Much of my work is acting as technical advisor to the product owners and the architect, taking part in planning and helping turn ideas into something we can build. I've also set up the coding standards and shared linting rules used across all services, and I work a bit with the Dockerfiles and Helm charts that deploy them to OpenShift.

Going forward

Usually I try to make a little summary of what I've done and what I've learned, but since this is my current contract I'll save that for when I'm done. We have a lot of exciting things planned and I'm looking forward to see them all come to life!

Technologies

Nuxt
NestJS
Elasticsearch
Accessibility
Tech leadership
TypeScript
Nuxt modules
Vue.js
Pinia
i18n
Vite
Module Federation
Micro-frontends
Node.js
REST
GraphQL
urql
Drupal
Content modeling
Structured data
Semantic search
Vector search
WCAG 2.1 AA / EN 301 549
Vitest
Playwright
k6
GitLab CI/CD
Renovate
pnpm workspaces
Vulnerability management
Docker
OpenShift
Kubernetes
Helm
Grafana
Matomo
Web architecture
CI/CD
Git
Jira
Testing Library
Monorepo
Server-side rendering (SSR)
Backend for frontend (BFF)
Responsive design
Agile (Scrum, Kanban)
Vue 3
Composition API

Selected WorksOther companies I've had the pleasure of working with