Generate unique stories for a personalized bedtime experience.
Introduction · Features · How It Works · Tech Stack · Screenshots · Author
StorycraftAI is an an automated Event Driven AI bedtime story generation application using serverless technologies (AWS Lambda, EventBridge Scheduler), OpenAI for generating stories, DALL-E for images, and AWS Polly for text to speech, delivering unique stories, configured by parents, daily for a personalized bedtime experience.
- EventBridge Scheduler to generate new story every bedtime.
- Event architecture using Amazon EventBridge to fan out processing of images, audio and emails.
- New unqiue story every night using ChatGPT, DALL-E for images and Amazon Polly for Audio.
- Deployment with AWS CDK.
-
Every day at a configured time an EventBridge Schedule is trigger which triggers a Lambda function.
-
The
create-story
lambda function takes characters and scenes from the Amazon DynamoDB tables and uses ChatGPT (OpenAI API) to create the story. The story is stored with a 2 day TTL in DynamoDB. -
An Amazon EventBridge Pipe is configured to listen to all New items created inside the table using streams and triggers an Amazon EventBridge event (StoryCreated).
-
EventBridge routes the
StoryCreated
event to three targets:
- SNS for email
- SNS for email: SNS is used in this example to notify the user that a new story has been created.
- AWS Lambda function for Audio generation
- Lambda for Audio: Amazon Polly is created to create audio for the story that has been generated. The audio file is stores into S3 with a signed URL (for 2 days).
- AWS Lambda function for image generation.
- Lambda for image generation: This function takes the story and scene and creates an image for the story using DALL-E (OpenAI API). This image is stored inside S3 with a signed URL (2 days).
- The frontend application is running on AWS App Runner and is hosting a NextJS SRR application. When the user goes to the URL in the Email (through SNS topic), the story is loaded and displayed.
- Typescript
- NextJS
- AWS
- Tailwind CSS
- OpenAI
- Anchit Sinha (@anchit1909)