Chatlings 🐾 is a serverless, real-time chat platform designed for children aged 8–14. It ensures content safety using AI moderation and a delightful, kid-friendly design.
Just like ducklings 🦆 follow their guide while learning to explore the world, Chatlings helps young users explore digital conversations safely and responsibly.
✨ Key Features
💬 Real-time Group Chat
Users can create or join public or private groups. Seamless text and image messages using WebSocket and serverless architecture.
🧠 Smart Moderation with AI
All text messages are moderated by Amazon Bedrock’s Nova model for abuse and toxic language. Using AWS Rekognition, uploaded images are scanned for safety, instantly blocking unsafe or adult content.
🤖 AskBot The Friendly Chat Assistant
Got a question or stuck on something? Just tag @askbot in your group chat. AskBot uses the latest AWS Nova model to help kids solve doubts safely and quickly.
Chatlings🐾 Architecture
Chatlings is a serverless app built using:-
* AWS Lambda, DynamoDB, S3, Bedrock, Rekognition and API Gateway for backend.
* Cognito userpool and Lambda authorizer for authentication.
* React, Zustand and other frontend tools for delightful interface.

The application is exposed using CloudFront CDN. The default CDN behaviour points to the React frontend. React app redirects the user to the Cognito login page, and after successful OAuth2.0 login flow, getSignedCookies API call happens to get CloudFront signed cookies. These cookies are used to access images handled by “/media*” behaviour.
After that app loads and websocket connection ($connect) is established. ACCESS_TOKEN verification is done in the same step with the help of Lambda authorizer. Then, depending on user interaction, action messages are sent to the Websockets API gateway, and processing happens.
1. Create/Join Group action
When any user creates a group, the lambda function is triggered, and group metadata is stored in DynamoDB. On join group action, groupCode is verified and records are created.
2. Text Message Moderation
When user sends message using sendMessage action, first of all, lambda verifies if user belongs to the group. After that, message is stored in DynamoDB and user receives immediate feedback.
Then DynamoDB stream triggers another lambda that looks for new INSERT message operations and uses Bedrock Nova model to moderate the message. If the message is toxic, content is removed from DynamoDB. The same lambda function notifies all active connections (that are part of this group) about this message.

3. Image Message Moderation
User triggers generateS3PreSignedURL action and uploads image file to S3. File upload to S3 triggers the imageAnalyzer Lambda function that uses Rekognition to verify image content. If the image is not suitable for kids, it is deleted immediately and only flag is stored in DynamoDB. Else, image URL is stored in DynamoDB.
INSERT operation in DynamoDB table again triggers messageAnalyzer lambda, but it sends notification only for image files.

4. CloudFront Signed Cookies
Access to image files is restricted with the help of CloudFront signed cookies that were created just after successful login.
5. AskBot AI Assistant
When user mentions @askbot in the message, the askbot route is triggered, which calls Nova model to answer the question. Both user’s query and model’s response are stored in DynamoDB table. Again, the INSERT operation triggers moderation followed by notification of both messages.
6. DynamoDB Single Table Design
All data is stored in a single DynamoDB table that is designed keeping access pattern in mind instead of the structure of the data. Table schema is as follows:-

Conclusion
Chatlings🐾 helps kids interact with friends while staying protected by cutting-edge AI moderation. All of this is powered by a fully serverless, event-driven architecture built on AWS.
Thanks for reading, hope you enjoyed, Thanks 🌿