Fireship · @fireship
Is Redis the ONLY database you need? // Fullstack app from scratch with Next.js & Redis
Uploaded January 11, 2022 · Length 13:04
Summary
Building a full-text autocomplete search using Redis as a primary database with Next.js and Redis modules.
- redis database
- next.js
- full-text search
- autocomplete search
- redis modules
- nodejs
- javascript
Transcript preview
The first 2 minutes of the transcript. Select a timestamp to watch that moment on YouTube.
- 0:00
most developers already know that redis
- 0:02
is a mega fast in-memory database often
- 0:04
used as a cache to make traditional
- 0:06
databases faster but what most
- 0:08
developers don't know is that redis can
- 0:10
also be used as a primary app database
- 0:12
thanks to a suite of modules that add
- 0:14
additional data structures and commands
- 0:16
to core redis they can handle json data
- 0:18
full text search graph relationships and
- 0:21
many other features in today's video
- 0:22
we'll put this claim to the test by
- 0:24
building a full text autocomplete search
- 0:26
inspired by something like algolia or
- 0:28
elasticsearch where the user can add
- 0:30
items to the database and instantly view
- 0:32
the filtered results we'll build this
- 0:34
project from scratch using next.js
- 0:36
allowing us to use react on the front
- 0:38
end and nodejs to interact with redis on
- 0:40
the back end as an added bonus redis
- 0:42
just released a brand new sdk called
- 0:44
redis ohm that supports object mapping
- 0:47
and nodejs if you're new here like and
- 0:48
subscribe and you can follow along with
- 0:50
the full article on fireship io let's
- 0:52
first take a look at what we're building
- 0:54
today we have a form that when submitted
- 0:56
we'll add a new item to the database in
- 0:58
redis this data would normally be saved
- 0:59
as a hash data structure but a hash
- 1:02
doesn't support nested objects so
- 1:04
instead we'll be storing this data as
- 1:05
native json thanks to the redis json
- 1:08
module now after adding a few items to
- 1:10
the database we may want to retrieve
- 1:11
them later when i type into the search
- 1:13
form field you can see that it
- 1:14
automatically updates the results in the
- 1:16
ui after every keystroke that's made
- 1:18
possible by redis search which is an
- 1:20
incredibly powerful module that can
- 1:22
index all of the fields on your json
- 1:24
dataset at which point you can perform
- 1:25
complex queries like you would with the
- 1:27
where clause in sql and aggregations
- 1:30
like sum and count now we're ready to
- 1:31
start building there are a few different
- 1:33
ways you can get started with redis the
- 1:34
easiest option is to sign up for
- 1:36
rediscloud i collaborated with redis
- 1:38
enterprise cloud to make this video and
- 1:40
they're providing a 200 credit and also
- 1:42
a chance to win a tesla model 3 if you
- 1:45
use this code before january 31st so
- 1:47
that's pretty awesome but more
- 1:48
importantly redis is consistently the
- 1:50
most loved database out there i've used
- 1:52
it myself for many years and that's why
- 1:53
i decided to work with them on this
- 1:55
video after you sign in you'll be
- 1:57
prompted to create a new subscription go
- 1:59
ahead and do that and you can choose a


