Skip to content
S

StoryVerse

An AI-powered creative collaboration game called "StoryVerse" that combines social elements, creative writing, and AI image generation.

Created on 2nd December 2024

•

S

StoryVerse

An AI-powered creative collaboration game called "StoryVerse" that combines social elements, creative writing, and AI image generation.

The problem StoryVerse solves

StoryVerse makes storytelling more accessible, social, and rewarding while providing structured motivation for regular creative practice. It transforms what is traditionally a solitary activity into an engaging, community-driven experience.

Challenges I ran into

During development of StoryVerse, I encountered several significant challenges:
Telegram WebApp Authentication Flow: One of the most complex issues was properly validating the Telegram WebApp's initData hash. The documentation wasn't entirely clear about the parameter ordering for hash validation. I resolved this by implementing a custom sorting function for the parameters and using crypto.createHmac() with proper parameter encoding.
Image Generation Rate Limits: The DALL-E API calls for story illustrations were hitting rate limits during high user activity. I solved this by implementing a queue system using Bull.js that spaces out the requests and retries failed generations, plus added client-side caching of generated images to reduce API calls.
MongoDB Atomic Operations: Handling concurrent story contributions while maintaining consistency was tricky. Users could sometimes overwrite each others' votes or contributions. I fixed this by using MongoDB's $push and $inc operators within atomic transactions, ensuring data consistency even during high concurrency.
Real-time Updates: Initially, there were race conditions when multiple users were voting or contributing simultaneously. The solution was implementing a WebSocket layer with Socket.io for real-time updates, combined with optimistic UI updates and proper state reconciliation.
Memory Leaks: The notification service was accumulating event listeners over time as users joined and left stories. I resolved this by implementing proper cleanup of WebSocket connections and event listeners when users disconnect, plus added monitoring to catch memory issues early.

Tracks Applied (1)

Telegram mini apps

I have built an app which follows Aptos' "Create mini apps on Telegram that drive engagement and keep users returning da...Read More
Aptos

Aptos

Discussion

Builders also viewed

See more projects on Devfolio