# New ScyllaDB sample app: video streaming

**URL:** <https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975>\
**Category:** Announcements\
**Tags:** use-case, open-source\
**Created:** [November 6, 2023, 2:26pm UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975 "2023-11-06T14:26:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Attila\_Toth](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/attila_toth/32/287_2.png) [@Attila\_Toth](https://forum.scylladb.com/u/Attila_Toth)\
**Post date:** [November 6, 2023, 2:26pm UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/1 "2023-11-06T14:26:32Z")

</div>

We’ve recently published a new [ScyllaDB sample app](https://github.com/scylladb/video-streaming) for video streaming. The app uses NextJS (with Blitz.jS) and Material-UI on the frontend with ScyllaDB Cloud serving requests on the backend.

[Have a look at the repo](https://github.com/scylladb/video-streaming), and see how ScyllaDB can be used to build a low-latency video streaming application with modern web tools like NextJS.

Video streaming database schema used in the project:

```auto
CREATE KEYSPACE IF NOT EXISTS streaming WITH replication = { 'class': 'NetworkTopologyStrategy', 'replication_factor': '3' };

CREATE TABLE streaming.video (
    id TEXT,
    content_type TEXT,
    title TEXT,
    url TEXT,
    thumbnail TEXT,
    created_at TIMESTAMP,
    PRIMARY KEY (id, created_at)
);

CREATE TABLE streaming.watch_history (
	user_id UUID,
	video_id TEXT,
	progress INT,
	watched_at TIMESTAMP,
	PRIMARY KEY (user_id, video_id)
);

```

[Clone the repo!](https://github.com/scylladb/video-streaming)

---

<div class="post-metadata">

**Author:** ![tzach](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/tzach/32/172_2.png) [@tzach](https://forum.scylladb.com/u/tzach)\
**Post date:** [November 7, 2023, 9:36am UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/2 "2023-11-07T09:36:33Z")

</div>



---

<div class="post-metadata">

**Author:** ![dobermangood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/dobermangood/32/518_2.png) [@dobermangood](https://forum.scylladb.com/u/dobermangood)\
**Post date:** [November 12, 2023, 7:39pm UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/3 "2023-11-12T19:39:08Z")

</div>

Hello, I need a similar scheme, but in the user history there will be 1000 records per day, that is, 350,000 records per year. I saw that in cassandra it is undesirable to have more than 100,000 entries per partition. Can I leave the same scheme in scylladb or do I need to add a “bucket” column, say, by month?

---

<div class="post-metadata">

**Author:** ![Attila\_Toth](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/attila_toth/32/287_2.png) [@Attila\_Toth](https://forum.scylladb.com/u/Attila_Toth)\
**Post date:** [November 12, 2023, 8:15pm UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/4 "2023-11-12T20:15:53Z")

</div>

Hi @dobermangood ,

As long as all the nodes have roughly the same amount of data you should be good to go. I’d suggest using some kind of ID as the partitioning key and another ID and/or the timestamp column as the clustering key depending on your queries. I’m happy to give feedback if you provide the schema you’re planning to use.

---

<div class="post-metadata">

**Author:** ![dobermangood](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/dobermangood/32/518_2.png) [@dobermangood](https://forum.scylladb.com/u/dobermangood)\
**Post date:** [November 13, 2023, 8:04am UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/5 "2023-11-13T08:04:52Z")

</div>

CREATE TABLE tests (  
id timeuuid,  
user\_id uuid,  
status text,  
created\_at timestamp,  
some\_info…,  
PRIMARY KEY (id)  
);

CREATE TABLE user\_tests (  
user\_id uuid,  
test\_id timeuuid,  
status text,  
created\_at timestamp,  
some\_info…,  
PRIMARY KEY (user\_id, created\_at)  
) WITH CLUSTERING ORDER BY(created\_at DESC);

Q1: select \* from user\_tests where user\_id = ? limit 30;  
Q2: select \* from user\_tests where user\_id = ? and created\_at \< ? and created\_at \> ? limit 30;

And user\_tests potentially may be 1000 per day, and need to store it for years.

---

<div class="post-metadata">

**Author:** ![Attila\_Toth](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/attila_toth/32/287_2.png) [@Attila\_Toth](https://forum.scylladb.com/u/Attila_Toth)\
**Post date:** [November 13, 2023, 4:13pm UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/6 "2023-11-13T16:13:00Z")

</div>

Yes that schema with those queries should work really well!

---

<div class="post-metadata">

**Author:** ![Attila\_Toth](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/attila_toth/32/287_2.png) [@Attila\_Toth](https://forum.scylladb.com/u/Attila_Toth)\
**Post date:** [January 22, 2024, 1:45pm UTC](https://forum.scylladb.com/t/new-scylladb-sample-app-video-streaming/975/7 "2024-01-22T13:45:12Z")

</div>

We published a blog post detailing the data modeling process for the video streaming app: [How to Build a Low-Latency Video Streaming App with ScyllaDB & NextJS - ScyllaDB](https://www.scylladb.com/2024/01/09/build-a-low-latency-video-streaming-app/)
