Each entity is composed of fields which define the attributes of that entity, such as name, email, or price. This page will guide you through creating and configuring entity fields within Amplication.

The Entities, Fields, and Relationships features are currently available for projects using Node.js and .NET blueprints.

Create New Fields

1

Navigate to the Entity Screen

Click the Entities icon in the main menu (left toolbar). This will display a list of all entities in your application.

2

Select an Entity

Click on the entity you want to modify. This will open the Entity’s page, displaying its existing fields.

3

Add a New Field

Type the name of your field.

4

Configure Field Details

  • Display Name: The user-friendly name shown in the Amplication UI (e.g., “Customer Email”)
  • Name: The camelCase name used in code and APIs (e.g., customerEmail)
  • Description: Optional context about the field’s purpose (e.g., “Primary email address for customer communications”)

You can use Amplication’s AI, Jovu, to simplify field creation for your entities using natural language.

Field Settings

Each field offers optional settings to control its behavior and constraints:

Available Data Types

Select the appropriate data type to define what kind of information your field will store. Each data type is optimized for specific use cases and provides built-in validation and handling.

Single Line Text

For short text strings like names or titles. You can set a maximum length to enforce data constraints.

Multi-Line Text

For longer text content like descriptions or notes. You can configure a maximum length.

Email

Specifically for email addresses, ensuring data is in a valid email format.

Username

Optimized for usernames, with a configurable maximum length.

Password

Designed for storing passwords securely. You can set a maximum length.

Whole Number

For integer values. You can select the database field type (Integer or Big Integer) and set minimum and maximum allowed values.

Decimal Number

For numbers with decimal places. You can choose the database field type (Decimal or Float), define minimum and maximum values, and set the precision level.

Date Time

For storing date and time information. You can choose between Local Time and Server Time and specify if it should include both date and time or just the date.

Boolean

For true/false values.

JSON

For storing flexible, schema-less data in JSON format. Excellent for custom fields and adapting to evolving data needs.

Option Set

For fields that can only take one value from a predefined list of options (single-select dropdown).

Multi-Select Option Set

Similar to Option Set but allows selecting multiple options from the list (multi-select dropdown).

Geographic Location

For storing geographic coordinates.

File

For storing file metadata. Configure maximum file size, allowed MIME types, and container path for file storage.

Roles

For managing user roles and permissions within your application.

Relation to Entity

Used to establish connections between different entities.

Default Fields

Amplication automatically creates essential fields for every entity:

  • id: A unique identifier for each entity instance. By default, it’s a CUID, but you can customize it to UUID, auto-increment integer, or auto-increment big integer.
  • createdAt: Automatically tracks the creation timestamp of each entity instance.
  • updatedAt: Automatically updates with the timestamp whenever an entity instance is modified.

Advanced Customization

For developers who need fine-grained control over their fields, Amplication provides Custom Attributes. These attributes allow you to directly leverage Prisma’s powerful schema customization features within the Amplication UI.

Advanced Customization is only available for Node.js blueprints.

You can add field-level attributes (prefixed with @) to customize individual field properties. These are accessible in the Custom Attributes text field within each field’s settings page.

Common field-level attributes include:

  • @unique: Enforce uniqueness for a field
  • @default(...): Set a default value
  • @map("column_name"): Map to a different column name
  • Native database types: Specify database-specific data types (e.g., @db.VarChar(200))

Refer to Prisma’s documentation on field attributes for a comprehensive list of available attributes and functions.

Next Steps

Now that you understand how to work with fields, explore these related topics to build more sophisticated data models: