
Weekend Creative Challenge: Daydream Radio
Daydream Radio transforms an ordered sequence of moods into an original short story whose emotional arc follows the exact mood progression, then pairs it with a matching book recommendation.
Vision & what the app does
Every playlist has an emotional shape. It rarely stays on one note; a set of songs might drift from restless to reflective to triumphant over the course of twenty minutes, and that shape is usually invisible unless you sit and actually feel it happen.
The app asks you for an ordered list of moods from your playlist and optionally paired with the song that carries each one and generates a short story whose emotional arc follows that exact sequence, beat to beat. Feed it "restless energy → dreamy detachment → wide-awake clarity" and it hands back a few paragraphs that move through those same three emotional beats, in that order, without ever mentioning the word "playlist." Alongside the story, it also offers a matching book recommendation, styled like a little card tucked into the liner notes, a rom-com whose tone echoes whatever mood arc you just described.
The creative output isn't a static generator spitting out generic text. It's structured around sequence, the order you input moods in is the order the story unfolds in, which is the mechanical core of the idea and what separates it from a plain "type a mood, get a poem" tool.
How I built it
I started by scoping the input format first, since that decision shaped everything downstream. Early on I considered accepting song titles alone and letting the model infer the mood from the title but that risked the model hallucinating emotional content for songs it didn't actually know anything about, especially anything outside the very top of mainstream recognition. I switched to requiring an explicit mood alongside each optional song title, which removed the guessing entirely and made the output far more reliable.
The build order was: DynamoDB table first (for persistence), then an IAM role scoped narrowly to
bedrock:InvokeModel and the specific table ARN, then the Lambda function itself, then API Gateway, then the frontend last. Building backend-to-frontend meant I could test the actual story generation logic directly in the Lambda console using a hand-crafted test event shaped like an API Gateway payload before any browser or CORS complexity entered the picture.Two real problems came up during the build. First, a mismatched handler name (
handler vs. the Lambda default lambda_handler ) caused a Runtime.HandlerNotFound error that looked scarier than it was a one-line fix once traced. Second, and more instructive: the frontend threw "Failed to fetch" once the backend was working, which turned out to be a CORS preflight failure API Gateway's own CORS layer has to be explicitly configured and deployed, separately from any CORS headers returned by the Lambda code itself. Skipping that layer means the browser blocks the request before your function code ever runs.The most interesting problem wasn't technical at all; it was a model reliability issue. When I added the book recommendation feature, the model confidently attributed a real movie title to the wrong author, inventing a book that doesn't exist in that form. I addressed it two ways: tightening the prompt to explicitly require the model to double-check that the title and author actually belong together, anchoring it toward a couple of named, extremely well-known fallback examples, and reducing how much weight the feature carries in the overall experience, it's a fun aside, not something the app claims as verified fact.
AWS Services sed
AWS Service | How It Was Used |
|---|---|
Amazon Bedrock (Nova Micro) | Generated stories and book recommendations based on the ordered mood sequence provided by the user. |
AWS Lambda | Processed requests, built prompts, invoked Bedrock, and stored generated content in DynamoDB. |
Amazon API Gateway | Exposed the backend through HTTP endpoints and routed requests from the frontend to Lambda. It also handled CORS configuration. |
Amazon DynamoDB | Stored generated stories, mood sequences, timestamps, and book recommendations for persistence. |
AWS Amplify | Hosted and deployed the frontend application with automatic HTTPS and CI/CD integration. |
Amazon S3 | Served as the underlying storage layer for the frontend assets deployed through Amplify. |
AWS IAM | Provided secure permissions allowing Lambda to invoke Bedrock and access DynamoDB using least-privilege access controls. |
Amazon CloudWatch | Captured Lambda logs and helped troubleshoot runtime, permission, and API integration issues during development. |
Frontend Overview
Component | Purpose |
|---|---|
HTML | Provides the structure and layout of the Daydream Radio interface. |
CSS | Creates the music-inspired visual design, including the vinyl record aesthetic and responsive layout. |
JavaScript | Handles user interactions, API requests, loading states, and rendering generated stories and recommendations. |
Mood Input Form | Allows users to enter an ordered sequence of moods and optional song titles. |
Story Display Panel | Presents the generated story and book recommendation returned by the backend. |
AWS Amplify | Hosts and deploys the frontend application with HTTPS enabled by default. |
Backend Overview
Component | Purpose |
|---|---|
Amazon API Gateway | Receives requests from the frontend and routes them to the Lambda function. |
AWS Lambda | Processes user input, builds prompts, invokes Amazon Bedrock, and prepares the response. |
Amazon Bedrock (Nova Micro) | Generates the story and matching book recommendation based on the mood sequence. |
Amazon DynamoDB | Stores generated stories, mood sequences, timestamps, and recommendations. |
AWS IAM | Grants secure permissions for Lambda to access Bedrock and DynamoDB. |
Amazon CloudWatch | Captures logs and helps monitor and troubleshoot application behavior. |
Architecture Flow
Browser → API Gateway (
POST /generate ) → Lambda → Bedrock (Nova Micro) for generation → DynamoDB for persistence → response returned to browser and rendered inline.
Seeing Daydream Radio in Action


What I learned
The biggest technical lesson was how much of "it doesn't work" in a serverless stack comes down to two or three recurring root causes: a handler name mismatch, a missing IAM permission, or an unconfigured CORS layer and that reading the actual error text (not just the generic "Failed to fetch" the browser shows) is the fastest way to tell which one you're looking at.
The bigger lesson was about small-model reliability. Nova Micro is fast and cheap, which is exactly what a weekend hackathon budget wants, but it will confidently produce a wrong answer with zero indication that it's wrong. Designing around that narrowing scope, adding explicit self-check instructions, choosing where a feature's confident-but-occasionally-wrong output is acceptable versus where it isn't turned out to be as important as anything on the infrastructure side.
Resources & Links
- Source code: https://github.com/Knandwani07/daydream-radio.git
Let's Connect
Thank you for reading and following along with the Daydream Radio journey. I hope the project and its lessons provide useful insights for anyone exploring generative AI and serverless applications on AWS.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article