Prisma is an open-source ORM that makes it fun and safe to work with a database like MySQL, Postgres, SQL Server, or MongoDB. It generates a type-safe client library to provide an awesome DX in any Node.js or JavaScript project. 

This video is NOT sponsored. 

#database #webdev #100SecondsOfCode

🔗 Resources

- Prisma Docs https://www.prisma.io/
- Prisma Source Code https://github.com/prisma/prisma
- MySQL Full Tutorial https://youtu.be/Cz3WcZLRaWc

🔥 Get More Content - Upgrade to PRO

Upgrade to Fireship PRO at https://fireship.io/pro
Use code lORhwXd2 for 25% off your first payment. 

🎨 My Editor Settings

- Atom One Dark 
- vscode-icons
- Fira Code Font

🔖 Topics Covered

- What is Prisma
- Is Prisma an ORM?
- Prisma Quickstart
- What is Prisma used for?
- How to use Prisma in Node.js
- Using Prisma with a relational database
- Prisma compared to Sequalize or TypeORM
2024-02-04T05:35:46.177Z
nova-2
2-general-nova
2024-01-09.29447
30089e05-99d1-4376-b32e-c263170674af
e5d3fd0f-66b0-4871-9115-bf3d6a5da4a5
8715e0691ee9ab42a338dfdb951e82545c2595b3e5dada4c426a8656a955b80e
67875a7f-c9c4-48a0-aa55-5bdb8a91c34a
deprecated
Prisma, an open source tool that makes it fun and safe to work with your database.
The relational database is ancient technology that has stood the test of time, but writing SQL code is not an ideal abstraction for modern app development.
It provides too much low level control and you'll probably blow your foot off writing tit.
To address this concern, ORMs like SQLize implement object relational mapping to express data with object oriented code like JavaScript classes.
Prisma is also an ORM that addresses similar problems, but instead, it has its own declarative schema nation language.
You write a schema to express your data and relationships in a human readable way, or the schema can be automatically inferred from any existing database.
Prisma then converts the schema 2 type definitions, allowing you to perform type safe CRUD operations with your own database models, which means you get IDE auto completion tailored to your own custom schema.
In addition, it handles migrations patients as your data structure evolves.
And if you want to visualize your data, Prisma Studio allows you to view and manage all of your tables and rows in the browser.
To get started, you'll need a relational database like MySQL or Postgres, although MongoDB is supported as well.
From a Node.
Js project run npxprisma init.
This creates a dotenv file where you can add your database URL and a Prisma directory to define the schema.
If the existing database already has data, we can run prisma db pull to introspect it and automatically generate the schema from it.
Notice how each table is represented with model keyword.
Then inside the braces, we have column names and their data types, as well as optional constraints.
Like for example, we might use relation to create a foreign key constraint train between a weapon and a human, and we can also index the weapon ID while we're at it.
The beauty of this is that the code is significantly more concise than what you would write otherwise ties in raw SQL.
Now, if we decide to modify our schema, like add an extra timestamp column, we'll also need to modify the database structure which can be handled automatically with the Prisma migrate command.
Now to interact with the database on the server, we tell Prisma to generate the client library, import the client into a script file and notice how it auto completes the models in the schema.
If you do something wrong, you'll know about it right away.
Now, find all the humans with the find many method.
To filter the results, we can add a where clause as a plain JavaScript object.
And if we want to join a related table, we can do that by adding the include object.
Prisma already knows how to run the complicated SQL code under the hood and returns the data as an array of JavaScript objects ready to use in your application.
This has been Prisma in 100 seconds.
Tense.
If you wanna see more short videos like this, hit the like button and subscribe, and let me know if you wanna see a full Prisma tutorial in the comments.
Thanks for watching and I will see you in the next one.

Speaker 0: Prisma, an open source tool that makes it fun and safe to work with your database. The relational database is ancient technology that has stood the test of time, but writing SQL code is not an ideal abstraction for modern app development. It provides too much low level control and you'll probably blow your foot off writing tit. To address this concern, ORMs like SQLize implement object relational mapping to express data with object oriented code like JavaScript classes. Prisma is also an ORM that addresses similar problems, but instead, it has its own declarative schema nation language.

You write a schema to express your data and relationships in a human readable way, or the schema can be automatically inferred from any existing database. Prisma then converts the schema 2 type definitions, allowing you to perform type safe CRUD operations with your own database models, which means you get IDE auto completion tailored to your own custom schema. In addition, it handles migrations patients as your data structure evolves. And if you want to visualize your data, Prisma Studio allows you to view and manage all of your tables and rows in the browser. To get started, you'll need a relational database like MySQL or Postgres, although MongoDB is supported as well.

From a Node. Js project run npxprisma init. This creates a dotenv file where you can add your database URL and a Prisma directory to define the schema. If the existing database already has data, we can run prisma db pull to introspect it and automatically generate the schema from it. Notice how each table is represented with model keyword.

Then inside the braces, we have column names and their data types, as well as optional constraints. Like for example, we might use relation to create a foreign key constraint train between a weapon and a human, and we can also index the weapon ID while we're at it. The beauty of this is that the code is significantly more concise than what you would write otherwise ties in raw SQL. Now, if we decide to modify our schema, like add an extra timestamp column, we'll also need to modify the database structure which can be handled automatically with the Prisma migrate command. Now to interact with the database on the server, we tell Prisma to generate the client library, import the client into a script file and notice how it auto completes the models in the schema.

If you do something wrong, you'll know about it right away. Now, find all the humans with the find many method. To filter the results, we can add a where clause as a plain JavaScript object. And if we want to join a related table, we can do that by adding the include object. Prisma already knows how to run the complicated SQL code under the hood and returns the data as an array of JavaScript objects ready to use in your application.

This has been Prisma in 100 seconds. Tense. If you wanna see more short videos like this, hit the like button and subscribe, and let me know if you wanna see a full Prisma tutorial in the comments. Thanks for watching and I will see you in the next one.
Prisma, an open source tool that makes it fun and safe to work with your database. The relational database is ancient technology that has stood the test of time, but writing SQL code is not an ideal abstraction for modern app development. It provides too much low level control and you'll probably blow your foot off writing tit.
databases
data management
To address this concern, ORMs like SQLize implement object relational mapping to express data with object oriented code like JavaScript classes.
Prisma is also an ORM that addresses similar problems, but instead, it has its own declarative schema nation language. You write a schema to express your data and relationships in a human readable way, or the schema can be automatically inferred from any existing database. Prisma then converts the schema 2 type definitions, allowing you to perform type safe CRUD operations with your own database models, which means you get IDE auto completion tailored to your own custom schema. In addition, it handles migrations patients as your data structure evolves. And if you want to visualize your data, Prisma Studio allows you to view and manage all of your tables and rows in the browser. To get started, you'll need a relational database like MySQL or Postgres, although MongoDB is supported as well. From a Node. Js project run npxprisma init. This creates a dotenv file where you can add your database URL and a Prisma directory to define the schema. If the existing database already has data, we can run prisma db pull to introspect it and automatically generate the schema from it. Notice how each table is represented with model keyword. Then inside the braces, we have column names and their data types, as well as optional constraints. Like for example, we might use relation to create a foreign key constraint train between a weapon and a human, and we can also index the weapon ID while we're at it. The beauty of this is that the code is significantly more concise than what you would write otherwise ties in raw SQL. Now, if we decide to modify our schema, like add an extra timestamp column, we'll also need to modify the database structure which can be handled automatically with the Prisma migrate command. Now to interact with the database on the server, we tell Prisma to generate the client library, import the client into a script file and notice how it auto completes the models in the schema. If you do something wrong, you'll know about it right away. Now, find all the humans with the find many method.
databases
data management
data
weapons
To filter the results, we can add a where clause as a plain JavaScript object. And if we want to join a related table, we can do that by adding the include object. Prisma already knows how to run the complicated SQL code under the hood and returns the data as an array of JavaScript objects ready to use in your application.
This has been Prisma in 100 seconds. Tense. If you wanna see more short videos like this, hit the like button and subscribe, and let me know if you wanna see a full Prisma tutorial in the comments. Thanks for watching and I will see you in the next one.
youtube
Prisma, an open source tool that makes it fun and safe to work with your database. The relational database is ancient technology that has stood the test of time, but writing SQL code is not an ideal abstraction for modern app development. It provides too much low level control and you'll probably blow your foot off writing tit. To address this concern, ORMs like SQLize implement object relational mapping to express data with object oriented code like JavaScript classes. Prisma is also an ORM that addresses similar problems, but instead, it has its own declarative schema nation language. You write a schema to express your data and relationships in a human readable way, or the schema can be automatically inferred from any existing database. Prisma then converts the schema 2 type definitions, allowing you to perform type safe CRUD operations with your own database models, which means you get IDE auto completion tailored to your own custom schema. In addition, it handles migrations patients as your data structure evolves. And if you want to visualize your data, Prisma Studio allows you to view and manage all of your tables and rows in the browser. To get started, you'll need a relational database like MySQL or Postgres, although MongoDB is supported as well. From a Node. Js project run npxprisma init. This creates a dotenv file where you can add your database URL and a Prisma directory to define the schema. If the existing database already has data, we can run prisma db pull to introspect it and automatically generate the schema from it. Notice how each table is represented with model keyword. Then inside the braces, we have column names and their data types, as well as optional constraints. Like for example, we might use relation to create a foreign key constraint train between a weapon and a human, and we can also index the weapon ID while we're at it. The beauty of this is that the code is significantly more concise than what you would write otherwise ties in raw SQL. Now, if we decide to modify our schema, like add an extra timestamp column, we'll also need to modify the database structure which can be handled automatically with the Prisma migrate command. Now to interact with the database on the server, we tell Prisma to generate the client library, import the client into a script file and notice how it auto completes the models in the schema. If you do something wrong, you'll know about it right away. Now, find all the humans with the find many method. To filter the results, we can add a where clause as a plain JavaScript object. And if we want to join a related table, we can do that by adding the include object. Prisma already knows how to run the complicated SQL code under the hood and returns the data as an array of JavaScript objects ready to use in your application. This has been Prisma in 100 seconds. Tense. If you wanna see more short videos like this, hit the like button and subscribe, and let me know if you wanna see a full Prisma tutorial in the comments. Thanks for watching and I will see you in the next one.
Prisma,
prisma
an
an
open
open
source
source
tool
tool
that
that
makes
makes
it
it
fun
fun
and
and
safe
safe
to
to
work
work
with
with
your
your
database.
database
The
the
relational
relational
database
database
is
is
ancient
ancient
technology
technology
that
that
has
has
stood
stood
the
the
test
test
of
of
time,
time
but
but
writing
writing
SQL
sql
code
code
is
is
not
not
an
an
ideal
ideal
abstraction
abstraction
for
for
modern
modern
app
app
development.
development
It
it
provides
provides
too
too
much
much
low
low
level
level
control
control
and
and
you'll
you'll
probably
probably
blow
blow
your
your
foot
foot
off
off
writing
writing
tit.
tit
To
to
address
address
this
this
concern,
concern
ORMs
orms
like
like
SQLize
sqlize
implement
implement
object
object
relational
relational
mapping
mapping
to
to
express
express
data
data
with
with
object
object
oriented
oriented
code
code
like
like
JavaScript
javascript
classes.
classes
Prisma
prisma
is
is
also
also
an
an
ORM
orm
that
that
addresses
addresses
similar
similar
problems,
problems
but
but
instead,
instead
it
it
has
has
its
its
own
own
declarative
declarative
schema
schema
nation
nation
language.
language
You
you
write
write
a
a
schema
schema
to
to
express
express
your
your
data
data
and
and
relationships
relationships
in
in
a
a
human
human
readable
readable
way,
way
or
or
the
the
schema
schema
can
can
be
be
automatically
automatically
inferred
inferred
from
from
any
any
existing
existing
database.
database
Prisma
prisma
then
then
converts
converts
the
the
schema
schema
2
2
type
type
definitions,
definitions
allowing
allowing
you
you
to
to
perform
perform
type
type
safe
safe
CRUD
crud
operations
operations
with
with
your
your
own
own
database
database
models,
models
which
which
means
means
you
you
get
get
IDE
ide
auto
auto
completion
completion
tailored
tailored
to
to
your
your
own
own
custom
custom
schema.
schema
In
in
addition,
addition
it
it
handles
handles
migrations
migrations
patients
patients
as
as
your
your
data
data
structure
structure
evolves.
evolves
And
and
if
if
you
you
want
want
to
to
visualize
visualize
your
your
data,
data
Prisma
prisma
Studio
studio
allows
allows
you
you
to
to
view
view
and
and
manage
manage
all
all
of
of
your
your
tables
tables
and
and
rows
rows
in
in
the
the
browser.
browser
To
to
get
get
started,
started
you'll
you'll
need
need
a
a
relational
relational
database
database
like
like
MySQL
mysql
or
or
Postgres,
postgres
although
although
MongoDB
mongodb
is
is
supported
supported
as
as
well.
well
From
from
a
a
Node.
node
Js
js
project
project
run
run
npxprisma
npxprisma
init.
init
This
this
creates
creates
a
a
dotenv
dotenv
file
file
where
where
you
you
can
can
add
add
your
your
database
database
URL
url
and
and
a
a
Prisma
prisma
directory
directory
to
to
define
define
the
the
schema.
schema
If
if
the
the
existing
existing
database
database
already
already
has
has
data,
data
we
we
can
can
run
run
prisma
prisma
db
db
pull
pull
to
to
introspect
introspect
it
it
and
and
automatically
automatically
generate
generate
the
the
schema
schema
from
from
it.
it
Notice
notice
how
how
each
each
table
table
is
is
represented
represented
with
with
model
model
keyword.
keyword
Then
then
inside
inside
the
the
braces,
braces
we
we
have
have
column
column
names
names
and
and
their
their
data
data
types,
types
as
as
well
well
as
as
optional
optional
constraints.
constraints
Like
like
for
for
example,
example
we
we
might
might
use
use
relation
relation
to
to
create
create
a
a
foreign
foreign
key
key
constraint
constraint
train
train
between
between
a
a
weapon
weapon
and
and
a
a
human,
human
and
and
we
we
can
can
also
also
index
index
the
the
weapon
weapon
ID
id
while
while
we're
we're
at
at
it.
it
The
the
beauty
beauty
of
of
this
this
is
is
that
that
the
the
code
code
is
is
significantly
significantly
more
more
concise
concise
than
than
what
what
you
you
would
would
write
write
otherwise
otherwise
ties
ties
in
in
raw
raw
SQL.
sql
Now,
now
if
if
we
we
decide
decide
to
to
modify
modify
our
our
schema,
schema
like
like
add
add
an
an
extra
extra
timestamp
timestamp
column,
column
we'll
we'll
also
also
need
need
to
to
modify
modify
the
the
database
database
structure
structure
which
which
can
can
be
be
handled
handled
automatically
automatically
with
with
the
the
Prisma
prisma
migrate
migrate
command.
command
Now
now
to
to
interact
interact
with
with
the
the
database
database
on
on
the
the
server,
server
we
we
tell
tell
Prisma
prisma
to
to
generate
generate
the
the
client
client
library,
library
import
import
the
the
client
client
into
into
a
a
script
script
file
file
and
and
notice
notice
how
how
it
it
auto
auto
completes
completes
the
the
models
models
in
in
the
the
schema.
schema
If
if
you
you
do
do
something
something
wrong,
wrong
you'll
you'll
know
know
about
about
it
it
right
right
away.
away
Now,
now
find
find
all
all
the
the
humans
humans
with
with
the
the
find
find
many
many
method.
method
To
to
filter
filter
the
the
results,
results
we
we
can
can
add
add
a
a
where
where
clause
clause
as
as
a
a
plain
plain
JavaScript
javascript
object.
object
And
and
if
if
we
we
want
want
to
to
join
join
a
a
related
related
table,
table
we
we
can
can
do
do
that
that
by
by
adding
adding
the
the
include
include
object.
object
Prisma
prisma
already
already
knows
knows
how
how
to
to
run
run
the
the
complicated
complicated
SQL
sql
code
code
under
under
the
the
hood
hood
and
and
returns
returns
the
the
data
data
as
as
an
an
array
array
of
of
JavaScript
javascript
objects
objects
ready
ready
to
to
use
use
in
in
your
your
application.
application
This
this
has
has
been
been
Prisma
prisma
in
in
100
100
seconds.
seconds
Tense.
tense
If
if
you
you
wanna
wanna
see
see
more
more
short
short
videos
videos
like
like
this,
this
hit
hit
the
the
like
like
button
button
and
and
subscribe,
subscribe
and
and
let
let
me
me
know
know
if
if
you
you
wanna
wanna
see
see
a
a
full
full
Prisma
prisma
tutorial
tutorial
in
in
the
the
comments.
comments
Thanks
thanks
for
for
watching
watching
and
and
I
i
will
will
see
see
you
you
in
in
the
the
next
next
one.
one
success
In this video, the speaker explains the benefits of using a thirteen-year-old open source tool called Prisma for writing SQL code and addressing automation problems in database development. The tool has its own schema and can be used in a human readable way, making it easier to manage data structures and work with existing database models. Prisma also provides assistance with creating a new pipeline and filtering results, as well as a tutorial on SQL code and its use.
Prisma in 100 Seconds
Prisma, an open source tool that makes it fun and safe to work with your database. The relational database is ancient technology that has stood the test of time, but writing SQL code is not an ideal abstraction for modern app development. It provides too much low level control and you'll probably blow your foot off writing tit. To address this concern, ORMs like SQLize implement object relational mapping to express data with object oriented code like JavaScript classes. Prisma is also an ORM that addresses similar problems, but instead, it has its own declarative schema nation language. You write a schema to express your data and relationships in a human readable way, or the schema can be automatically inferred from any existing database. Prisma then converts the schema 2 type definitions, allowing you to perform type safe CRUD operations with your own database models, which means you get IDE auto completion tailored to your own custom schema. In addition, it handles migrations patients as your data structure evolves. And if you want to visualize your data, Prisma Studio allows you to view and manage all of your tables and rows in the browser. To get started, you'll need a relational database like MySQL or Postgres, although MongoDB is supported as well. From a Node. Js project run npxprisma init. This creates a dotenv file where you can add your database URL and a Prisma directory to define the schema. If the existing database already has data, we can run prisma db pull to introspect it and automatically generate the schema from it. Notice how each table is represented with model keyword. Then inside the braces, we have column names and their data types, as well as optional constraints. Like for example, we might use relation to create a foreign key constraint train between a weapon and a human, and we can also index the weapon ID while we're at it. The beauty of this is that the code is significantly more concise than what you would write otherwise ties in raw SQL. Now, if we decide to modify our schema, like add an extra timestamp column, we'll also need to modify the database structure which can be handled automatically with the Prisma migrate command. Now to interact with the database on the server, we tell Prisma to generate the client library, import the client into a script file and notice how it auto completes the models in the schema. If you do something wrong, you'll know about it right away. Now, find all the humans with the find many method. To filter the results, we can add a where clause as a plain JavaScript object. And if we want to join a related table, we can do that by adding the include object. Prisma already knows how to run the complicated SQL code under the hood and returns the data as an array of JavaScript objects ready to use in your application. This has been Prisma in 100 seconds. Tense. If you wanna see more short videos like this, hit the like button and subscribe, and let me know if you wanna see a full Prisma tutorial in the comments. Thanks for watching and I will see you in the next one.
In this video, the speaker explains the benefits of using a thirteen-year-old open source tool called Prisma for writing SQL code and addressing automation problems in database development. The tool has its own schema and can be used in a human readable way, making it easier to manage data structures and work with existing database models. Prisma also provides assistance with creating a new pipeline and filtering results, as well as a tutorial on SQL code and its use.