AWS Builder Center
Weekend Creative Challenge: PlotTwist

Weekend Creative Challenge: PlotTwist

PlotTwist is a playful AI story studio that turns three unrelated words into a short, surprising world. Built for the AWS Weekend Creative Challenge, it combines Qwen 3.8 Max story generation with an AWS Amplify Gen 2 backend, verified user accounts, and a private story library.

DevRel 🥑 | AWS Student Builder Groups Leader | Open Source enthusiast |Ex- AWS SBCL |

Vision & What the App Does

What happens when a porcelain fox, borrowed courage, and a monsoon museum appear in the same story? PlotTwist is built around that question.
The user starts with three words. They can type their own or press AI Surprise, which asks Qwen to produce three unusual, story-friendly ingredients. The suggestion engine deliberately avoids recently used words and common fantasy cliches. It chooses ideas from different creative categories so the result has tension rather than feeling like three synonyms.
Next, the user selects a mood: Funny, Spooky, Romantic, Chaotic, or Cozy. A twist-intensity slider controls whether the ending should feel gentle, unexpected, or completely unhinged. PlotTwist then creates a 150-300 word story containing a memorable title, named characters, a beginning-middle-end structure, and a separate final twist that changes how an earlier detail is understood.
The result appears as a paper-inspired story card. Users can copy it, share it, or listen using browser narration. If the first version is not wild enough, Make it crazier sends the existing story back to Qwen with stronger creative instructions and a higher temperature.
PlotTwist is also personal. Users create an account with their email address, enter the verification code sent by Amazon Cognito, and receive a private story shelf. Every generated story is saved automatically. The My Stories interface shows full previews, creation dates, source words, moods, copy controls, confirmed deletion, and an option to reopen any story in the main studio.
My goal was not to build another blank AI chat screen. I wanted the experience to feel like a small creative toy: quick to understand, friendly to use, and capable of producing something worth sharing in under a minute.

How I Built It

I started by reducing the product to one clear creative job: transform three unrelated words into a genuinely structured mini-story. The first prototype used a local template so I could design the UI before the backend was ready. That prototype exposed an important problem: templates can change nouns, but the story still feels repeated. Different inputs kept producing the same discovery, chase, and clock-tower structure.
I replaced that behavior in production with the ModelScope OpenAI-compatible API and the exact  Qwen-Ambassador/Qwen3.8-Max  model available to my account. The repeated local example is never used in the Amplify production build. The Amplify build configuration explicitly enables cloud mode, and the generated  amplify_outputs.json  connects the browser to the deployed Cognito and AppSync resources.
The Qwen request is made only from AWS Lambda. It uses ModelScope's streaming response format, collects only the final answer content, and ignores reasoning chunks. The prompt asks for strict JSON containing  title ,  story , and  twist . The function removes accidental Markdown fences, parses the response, validates every field, and returns typed data through AppSync. The prompt also explicitly rejects repeated structures such as a discovery at a particular time, handwritten warnings, market chases, clock towers, and unfinished-dream endings.
AI Surprise uses a second Lambda handler. It sends recent suggestions as an exclusion list, rejects duplicate or overlong words, and retries once when the model repeats itself. This makes the creative starting point feel different on successive clicks.
Deployment produced some of the most useful lessons of the weekend. My first Amplify build attempted to run  ampx pipeline-deploy  before installing the repository dependencies, so the CLI executable could not be found. I corrected the build order so  npm ci  runs at the beginning of the backend phase. The next build revealed that the npm lockfile was incomplete, which I fixed by regenerating and validating it with a clean-install dry run. Finally, Amplify's backend validation found that the generated type annotations for my two custom Lambda operations were being interpreted as  void  return handlers. I replaced those brittle annotations with explicit event and result types, compiled both functions under strict TypeScript, and redeployed. The successful build then provisioned Cognito, AppSync, DynamoDB, both Lambda functions, and the hosted frontend from the same GitHub commit.
One important security decision was keeping the ModelScope token out of the frontend. The source code contains only  secret('MODELSCOPE_API_TOKEN') . The real value is entered directly in Amplify Hosting Secrets, backed by AWS Systems Manager Parameter Store. It is never committed to GitHub, added to a Vite environment variable, or sent to the browser.

AWS Services Used / Architecture Overview

PlotTwist uses AWS Amplify Gen 2 as its full-stack foundation.
  • AWS Amplify Hosting builds and deploys the React and Vite frontend from the GitHub  main  branch.
  • Amazon Cognito provides email sign-up, emailed verification codes, sign-in, password recovery, and authenticated sessions.
  • AWS AppSync, created through Amplify Data, exposes typed queries and mutations to the application.
  • Amazon DynamoDB stores saved stories. Owner-based authorization ensures users can only access their own records.
  • AWS Lambda securely calls ModelScope for word suggestions and Qwen story generation.
  • AWS Systems Manager Parameter Store, managed through Amplify Secrets, protects the ModelScope token.
[Reader]
|
v
[AWS Amplify Hosting: React UI]
|----> [Amazon Cognito: sign-up + email verification]
|
v
[AWS AppSync API]
|----> [Amazon DynamoDB: owner-protected stories]
|
|----> [AWS Lambda: AI word suggestions]
| |
| v
| [ModelScope / Qwen 3.8 Max]
|
`----> [AWS Lambda: story generation]
|
v
[ModelScope / Qwen 3.8 Max]
Amazon Bedrock was not available in my account during the weekend, but AWS still powers the application's hosting, identity, API, database, serverless integration, secret management, and deployment workflow. Qwen is an external model provider located safely behind the Lambda boundary.

What I Learned

The biggest lesson was that changing words is not the same as creating a new story. A good generative experience needs variation in setting, conflict, structure, voice, and ending. Explicit anti-repetition instructions and higher-quality model output made a much bigger difference than simply increasing randomness.
I also learned how much Amplify Gen 2 can define directly in TypeScript. The authentication resource, DynamoDB model, owner rules, Lambda-backed AppSync operations, and deployment configuration all live in the repository. That made the architecture easier to understand and document.
Another important lesson was the difference between configuration and secrets. A model name and API base URL can safely exist as normal configuration. An access token cannot. Using Amplify Secrets means the token is resolved only for the Lambda functions and never becomes part of the public frontend bundle.
Finally, I learned that creative applications still need serious product details. Friendly verification screens, loading feedback, automatic saves, useful error messages, mobile behavior, and a readable story library are not optional polish. They are what make the AI feature feel like a real application instead of an API demo.

Link to App or Repo

Try AI Surprise in Chaotic mode, create the first story, press Make it crazier, and then reopen both versions from My Stories.
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