Building a Portfolio on Cloudflare Workers with Live Stats
A portfolio page has a quiet problem: it goes stale. The numbers I would put on it, such as YouTube views, model downloads and GitHub stars, change constantly, and the moment I paste them into HTML they are out of date. I also wanted the site to do a bit more than list projects, so I added a chat assistant and spoken project narration. This article walks through how I built iramesh.com and the technical choices behind it, several of which are reusable on other small sites.
Why I built it
I work as a software architect and build web apps, games, AI tools and Android apps on the side. A static page of links does not show any of that well. I wanted one place that presents my background (full stack development, team lead work, ETL and BI), lists selected projects, and shows my public output with real numbers that update themselves.
I also wanted to keep the site cheap to run and easy to change. That pushed me toward no framework, no build step, and a single deploy target.
What it does
The site is a single page with these sections:
- About and Experience, covering my work history from 2013 to the present.
- Skills: programming languages, AI and automation, frameworks, cloud and databases.
- Projects: Hubble Solar Platform, Pipedrive Analytics, BudBasic POS and Liquid UI Portal.
- Awards.
- Live: real-time counters from YouTube, Hugging Face, GitHub and my podcast.
- Contact: email and social links.
On top of that there are two extras. An assistant called iR Assistant answers questions through a chat widget. And in the Work section, which is styled as a record rack, picking a record reads the project aloud.
How it works
Frontend: no framework, no build
The page is vanilla HTML5, CSS3 and JavaScript in public/index.html. There is nothing to compile. For local work I can open the file in a browser, or run npx wrangler dev to get the Worker behaviour as well. For a single-page personal site, removing the build step removes a whole category of breakage.
Hosting: one Cloudflare Worker
The site runs on Cloudflare Workers. src/worker.js serves the static files from public/ and also handles API routes. Keeping static assets and the small amount of dynamic logic in one deployment means one config file (wrangler.jsonc) and one place to look when something is wrong.
Deployment is automatic. Every push to main triggers Cloudflare Workers Builds, which runs wrangler deploy, and the live site updates within about 30 seconds. A manual npx wrangler deploy is there if I need it.
Live counters at /api/stats
The Worker aggregates several sources behind one endpoint, GET /api/stats:
- YouTube, for two channels (iRStudiosMedia and @ikppramesh)
- Hugging Face model downloads
- GitHub repos, stars and release downloads
- The podcast RSS feed
Three decisions here are worth copying:
- Edge caching for 15 minutes. Visitors never hit the upstream APIs directly, so the page is fast and I stay inside rate limits.
- Each source fails independently. If one service is down, the others still report. One broken API should not blank the whole section.
- A built-in snapshot as fallback. If the endpoint fails, the page shows a stored set of numbers instead of empty boxes.
The endpoint works without any secrets. Two optional ones improve it: YOUTUBE_API_KEY uses the official YouTube Data API v3 instead of parsing the public channel page, and GITHUB_TOKEN raises the GitHub API limit above 60 requests per hour. Both are set with npx wrangler secret put, so they never live in the repository.
One detail I had to handle: YouTube Studio's lifetime views include removed and private videos, so they are higher than the public count. I configure that gap as studioOffset in src/worker.js so the number matches what I see in Studio.
iR Assistant at POST /api/chat
The chat widget never calls the model provider directly. It calls my Worker, which holds the OpenRouter key as a secret, so the key is never exposed to the browser. The Worker also:
- Loads the assistant's instructions from
public/assistant/system-prompt.txt. Editing that file changes what the assistant knows, with no code change. - Rate-limits per IP.
- Tries models one at a time: Nex N2.5 Mini (twice), then Gemini 2.5 Flash Lite, then GPT-4.1 nano, and finally IRx-1, but only if
IRX_ENDPOINTis set.
The fallback chain means a single provider outage or a failed response does not leave a visitor with an error. IRx-1 is optional and plugs in through any OpenAI-compatible endpoint (for example a Hugging Face Space running llama.cpp), configured with IRX_ENDPOINT and IRX_TOKEN. For local development the key goes in .dev.vars, which is git-ignored.
Narration with pre-recorded audio
When you pick a record in the Work section, the project is read aloud. I chose pre-recorded neural audio over live synthesis. The recordings are in public/audio/work/, generated with Kokoro-82M (voice af_heart, Apache-2.0 licence) by scripts/narrate.py.
The browser's built-in speech engine is the fallback, preferring US female voices. It kicks in when a recording is missing or when its text no longer matches the card. That match check matters: it stops the page from playing outdated audio after I edit a project description.
After editing a card I re-record with:
uv run --python 3.11 scripts/narrate.py
It needs uv and ffmpeg and only redoes changed cards. --all redoes everything and --voice af_bella switches voice.
What I learned
- A Worker is enough backend for a personal site. Static files plus a couple of API routes covers live data and a chat feature without servers to maintain.
- Design for partial failure. Independent sources, a cached response and a fallback snapshot mean the page always renders something sensible.
- Proxy anything that needs a secret. Routing chat through the Worker keeps the key server-side and gives me a natural place for rate limiting.
- Make optional things optional. The stats endpoint works with no secrets, and IRx-1 only joins the chain when configured. That keeps setup simple.
- Always have a fallback for generated media. Pre-recorded audio sounds better than browser speech, but a text-match check with a speech-engine fallback keeps it correct as content changes.
- Keep content in editable files. The assistant's prompt lives in a plain text file, so updating its knowledge is a one-file edit.
Try it
The site is live at https://iramesh.com. Scroll to the Live section to see the counters, open the chat widget to talk to iR Assistant, and pick a record in the Work section to hear a project narrated. If you have questions or feedback, you can reach me at hello@iramesh.com.
Conclusion
iramesh.com is deliberately small: a vanilla front end, one Cloudflare Worker, automatic deploys from main, and a few features that each degrade gracefully. The pattern of caching at the edge, isolating failures and keeping secrets in the Worker applies well beyond a portfolio, and it is the part I would reuse first on my next project.
Live: https://iramesh.com