๐ฎ 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 ๐ป๐ฟ
Top comments (0)