Fireship · @fireship
Why my chat app broke… a cautionary tale
Uploaded December 22, 2022 · Length 5:33
Summary
Fireship developer creates a chat app, but it gets overwhelmed by spam and hate speech, and he shares lessons learned on how to mitigate these issues.
- chat app security
- spam prevention
- hate speech moderation
- next.js
- pocketbase
- serverless
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
a few days ago I built a next-gen
- 0:02
Discord killer with pocket base and
- 0:03
svelt it was an amazing experience for
- 0:05
about three minutes but then you guys
- 0:07
completely destroyed it by spamming it
- 0:09
with the most deranged comments I've
- 0:10
ever seen on the internet I initially
- 0:11
started with a five dollar Linux server
- 0:13
its usage quickly shot up to 100 so I
- 0:16
resized it to four cores that wasn't
- 0:18
nearly enough juice either and all four
- 0:20
cores quickly became overwhelmed and
- 0:21
this is why we can't have nice things on
- 0:23
this channel the primary person to blame
- 0:25
for all this is me the developer I built
- 0:27
it with bad security practices by Design
- 0:29
just to see what would happen fun to do
- 0:32
bad things luckily I live in America so
- 0:34
I can't go to jail for the horrible
- 0:35
things you guys said unlike other
- 0:37
countries but nobody wants to use an app
- 0:39
that can be spammed by an unlimited
- 0:40
amount of hate speech and profanity this
- 0:42
is a major problem when building any
- 0:44
kind of app with user generated data in
- 0:46
today's video we'll break down all the
- 0:48
problems my app had and talk about tools
- 0:50
and techniques you can use to mitigate
- 0:51
these issues in your own projects the
- 0:53
first problem is that people were using
- 0:55
profanity even though I told them not to
- 0:57
they didn't listen their language is
- 0:58
offensive I thought this might have
- 0:59
happen so I implemented a pooping system
- 1:02
where if a comment gets pooped on five
- 1:04
times it gets removed from the UI I've
- 1:06
seen this feature on other platforms
- 1:07
like Odyssey where you can slime a
- 1:09
comment to death and I think it's a good
- 1:11
idea but it doesn't really work for a
- 1:12
chat where the messages are moving at
- 1:14
100 miles an hour it can also be
- 1:16
hijacked by the bad guys to poop down
- 1:17
all the comments that are actually good
- 1:19
so the next thing I did which is really
- 1:20
easy to implement is just a bad word
- 1:22
filter directly in the front end code
- 1:24
that means the app can't display words
- 1:26
like balls and so on you
- 1:28
can also do filtering like this on the
- 1:30
back end before that data ever goes to
- 1:32
your database but it's impossible to
- 1:33
catch everything with regular
- 1:35
Expressions the trolls will find ways to
- 1:36
say bad words with alternative
- 1:38
characters that bypass your filters in
- 1:40
modern times though artificial
- 1:41
intelligence is starting to take over
- 1:43
this job in Google developed perspective
- 1:45
API which can detect if something is an
- 1:47
insult or some variation of profanity
- 1:49
and they use tools like this at scale to
- 1:51
keep the worst of the worst comments off
- 1:53
of YouTube bad words are one problem but
- 1:55
an even bigger problem is when one
- 1:56
person creates a script that
- 1:58
automatically signs up new users and


