Traditionally, we are used to sketch a sample UML diagram in our paper and then draw it in our PC using different tools but now we can do it just by typing out your database model code in db.diagram.io. db.diagram.io is a database diagram designer platform to design and develop your Entity Relationship(ER) diagrams. It is best used for relational database diagram designs.
Let’s get started:
Let’s say that, you are creating ER diagram for user,profile and posts database table. Here, the relation is one to one and one to many only:
- One user has one profile.(one to one)
- One user has many posts.(one to many)
You can visit db.diagram.io/d to type your database model code. You can clear out the initial code there and you will have an empty playground for yourself on the left-side of your screen as below:

Now, you can write your database tables on the left side and it will automatically render your ER-diagram on the right panel of your screen. For user, profile and posts you can write the following code :
Table users{
id integer [primary key]
username varchar
email email
created_at timestamp
}
Table profile{
name varchar
gender varchar
age varchar
created_at timestamp
user_id integer [primary key]
}
Table posts {
id integer [primary key]
title varchar
body text [note: 'Content of the post']
user_id integer
status varchar
created_at timestamp
}
Ref: posts.user_id > users.id // many-to-one
Ref: profile.user_id - users.id // one-to-one
//here Ref: is used to define the relationship amongst the database tables using //foreign key and primary key
The designer website will automatically design your ER-diagram by going through your code. The result looks like this:

This is it, you have sketched an ER-diagram without even sketching. You can further export the image and use it as you like.