Inspiration
In GR Cup endurance racing, pit strategy is the difference between podium and pack. Teams currently rely on static fuel calculators and gut instinct. But with 140M telemetry points sitting unused, we saw an opportunity:
Could we build a real-time Monte Carlo engine that simulates thousands of race scenarios to find the optimal pit window—before the race engineer even asks?
Traditional tools tell you when to pit based on fuel. We tell you when to pit to win.
What it does
How we built it
GR Strat SIM is a full-stack data application built with a focus on performance and real-world analytics. The architecture consists of three main components:
High-Performance Data Pipeline: We built a custom data ingestion tool in Rust to process and load the massive 216M+ row telemetry dataset into PostgreSQL. This pipeline leverages parallelism to achieve ingestion speeds over 13,000 rows per second, a 5-10x improvement over a comparable Node.js script.
Backend API & Simulation Engine: The backend is a lightweight, high-performance API built using Bun and the Hono web framework. The core of the project is a Monte Carlo simulation engine written in TypeScript that models tire degradation, fuel consumption, and track position to predict optimal pit strategies. We used the Drizzle ORM for type-safe database queries.
Frontend Dashboard: The user interface is a modern React application built with Vite and styled with Tailwind CSS and shadcn/ui. It provides intuitive controls for running simulations and visualizes complex results and probability distributions using Recharts.
Challenges we ran into
Data Scale: Our biggest challenge was the sheer scale of the dataset over 200 million rows of time-series telemetry. Ingesting and querying this data efficiently was a major hurdle. We overcame this by building a dedicated Rust application for data processing, which was significantly faster than using a scripting language.
- Query Performance: Even with proper indexing, performing aggregation queries on the 200M+ row telemetry_raw table was slow, leading to server timeouts. This forced us to learn about query optimization at scale and configure our server environment to handle long-running, complex analytical queries without failing.
- Realistic Simulation: Building a Monte Carlo engine that accurately reflects real-world racing is incredibly complex. We had to create physics models for tire wear, fuel weight penalties, and driver variability from scratch, and then validate these models against actual race results to ensure their accuracy.
Accomplishments that we're proud of
- Real-World Validation: Our proudest accomplishment is achieving 85% accuracy in predicting the optimal pit lap within a ±2 lap window when compared against actual results from all 14 GR Cup races. This proves our simulator is not just a theoretical exercise, but a tool that generates actionable, real-world insights.
Running backend locally to the internet: Cost is a major challenge, our database contains 40gb of data thanks to the telemetry, but really plans online wouldn't have been the best since it for now is just temporary, we learnt how to set up Cloudflare tunnels, recommend anyone should do it, it's really simple, and yes the domain is the free ones granted by the GitHub student pack
Sub-3-Second Simulations: We successfully ran 10,000+ unique Monte Carlo simulations, each with complex physics modeling, in under 3 seconds.
30x Performance Boost via Caching: We implemented a SHA-256 hashing and caching layer for simulation results. This allows identical simulation requests to be served from the cache in ~80 milliseconds, a 30x speedup over the initial ~4-minute query time for some scenarios. (It's because of hardware constraints 4gb ram )
Mastering Data Ingestion: Building a Rust pipeline that could process and insert over 13,000 rows per second into our database was a massive technical victory and a huge learning experience.
What we learned
The Right Tool for the Job: We learned that for performance-critical tasks like data ingestion at scale, choosing a language like Rust over a general-purpose scripting language can be the difference between a workable solution and a failed one.
The Power of Caching: In a data-heavy application, intelligent caching is not an afterthought—it's a core feature. Our caching layer dramatically improved the user experience and system efficiency.
Databases are more than just storage: We gained a deep appreciation for advanced database features like indexing, query planning, and performance tuning when working with massive datasets.
What's next for GR Strat SIM
Driver Performance Analysis: Our immediate next step is to build out the driver coaching feature. This will go beyond when to pit and tell drivers how to be faster by comparing their telemetry traces against the session's optimal lap, highlighting specific corners where time is being lost. Its already there to be honest but the hardware constraints wouldn't even let us see the data or load up the dropdown and the server kept timing out, so we left it there, we'll hopefully actually see what it can do in the near future.
Live Telemetry Integration: We plan to evolve the system from analyzing historical data to ingesting a live telemetry feed, providing real-time strategic insights to a team on the pit wall during a race.
Advanced Physics Models: We aim to incorporate more variables into the simulation engine, such as weather data (track temperature, humidity), different tire compounds, and more granular data on brake wear to further improve prediction accuracy.
Built With
- bun
- docker
- hono
- postgresql
- three.js
- vite
Log in or sign up for Devpost to join the conversation.