Building Mood Cards: a 380-card app in one HTML file
When you feel a bit off, a vague plan to "do something about it" rarely helps. A small, specific prompt does: stretch for a minute, write one sentence, step outside. Physical card decks are good at delivering these prompts, but a tin holds only one deck, and you have to own it. I built Mood Cards, a web recreation of that idea, so that picking a deck, picking a colour and flipping a card takes a few seconds in any browser.
Why I built it
The project is inspired by The Mood Club and its physical Mood Cards. Each card has a title on the front and a DO / TIP / <verb> activity on the back, colour-coded by theme. I wanted to see how much of that feel I could carry into a web page: the colour choice, the flip, and the sense of drawing from a stack. It is a fan-made, non-commercial recreation for personal use, and I credit the original product line in the repo.
What it does
The app has 19 decks and 380 cards in total, 20 per deck. Three decks (for me, for work and for me and you) are recreated from the real products, using genuine card titles and instructional text taken from product photography where it was available. The other sixteen, including Sleep, Calm, Family, Friends, Students, Money, Fitness, Career Change and Grief, are originally written by me in the same DO / TIP / <verb> format and tone.
The flow has three steps:
- Choose a deck. Six core decks appear on the landing page, and a "more categories" screen holds the other thirteen.
- Pick a colour on an animated rainbow screen, or hit "Surprise me". The swatches are derived from each card's own colour.
- Read and flip the card. The front shows the title and category; the back shows the activity. Once a card is chosen, the background switches to a bold matching colour.
- Single-file apps go further than expected. With data in one object and styling driven by CSS variables, 380 cards and several screens stayed manageable without a framework.
- Offline support follows from the architecture. When content ships inside the page, a service worker only has to cache the shell. There is no API to mirror.
- Check what you are uploading. My first deploy uploaded the whole project folder, including a local subfolder of personal reference photos, and briefly exposed them at predictable URLs. I fixed it by adding a
.vercelignorethat excludes that folder and.DS_Store, redeploying, and deleting the old deployment. If you deploy a folder rather than a build output, add an ignore file before the first deploy. - Sketch the screen flow first. The "remember where I came from" behaviour is easy to forget until you draw the transitions.
Around that core there are a few extras: "Draw a card" for a random pick, favourites saved in your browser, and a "Card of the day" on the landing screen with an optional daily reminder (a highlight, plus a notification while the tab is open). It is also installable via Add to Home Screen, and it works offline after the first visit.
How it works
The architecture is deliberately small: one static index.html with inline CSS and JavaScript. There is no backend, no build step and no framework. The only external dependency is a Google Fonts import (Fredoka and Nunito).
Data as one object
All 380 cards live in a single JavaScript DECKS object. Each card has a title, a category, a colour and its DO / TIP / verb lines. The rendering code reads from this object and nothing else, so adding a deck means adding data, not writing new UI code.
Theming with CSS custom properties
Each card is themed by setting CSS custom properties from JavaScript. The script toggles classes and sets variables, and the stylesheet handles the rest: layout, the 3D flip, the stacked-deck visual and the background change. That keeps colour logic in one place. The picker swatches come from the cards' own colours, so a new card with a new colour shows up in the picker without extra work.
A small state machine for screens
The screens form a simple flow: Landing, More categories, Picker and Card. The Picker remembers where you came from, so "decks" returns you to the right list. From the Card screen, "all colours" goes back to the Picker, and flipping or drawing keeps you on the Card. Writing this out as a state diagram before coding made the back-navigation rules easy to get right.
Two scroll behaviours on purpose
The card and colour-picker screens lock to a single viewport so they feel like an app. The deck-browsing screens scroll normally, because that list is meant to grow as I add decks. Choosing per screen, rather than one global rule, avoids a cramped layout later.
Offline and installable
Because every card is already in the page, offline support is cheap. A manifest.webmanifest provides the install metadata (name, colours, icons), and a small service worker (sw.js) caches the app shell. After the first visit, the app loads without a network.
Deployment
The site is deployed to Vercel as a static site. I do not use CI/CD or a GitHub integration. The repo is for source control and history, and I push deploys manually from the Vercel CLI with vercel deploy --prod. For a single-file app, that is all the pipeline it needs.
What I learned
Try it
The live app is at https://moodcards.iramesh.com. To run it locally there is nothing to install: open index.html in a browser, or serve the folder with npx serve ..
Conclusion
Mood Cards is a small project, and its size is the point: one HTML file, a data object, some CSS variables and a service worker are enough for a complete, installable, offline-capable app. If you are building something content-driven, consider whether you need more than that before reaching for a framework or a backend.