An open API service indexing awesome lists of open source software.

https://github.com/anchit1909/storycraft-ai

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.
https://github.com/anchit1909/storycraft-ai

amazon-s3 aws aws-lambda aws-polly awscdk dynamodb event-driven-architecture eventbridge nextjs openai serverless sns typescript

Last synced: about 2 months ago
JSON representation

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.

Awesome Lists containing this project

README

        

StorycraftAI - AWS Serverless Stories Generator

StorycraftAI - AWS Serverless Stories Generator


Generate unique stories for a personalized bedtime experience.



Anchit Sinha Twitter follower count


StorycraftAI repo star count


Introduction ·
Features ·
How It Works ·
Tech Stack ·
Screenshots ·
Author



## Introduction

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.

## Features

- 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.

## How it works

![Architecture diagram](./frontend/public/Arch.png)

1. Every day at a configured time an **EventBridge Schedule** is trigger which triggers a Lambda function.

2. 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.

3. 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).

4. 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).

5. 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.

## Tech Stack

- Typescript
- [NextJS](https://nextjs.org/)
- [AWS](https://aws.amazon.com/)
- [Tailwind CSS](https://tailwindcss.com/)
- [OpenAI](https://openai.com/blog/openai-api)

## Screenshots

### Home Page

Home Page

### Story Page

Company Details Page

## Author

- Anchit Sinha ([@anchit1909](https://twitter.com/anchit1909))