ScuffleTV / scuffle

Live streaming platform
https://scuffle.tv
233 stars 26 forks source link

Database choice & Model #26

Closed TroyKomodo closed 1 year ago

TroyKomodo commented 1 year ago

We need to decide on the database we are going to use As well as the model schema for how we are going to model the data

treuks commented 1 year ago

I think we should consider trying CockroachDB. It's a nice scalable by default DB, compatible with postgres. We will need something like it if we'll be as huge as twitch. The fact it's open source and selfhostable is super nice too

TroyKomodo commented 1 year ago

I think we should consider trying CockroachDB. It's a nice scalable by default DB, compatible with postgres. We will need something like it if we'll be as huge as twitch. The fact it's open source and selfhostable is super nice too

My vote is likely on postgres with prisma, cockroach is nice and it would be easy to migrate there later from postgres -> cockroach

treuks commented 1 year ago

Yeah I think we should for sure go with the either one of those, can't go wrong with postgres

PandaDex commented 1 year ago

mb Cassandra?

TroyKomodo commented 1 year ago

Cassandra would be nice perhaps later when it comes to high volumes of writes. (chat messages) But for now I dont think its a good idea.

TroyKomodo commented 1 year ago

Turns out Prisma Rust uses openssl and also isnt very nice. ill just use sqlx then with postgres i suppose.

TroyKomodo commented 1 year ago

Re: @IS2511 @4w3Official @treuks

Is there any good examples of how people model dbs with sqlx to handle migrations ect? Something we can do.

treuks commented 1 year ago

https://github.com/JoeyMckenzie/realworld-rust-axum-sqlx/tree/main/crates/conduit-infrastructure perhaps this could be a good example

TroyKomodo commented 1 year ago

Some ideas to throw around. Should we have globally unique usernames? Currently Twitch does this, youtube doesnt, discord does this with a discriminator. How should we model channels to users? A user can have multiple channels or just a single channel? Does the channel name have to be the user's username?

I want to give the ability to have "multiple streams" on a single channel or multiple channels on a single user or both??

Prime usecases would be different language streams for tournaments / game shows

@ScuffleTV/reviewers Any ideas on what we should do?

mmattbtw commented 1 year ago

Some ideas to throw around. Should we have globally unique usernames? Currently Twitch does this, youtube doesnt, discord does this with a discriminator. How should we model channels to users? A user can have multiple channels or just a single channel? Does the channel name have to be the user's username?

def use unique usernames, youtube has recently switched to using @ usernames in comments, probably to solve their terrible spam problem

I want to give the ability to have "multiple streams" on a single channel or multiple channels on a single user or both??

i think both could happen

Organizations that house Users (like GitHub), and Users can have multiple Streams

sirinoks commented 1 year ago

Should we have globally unique usernames? Currently Twitch does this, youtube doesnt, discord does this with a discriminator.

I think having unique usernames might just ruin some people's brands/preferred names just because some random snatched it first, or is reselling. I do like the discriminator solution, it allows for keeping things both unique and repeating. Youtube's system is, honestly, confusing. Idk if we want to add a number tag specifically, we could use some different solutions like.. colors? IDK exactly, but it could have a room for creativity.

How should we model channels to users? A user can have multiple channels or just a single channel? Does the channel name have to be the user's username?

How about everyone has a default channel that is just their name, but have an ability to create additional channels? We might have some groups of streamers "own" a shared channel, with maybe multi-view, or offer some solution to podcasts. Could play around with that.

I want to give the ability to have "multiple streams" on a single channel or multiple channels on a single user or both??

Yea, agree with prev comment, both could just work

TroyKomodo commented 1 year ago

yeah i think allowing streamers to create their "own url" for the substreams is easiest and provides the most use cases like imagine ur doing an IRL stream from 5 different phones like for example lets say otk does an event scuffle.tv/otk/mizkif scuffle.tv/otk/asmongold scuffle.tv/otk/emiru they all have their own channels but for that particular event they all stream under the "otk channel" and the vods are stored there or like for example league or dota scuffle.tv/riot/league_en1 scuffle.tv/riot/league_en2 scuffle.tv/riot/league_en3 scuffle.tv/riot/league_en4 scuffle.tv/riot/league_ru1 scuffle.tv/riot/league_ru2 like i think this makes the most sense

TroyKomodo commented 1 year ago

you can create targets as you choose then as for the top level names that would be the username associated with the account how to make that not squatter is a bit hard i think, we have a strict squatter policy that if you believe that an account is being squatted you can report it and we will investigate like if ur a brand, or already established we can hand it over to you or if the account is just dead with no recent logins / the owner of the account has multiple accounts and seems to not use this one or whatever obviously in some cases like there might be 2 brands with the same name if there is an established brand and org and said org creation PREDATES the existence of the account and the account is active we hand over the account if there is an established brand / org and the org creation does not predate the account but the account is not active and is "dead" we hand over the account if the org does not predate and the account is not dead and is active we do not

mmattbtw commented 1 year ago

lets say otk does an event

scuffle.tv/otk/mizkif

scuffle.tv/otk/asmongold

scuffle.tv/otk/emiru

tough thing about this is that what if they leave OTK, will their url be /username?

unrelated but having a permanent URL that won't break on name changes or whatever would be nice to have for social sharing

TroyKomodo commented 1 year ago

@mmattbtw no, they will have their own channels on scuffle.tv/mizkif ect but if otk does an event and they want everyone under /otk/ they can create targets for it

treuks commented 1 year ago

While I do think the idea with the groups and stuff is good, I really do prefer unique names over display + handle names. I wouldn't really like seeing 10 people pull a joke and change their display names to Ninja. And you obviously wouldn't use the handle itself as the user identifier in the chat, as that would kinda just remove the point of having display names in the first place.

I think it's okay to sacrifice the users ability to have whatever as their username, to reduce the amount of accounts imitating a youtuber and telling people to click their profile which leads to some scam bs. I think the way twitch does it already is pretty good, don't need something more advanced than that