Hopp til hovedinnhold

Norway is known for its fjords, glaciers and cold winters. The latter is suboptimal for cyclists, which is why we ended up creating dundring.com; a free and open source in-browser training application created to control and track your training with a smart bike trainer ⚡️

This article will go through the magical story of how our hobby project dundring.com was made 🎅

Norwegian weather and cycling during the winter

Cycling during the winter in subzero temperatures and snow is something only a fraction of the Norwegian cyclists endure. Most of us take our cycling sessions indoors with a bike trainer, which can be thought of as a treadmill for bikes. However, working out indoors on a bike trainer can be monotonous and feels harder than riding outdoors, which may tempt you to join the ranks of the tough winter cyclists.

Fortunately, there are applications that strive to make this experience as bearable as possible, such as Zwift, the leading bike trainer software.

Zwift is a massively multiplayer online cycling and running physical training program that enables users to interact, train, and compete in a virtual world. - Wikipedia

Zwift has many great features, and it's really fun to see a 3D version of yourself cycling in the virtual world, especially when you are able to overtake lots of other virtual cyclists.

As we were using Zwift, we realized that we did not really use the killer features of Zwift; the massive living world, group rides and races. We were mostly using Zwift to control the pedaling resistance over time, and were not really looking at anything else than the real time numbers such as Watt, heart rate and elapsed time.

This sparked a question; why can't we create our own bike trainer app using Web Bluetooth?

Creating a minimum viable product

After experimenting with Web Bluetooth for reading heart rate data, the next step was being able to control the bike trainer. One thing was reading the power data, but actually being able to send commands to the device was not straight forward for someone new to Web Bluetooth.

Combining data from a heart rate monitor with power data from a bike trainer with some nice graphs, and some power controls, resulted in our first minimum viable product of dundring.com.

A preview of an ongoing workout on dundring.com
A preview of an ongoing workout on dundring.com

Workouts don't create themselves

The ability to create custom workouts is a fundamental feature of any cycling trainer app.

Every workout in dundring.com is built around ERG mode, a setting on smart trainers that automatically adjusts resistance to match your cadence, essentially turning the bike trainer into a "cycling treadmill".

The workout editor on dundring.com allows you to predefine the resistance for different stages of a workout. This feature is ideal for creating interval sessions with varying power intensity and for easier rides with consistent and low intensity.

Workout editor
Workout editor

As shown in the current interface of the workout editor, a workout is a sequence of time intervals, each with a targeted power output, measured in watts and percentages.

But what do these percentages represent?

They are calculated as a percentage of your Functional Threshold Power (FTP). FTP is essentially the average power you can sustain for one hour. In the cycling community, it's common to base power targets on this metric. Using percentages of FTP, rather than fixed numbers, makes the workouts adaptable and applicable to every cyclist. The workouts automatically adjust to the rider's current level by scaling based on their FTP. This is handy when sharing workouts with your friends, which dundring.com allows you to do.

In addition to the workout editor, dundring.com also offers a library of workouts you can use out of the box, or use as template for your own custom workouts.

You didn't workout if it isn't on Strava

In the cycling community, there's a popular saying: "If it's not on Strava, it didn't happen". Recognizing this, we've made it possible for users to upload their rides from dundring.com to Strava. Our current approach allows users to export and download their session data, which includes data about laps, heart rate, power, cadence and simulated gps points based on estimated speed and distance.

The speed and distance are estimated based on the rider's current power output, using approximations for factors like gravity, rolling resistance, and aerodynamic drag. For those interested in the specifics, the full formula is available here: Cycling Wattage Calculator.

A dundring workout uploaded to Strava
A dundring workout uploaded to Strava

Group sessions

One of the primary reasons people ride bikes is to enjoy group rides with friends in the sun. Even though the weather might not be on our side during the winter, it might still be nice to be able to ride together. This led us to implement a group session feature, allowing users to create a live group for others to join. Everyone in the group are able to see each other's live data.

Preview of an active group session
Preview of an active group session

Tech stack

For the nerds, dundring.com is written in TypeScript. The frontend is React using Chakra UI components, the backend is Node using Express and also Prisma as an ORM connected to a Postgres database. The project is structured as a monorepo using Yarn Workspaces with Turborepo 🤓

Where is dundring.com headed?

Our goal with dundring.com is to have an easy to use and lightweight application with all the necessary features needed to make the indoor cycling season alright. It also serves as a playground where we can explore new ways of indoor training, potentially making the winter a bit less unbearable for cyclists in colder parts of the world. ☃️

Try the app at dundring.com or check out the source code on GitHub! 🤠

If you want to contribute or have any questions, head over to the dundring.com Slack workspace 🤓

Did you like the post?

Feel free to share it with friends and colleagues