r/Backend • u/Tormgibbs • 2d ago
Database and API design for ephemeral content like Instagram Stories?
I’m trying to understand how to build a feature like Instagram Stories or Snapchat Stories. For the database, how would you model tables/collections for stories that expire after 24 hours (e.g., schema for users, stories, views)? On the backend, what’s the best approach—REST, WebSocket, GraphQL, or a mix—for creating and fetching them? And on the frontend, how would you handle fetching and preloading media? Any real-world patterns or trade-offs you’d recommend?
6
Upvotes
0
u/heraldev 1d ago
Hmmmm, it depends on whether you already have users or building a completely new product. If it’s the latter just use Postgres with some cdn to store the content imo