AWS Builder Center
Weekend Creative Challenge: Plot Twist

Weekend Creative Challenge: Plot Twist

Plot Twist is a small AI-powered creative storytelling toy that turns a simple idea into a story and lets users transform it with increasingly unexpected twists.

i love competitive programming and system design
Vision & what the app does
I built Plot Twist, a small creative storytelling application designed to turn a simple idea into an unpredictable story.
The concept is intentionally simple. A user enters a basic story idea, chooses a genre, selects a story length, and adjusts a creativity level. Plot Twist then generates a short story based on those choices.
The application also includes several ways to transform the generated story. Users can choose actions such as Make It Darker, Make It Funnier, Add a Plot Twist, Make It Absurd, Turn It Into Sci-Fi, or Change The Ending.
The goal was not to build another general-purpose AI chatbot. I wanted to build something that feels more like a small creative toy: enter an idea, press a button, get something unexpected, and keep experimenting with it.
For example, a simple prompt such as "A student discovers that his laptop is alive" could become a science-fiction story. The user can then ask Plot Twist to make it darker, change the ending, or introduce an absurd plot twist.
How I built it
I started with a very simple technology stack because I am still learning application development. The frontend uses standard HTML, CSS, and JavaScript rather than a large framework.
The first version focused entirely on the user experience. I built the story input, genre selector, story length controls, creativity slider, generation button, story display area, loading states, error handling, and mutation buttons.
I also created a local mock backend so that I could test the frontend without depending on a cloud service during development.
After the frontend was working, I created a Node.js AWS Lambda function to handle the AI portion of the application. The Lambda function receives the user's story request, constructs a prompt, and is designed to call Amazon Bedrock using the AWS SDK.
One of the most useful lessons from the project was that writing the application code and deploying the application are two different problems. The code can be correct while the cloud configuration is still incomplete.
I encountered this directly when testing the Lambda function. The function successfully executed, but the AWS response showed that its execution role did not yet have permission to invoke the Bedrock model. This made the problem much clearer: the issue was not the frontend or the story-generation logic, but the IAM configuration connecting Lambda to Bedrock.
That debugging process helped me understand the role IAM plays in AWS applications.
AWS services used / architecture overview
The project was designed around a small serverless architecture:
Browser | | fetch() v Lambda Function URL | v AWS Lambda | | Bedrock Runtime API v Amazon Bedrock | v Amazon Nova
The frontend is a static HTML/CSS/JavaScript application.
AWS Lambda is responsible for the backend logic. Keeping the AI request on the backend means that AWS credentials do not need to be exposed in browser JavaScript.
Amazon Bedrock provides access to foundation models without requiring me to host or manage an AI model myself.
Amazon Nova Lite was selected as the intended model for generating and transforming the stories.
The Lambda function uses the AWS Bedrock Runtime SDK and is configured to use the Nova model through an environment variable.
The intended final deployment uses a Lambda Function URL to provide an HTTPS endpoint that the frontend can call. This keeps the architecture small and avoids introducing unnecessary infrastructure such as a database or a full traditional backend server.
What I learned
This challenge introduced me to several AWS concepts that were completely new to me.
The first was AWS Lambda. I learned that a backend does not necessarily need to run continuously on a server. A Lambda function can execute when it receives a request and return a response.
The second was Amazon Bedrock. Before this project, I had mostly interacted with AI through applications rather than thinking about how an application actually calls a foundation model. Working with the Bedrock Runtime SDK showed me how a backend can send structured requests to a model and process its response.
I also learned about IAM permissions. This was particularly useful because my first Lambda test successfully executed the function but failed when Lambda attempted to invoke Bedrock. The error explained that the Lambda execution role did not have the required bedrock:InvokeModel permission.
That taught me an important AWS lesson: having code that calls a service is not enough. The AWS identity executing the code must also have permission to use that service.
I also learned about the separation between frontend and backend responsibilities. The browser should not contain AWS secret credentials. Instead, the browser communicates with the backend, and the Lambda execution role handles access to AWS services.
Finally, I learned that starting with a small architecture is useful when learning cloud development. For a project this size, I did not need a database, authentication system, containers, or a complicated backend.
What I would improve next
The next step would be completing the production deployment by finishing the Lambda IAM configuration, exposing the function through its HTTPS Function URL, connecting the frontend to that URL, and hosting the frontend publicly.
I would also like to improve the creative experience by adding more mutation types and making the generated stories easier to share.
The main lesson I am taking from this challenge is that building a cloud application is not only about writing code. It is also about understanding how the different layers—frontend, backend, permissions, APIs, and cloud services—fit together.
Project
#creative-expression
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article