DEV Community

Christoph Dieck
Christoph Dieck

Posted on

I Built a Lottery Simulator That Shows You Losing Money for 1000 Years

What I built

howtolosemoneyfast.com is a satirical lottery analysis tool. You can simulate thousands of EuroJackpot or Lotto 6aus49 draws, check your numbers against every real historical draw (back to 1955 for 6aus49), and watch a chart of your net worth go relentlessly downward.

The entire thing runs client-side. No backend, no data collection. Your numbers never leave your browser.

Why

I wanted to make the abstract concept of "1 in 139 million" feel visceral. Reading that your odds are bad is one thing. Watching yourself lose 2,600 draws in a row while a live chart tracks your spending against an ETF that keeps growing is something else entirely.

The name is the thesis. If you want to lose money fast, buying lottery tickets is a reliable method.

Tech stack

  • Astro for the static site generation (multilingual: EN, DE, ES)
  • TypeScript for all simulation logic
  • Tailwind CSS for styling
  • Chart.js for the real-time net profit visualization
  • pako for decompressing embedded historical draw data

No frameworks on the client side. All interactive components are vanilla TypeScript with Astro islands. The simulator runs draw loops without blocking the main thread using chunked processing.

How the simulator works

The lottery simulator lets you configure:

  • Fixed or random number strategy
  • Play frequency (1x or 2x per week)
  • Duration (1 year to 1000 years, or "until billionaire" which spoiler: takes a while)
  • Number of tickets per draw
  • Ticket price

It then runs the draws in batches, updates a live chart showing your cumulative net profit over time, and tracks stats like ROI, win rate, longest dry spell, and prize breakdown by tier.

There is also a "Until Billionaire" mode that just keeps going until your cumulative winnings hit one billion. On EuroJackpot odds, that takes a very long time. My browser fan usually starts spinning before the simulation finishes.

The number checker

The other main feature lets you enter your personal lottery numbers and checks them against every single real historical draw. EuroJackpot since 2012, Lotto 6aus49 since 1955. It shows you exactly which prizes you would have won (or, much more likely, wouldn't have).

Historical draw data is fetched at build time, compressed with pako, and shipped as embedded TypeScript arrays. The site rebuilds on a schedule through a Gitea Actions CI pipeline after each draw day.

Data pipeline

Draw day (Tuesday/Friday) 
  → Gitea Actions workflow triggers
  → TypeScript scripts download latest results from official APIs
  → Generate embedded data modules
  → Astro build
  → Deploy to Docker volume via CI
  → Served through Nginx behind Cloudflare Tunnel
Enter fullscreen mode Exit fullscreen mode

The whole thing is self-hosted. Proxmox VM, Docker stack managed through Portainer, Traefik as reverse proxy, Cloudflare Tunnel for public access.

Things I learned building this

Simulating millions of draws is CPU-intensive. The naive approach of running a for-loop for 52,000 draws (1000 years, once per week) blocks the main thread for seconds. I chunk the simulation into batches and yield back to the browser between them. Chart updates happen every N draws, not every single one.

Historical lottery data is surprisingly hard to get. There is no single clean API. I ended up writing custom downloaders that parse different source formats and normalize them into a consistent JSON structure.

Multilingual sites in Astro are pleasant to build. The i18n setup uses a simple key-value approach with runtime string replacement. Each page exists in three languages with localized URLs.

Nobody believes the math until they see the chart. I showed people the raw statistics first. They nodded. Then I showed them the simulator running for 50 years. That is when the message lands.

Try it

Set the simulator to 50 years, hit start, and watch the chart. Then maybe reconsider that weekly ticket.

Top comments (3)

Collapse
 
amitfeldman profile image
Amit Feldman

The ETF-comparison chart is the killer feature here — "watch your net worth go relentlessly downward" next to a line that keeps growing is a better financial education than a thousand odds tables.

Quick public check of the site while reading (headers + served HTML only). Four things, all verified from the outside:

  1. The apex domain doesn't exist in DNS. howtolosemoneyfast.com has no A/AAAA record at all (NODATA at both 1.1.1.1 and 8.8.8.8) — only the www hostname resolves. Every bare-domain type-in, every link someone writes as "howtolosemoneyfast.com" without www, dies at resolution. Even forcing it, Cloudflare returns a 530, so it also needs the apex added as a custom domain (or a Redirect Rule apex -> www) on your side, not just records.

  2. HSTS and Content-Security-Policy are both missing. Since Cloudflare is already in front, HSTS is close to a toggle (SSL/TLS -> Edge Certificates), and CSP + the other headers are one Transform Rule (or a _headers file if you're on Pages). For a no-backend, no-data app a tight CSP is cheap: default-src 'self' gets you most of it.

  3. The served HTML is an empty shell — view-source on the homepage returns "JavaScript required" as the only H1 and ~1KB of visible text (mostly the no-JS notice and legal links). Title and meta description are there, so link unfurls work, but crawlers that don't execute JS and no-JS visitors get nothing. That surprised me given the Astro SSG mention — worth checking whether the prerendered output actually shipped, or whether an island quietly turned the whole page client-side. With three locales (EN/DE/ES), that's 3x the indexable surface riding on it.

  4. Minor: X-Frame-Options and Permissions-Policy are unset too — same Transform Rule fixes both.

Happy to re-run the check free once any of it lands — the before/after deltas are satisfying.

Collapse
 
cdieck88 profile image
Christoph Dieck

Hey and thanks for the awesome audit! I just deployed a patch covering all your findings, so everything should be fully sorted now.

Some comments may only be visible to logged-in visitors. Sign in to view all comments.