Skip to main content

Create an entity

An entity is an object often linked to a real world concept like users, customers, videos etc. Creating an entity in manifest generates CRUD endpoints that can be used by the REST API or the SDK.

All entities are located in the backend.yml file under the entities property.

Syntax

Let's see a simple example:

# manifest/backend.yml
name: A pet app

entities:
😺 Cat:
properties:
- name
🐶 Dog:
properties:
- name

This file will generate the Cat and Dog entity both with a name property. You can now add your own pets through the admin panel!

Dummy data is crucial for app development and testing. You can generate dummy data for all your entities with the simple command:

npm run manifest:seed
warning

The seed replaces the previous data by the new one and thus should never be used in production.

Entity params

You can pass different arguments to configure your entities. Example:

entities:
👤 Member:
seedCount: 200
mainProp: lastName
properties:
- firstName
- lastName
- email
OptionDefaultTypeDescription
nameSingularsingular lower case namestringThe singular lowercase name of your entity. Used widely on the admin panel.
namePluralplural lower case namestringThe plural lowercase name of your entity. Used widely on the admin panel. Default: plural lowercase name.
slugplural dasherized namestringThe kebab-case slug of the entity that will define API endpoints.
mainPropfirst string fieldstringIdentifier prop. Used widely on the admin panel
seedCount50numberthe number of entities to seed when running the seed command.