This content originally appeared on DEV Community and was authored by Shravan Bobade
MovieNest Gets a Mood Ring: Recommending Films with Weather, Time & Tears
So I was staring out my window one rainy night, thinking:
“Wouldn’t it be cool if my app felt the vibe and showed me a romantic thriller?”
And that’s how I spiraled into turning my chill movie app into a mood-sensing, AI-powered, vibe-aware recommender system.
Spoiler: The mood logic was easier than the geolocation permission denial logic.
Goal: Make MovieNest Feel Emotions (Kind Of)
This update was all about personalization. I wanted the app to:
- Detect the current weather and time
- Guess your mood from that combo (like a fortune teller… but with JavaScript)
- Recommend movies that match that vibe
Also:
- Handle permission denial gracefully (not by throwing an error and dying
)
- Keep everything snappy with virtual scroll + debounce
The (Questionable) AI Logic
Step 1: Mood Detection
I hooked into OpenWeather’s API + good ol’ Date()
and assigned moods like:
-
Rainy Night → Romantic Thriller
-
Sunny Morning → Feel-Good Comedy
-
Foggy Afternoon → Mystery Drama
Basically, my app is now a softboi who asks,
*”Are you okay? Here’s a comfort film.”
Step 2: Mood → Genre
I made a neat moodGenreMapping
object:
{
feelgood: [35, 10751], // Comedy, Family
cozy: [10749, 18], // Romance, Drama
adventure: [12, 28], // Adventure, Action
mystery: [9648, 53], // Mystery, Thriller
}
So each mood maps to TMDB genres — and my app fetches them dynamically.
Step 3: Smart Fetching Flow
If you allow location:
→ Weather + Time → Mood → Genre → Movies
If you deny location (you rebel):
→ Time-only Mood → Genre → Movies
If you search manually:
→ I shut up and show you what you want.
And just to be polite, I added a Mood Explanation Banner —
“It’s raining in your area at night, so here’s a romantic thriller.”
Because transparency matters. Even in movie logic.
Challenges, AKA “Why Am I Like This?”
Weather API 401
I foolishly used OpenWeather’s fancy 3.0 OneCall endpoint.
Turns out, that one costs real money
So I switched to a free and functional endpoint. Budget dev life.
No Location? No Problem.
I realized users could deny geolocation (how dare they), and I wasn’t handling it.
Now I fallback like a champion:\
→ Just use the time and pretend we know the weather
Infinite Fetch Bug
Forgot to reset the pagination page when a new mood or search triggered.
The app said, “More movies! More!”
I said, “Please stop.”
It now stops.
Mood Mapping Misfire
I passed the time
directly into moodGenreMapping
like a rookie.
What I needed was:
getMoodFromContext(weather, time) → mood → genres
Fixed it.
Cried a bit.
Mobile Geolocation Weirdness
Some mobile devices didn’t even ask for permission.
Added logs and tested denial flow manually. (Felt like QA. Still unemployed.)
The Final Vibe
Now MovieNest can do this:
It’s raining in Mumbai at night?
→ You get romantic thrillers.It’s sunny in Paris?
→ Boom, comedies and feel-goods.Denied location?
→ It’s cool. We’ll guess. We’re chill like that.
What’s Next?
I’m building in public — crying in private. Here’s what’s coming up:
Collaborative watchlists
Voice-based search
Better mood prediction using AI (GPT meets weather forecast??)
Try It Out
Live App: https://shravandev.com/movienest\
Blog 1: Proxy, Debounce & Glassmorphism\
Blog 2: Virtual Scroll + Lazy Loading
Thanks for scrolling through my chaos.
If your app isn’t emotional yet…
Are you even building full-stack?
Built with care, mood swings, and navigator.geolocation
—
Shravan
This content originally appeared on DEV Community and was authored by Shravan Bobade