Discovering Trucky Platform

Trucky was born as an experiment in mid 2017. It was simply an excercise to learn React Native, a popular mobile development language created by Facebook based on Javascript and with the simplicity to write once and deploy the same code on Android and iOS.

First version was published on Play Store in May 2017 and on Apple Store some months after. At that time, the Trucky API server was based on a free Heroku node. Lately, adding a real API layer, was moved to a virtual server with limited resources, then on another virtual server with more resources and finally on a dedicated server with SSD and a good amount of resources.

Today i will explain how the Trucky Platform works, with some deep details and showing some numbers, maybe it’s interesting only for more technical people but everyone like numbers and graphs 😀

Some fancy numbers

Trucky is now used worldwide by thousands of users every day on many platforms.

The Android app has recently reached 14k active devices, the iOS one follow with 8k active devices.

TruckyBot for Discord is proudly serving 3751 guilds and 149k users. The Twitch counterpart is used by 224 streamers.

The Overlay has passed the 8k downloads.

Since its introduction, users have sent more than 40k real time traffic alerts.

The nicest thing of managing a worlwide used platform, give access to bigdata, it’s really nice see those bubbles “pulse” every second.

Data provided from Google Analytics

Cloudflare edge statistics

Cloudflare is a great platform and a great help with DNS and to control traffic with its firewall rules.

Above all, shows great statistics how people interact with the platform. March 2020 showed an increment of 12% in traffic, probably due to lockdowns for COVID-19 pandemic, people started to use Trucky more and more.

30 Days Cloudflare traffic


24 Hours Cloudflare traffic

How Trucky works

Basically, open the app, use the Discord Bot, or the Overlay, and receive datas, realtime updates collected and aggregated from multiple sources. But how does it really work?

The platform stack, for the application part, is Node.js based. The frontend is an NGinx proxying traffic towards internal applications, both for HTTP and websocket connections. The traffic is handled by a clusterized Express app to share traffic and load on mulitple nodes.

When a call hit the API, based on which data is requested, Redis handles the first line to serve quickly the cached data without having to go on remote services like TruckersMP or Steam. As the data is retrieved, part of it is saved locally on a MongoDB database for backend processing.

Every object in cache has it’s own sliding expiration so, based of type of data contained, it expires alongside other related data to have always the freshest information possible when requested from the user.

MongoDB is used as a “relational No-SQL” database, thanks to Mongoose, data inside collections are related each other at application level but maintaining the No-SQL paradigm at rest.

Another cache is maintained at application level, some data is cached directly in app process to improve perfomances on heavy load calls like location resolution or traffic management.

Backend magic

Some work is done at backend level, behind the curtain of the frontend chaos, there are scheduled tasks launched by crontabs to collect data from external services and persist in Mongo, already calculated and normalized.

Futhermore, some tasks, for example, are in charge to send push notifications to users (friends online, new news published…) or calculate traffic.

Trucky apps

TruckyBot for Discord is based on Node.js and Klasa and TruckyBot for Twitch is a Node.js app based on tmi.js and and twitch-commando (https://github.com/shardick/twitch-commando).

Trucky Web, the web version of the mobile app, it is a React application.

The Overlay is one of the lastest additions to the Trucky applications’ landscape, it uses a mix of C++ plugin for Telemetry and React application served inside Overwolf, a great tool to bring web based apps inside games.

Trucky.Events is, instead, a Laravel+MySQL website.

Live Map and Traffic System

The live map is a little “diamond”. Although showed players are not Trucky based (but, hey, we haven’t got that data), it’s one of the most used tools from the community.

Behind it, there is the punctual work of the Trucky Service Team, at every map and DLC update, they are ready to map new areas, add countries, cities and points of interest.

The Map Editor

Other features like location resolution used widly from bots and VTRPC and traffic system, are based on live map data and GPS utilities.

Traffic is calculated using ETS2map data and some math and geolocation algorithm. Maybe it is not always precise and affordable, due to how we design areas (a future implementation is to use polygons instead of simple rectangles) but Trucky has traffic jams detections. How does it works? With a Clustering DBSCAN. The algorithm analize players position in area with relation to time and speed, if they are too near each other and with a low relative speed, well, there is a traffic jam!

12.2 – DBSCAN – Beginning with ML

Increasing load and traffic

As downloads are increasing, many people are using Trucky Apps’ and this also increased also the overall server load.

We are searching for new ways to let apps communicate without overwhelming the server but infrastructure has its limits, as RAM, CPU or Disk I/O.

Soon, some part of the platform will arrive to a breakpoint.


Enquire now

Give us a call or fill in the form below and we will contact you. We endeavor to answer all inquiries within 24 hours on business days.