# User entity

Now that we have our project configured, we can start marching towards our main objective - developing our shop backend system. Let's create the <mark style="color:blue;">**`User`**</mark> resource. We shall do so inside the <mark style="color:purple;">domain</mark> folder, to group domain's entities together.

```sh
nest g res domain/users
```

{% hint style="info" %}
Choose the following options

* Transport Layer - **REST API**
* CRUD entry points - **Yes**
  {% endhint %}

The nest resource includes:

* The **entity** class
* **DTO**s for creating and updating an entity
* A **module** to encapsulate this context
* A **controller** with the basic routes for this entity
* A **service** with the logic for the routes
* Automated **tests**

But right now, we should focus on the entity class. So let's go to <mark style="color:purple;">src</mark>/<mark style="color:purple;">domain</mark>/<mark style="color:purple;">users</mark>/<mark style="color:purple;">entities</mark>/<mark style="color:purple;">user.entity</mark>.

{% hint style="info" %}
When the file extension is not shown, you can consider that it is a TypeScript (<mark style="color:purple;">.ts</mark>) file.
{% endhint %}

Inside the class, we will insert the entity's attributes.

```typescript
id: number;
name: string;
email: string;
phone: string;
password: string;
```

After that, we should copy all these fields (except <mark style="color:blue;">`id`</mark>) and paste them in the <mark style="color:purple;">create-user.dto</mark> file located in the <mark style="color:purple;">dto</mark> folder inside <mark style="color:purple;">users</mark>. This process will be necessary for the next lesson.

{% hint style="info" %}
Some tips:

* Prefixing DTO fields with <mark style="color:blue;">readonly</mark> is a good practice
* The **ALT + CLICK** allows for multiple cursors, and thus prefixing all the fields at once
  {% endhint %}

<mark style="color:green;">**Commit**</mark> - Creating the first entity
