· 3 min read

Advent of Code Automation for Javascript/Typescript

Setup the files, download the inputs, submit the solution and more!

Setup the files, download the inputs, submit the solution and more!

December means Advent of Code for many of us 🎄 (or at least, the first few days of December)

These funny challenges require a few steps every day, from setting up the new empty solution files to manually downloading the inputs and submitting the solution.

What if the manual/repetitive steps could be automated? 🤔 It’s a game made by developers for developers (developers developers) and depending on your language there are some so-called runners to give some automation 🤖


This one I found last year (and I’m using again this year) is designed if you’re playing the challenge with both Javascript or Typescript.

This is the original repo: https://github.com/caderek/aocrunner

Tool features

I mean… what do you even need to automate? The game isn’t just getting the input and running a js/ts file?

Yeah, but we love automating things, so here’s what this tool does:

  • Define a common template to handle the input file and both solutions
  • Create the folder with the files you need for the challenge
  • Download the input file
  • Run the solution locally
  • Submit the solution

You can also quickly run some custom tests and other nice to have features.

I recorded a demo where I show it in action, you can find it here or on YouTube:

Here below you can find all the main steps anyway, in case you don’t want to watch the video :)

How to use it

Basically a command lets you create the initial project with some other handy features in the scripts section of the package.json file.


As written in the README, you can run a command that will create a folder containing all the files you need for the challenge:

npx aocrunner init

A simple CLI installer will ask you for some questions (like the year, js/ts, folder name, etc) and then it will create the folder with the files.

All inputs are different for each user, which means you need somehow to authenticate to the website to download the input file.

Everything happens under the hood, all you need to do is to feed the tool with your session cookie, which you can find in the browser from the “Application” tab of the dev tools.

Put it inside the .env file in the root of the project and that’s it! (In the video I show it step by step)

Play a day!

To run the challenges for a day, you can use the run command:

npm run start 1

If it’s the first time you run it, it will download the input file and create the js/ts file to run the solution in a new folder.

Otherwise, it will just run & watch the solution to evaluate the result every time you save the file.

Submit the solution

While you’re running it with the run command, you can also submit the solution by pressing s in the terminal.


There are also some other features I’d recommend you to try, but one thing it’s also worth mentioning is that unfortunately the original project seems inactive.

It works fine so I’m happy to talk about it, but if you’re using other runners or you made one, feel free to share it in the comments below!

Happy Advent of Code! 🎄

About the author

Hello! My name is Leonardo and as you might have noticed, I like to talk about Web Development and Open Source!

I use GitHub every day and my favourite editor is Visual Studio Code... this might influence a little bit my conent! :D

If you like what I do, you should have a look at my YouTube Channel!

You might also like
Back to Blog