Skip to content

About

Meta-model, sample models, mock data, and scripts to build CRUD Apps with models rather than codeModels for Evolutility apps (metamodel, sample apps, demo data), and scripts to generate the SQL for the database: the tables, the data, and the models themselves (stored as JSON).

Topics

Resources

Stars

12 stars

Watchers

3 watching

Forks

Repository files navigation

Evolutility-Models · GitHub license npm version

Evolutility-Models provides a metamodel, sample models, mock data, some scripts, and a process, to build applications with models rather than code.

Write simple models, and use them to generate your Database, your REST endpoints, and your Web UI automatically.

Contents

Metamodel

Models

Scripts

License

Metamodel

The metamodel is the structure of the model (the model of models). I think about it as the language for making models.

Models describe objects with fields, Field groups, and collections (nested lists of objects).

For every object, all UI views (List, Cards, Edit, Charts...) use the same model as the single source of truth.

All Fields are present in the Edit and Browse views. Fields can be flagged as "inMany" to be included in List, Cards, and Charts views.

export default {
  id: "todo",
  label: "To-Do List",
  name: "task",
  namePlural: "tasks",
  icon: "todo.png",
  titleField: "title",
  table: "task",
  fields: [
    {
      id: "title",
      label: "Title",
      type: "text",
      width: 100,
      required: true,
      inMany: true,
      inSearch: true,
      column: "title",
      maxLength: 255
    },
    {
      id: "duedate",
      type: "date",
      label: "Due Date",
      width: 38,
      inMany: true,
      column: "due_date"
    },
    ...
  ]
}

Object

Property Meaning UI BE
id Unique key to identify the entity (used as API parameter). X X
icon Icon file name for the entity (example: "cube.png"). X
world Application the object belongs to (e.g. "organizer"). X X
name Object name (singular) (e.g.: "contact"). X
namePlural Object name (plural) (e.g.: "contacts"). X
title Application name (e.g.: "Addressbook"). X X
fields Array of fields. X X
groups Array of groups. If not provided a single group will be used. X
collections Array of collections (displayed as Lists). X X
titleField Id of the field whose value is used as record title. titleField can also be a function. X X
titleFunction Function to calculate the record title based on its data. Example: titleFunction = (d) => d.firstname + " " + d.lastname; X X
table Driving database table name (there are secondary tables for fields of type "lov"). X
pKey Name of the Primary key column (single column of type serial). Defaults to "id". In the data the key is always called "id". X
defaultViewMany Default view for Many records (possible values: list, cards, charts). X
defaultViewOne Default view for One record (possible values browse, edit). X
noStats Do not provide Stats view for this objct. X X

UI: The property is used in UI models. BE: The property is used in the Backend models.

Field

For the backend, fields are columns in a database table. For the frontend, fields are textboxes, checkboxes, datepickers... in Edit view, and they are columns in List view.

Property Meaning UI BE
id Unique key for the field (can be the same as column but doesn't have to be). X X
type Field type to show in the UI. Possible field types:
  • boolean (yes/no)
  • date
  • datetime
  • decimal
  • document
  • email
  • image
  • integer
  • json
  • list (multiselect)
  • lov (list of values)
  • money
  • text
  • textmultiline
  • time
  • url
X X
label Field description (displayed with an asterisk for required fields). X
labelShort Optional shorter version of the labels (used in List and Cards views). X
labelEdit Optional alternative label used in Edit view (instead of label). X
required Determines if the field is required for saving. X X
readOnly Field value cannot be changed. X X
defaultValue Default field value for new records. X X
hideIfEmpty Hide field when empty in Browse view. X
dependantField ID of an optional dependent field. Used when selecting in one list changes the content of the dependent list (among 2 fields of type "lov"). X X
max, min Maximum/Minimum value allowed (only applies to numeric fields). X X
maxLength, minLength Maximum/Minimum length allowed (only applies to text fields). X X
regExp Regular expression used to validate the field value. X X
inMany Determines if the field is present (by default) in lists of records. X X
inSearch Determines if the field is used in text searches. X
height For fields of type "textmultiline", number of lines used in the field (in Browse and Edit views). X
width Field width in Browse and Edit views (in percent of parent width). Default: 100% X
help Optional help on the field. X
chartType Default charts type used for the field ("Bars", "Pie", or "Table"). The default value is "Bars". X
search Include field in search. X X
noFilters Exclude field from filters (only applies to fields of type integer, decimal, money, boolean, list of values which are "chartable"). X X
noCharts Exclude field from charts (only applies to fields of type integer, decimal, money, boolean, list of values which are "chartable"). X X
noStats Exclude field from stats. X X
column Database column name for the field. X
pii Flag for personally identifiable information. X
lovTable Table to join to for field value (only for fields of "lov" type). X
lovColumn Column name (in the lovTable) for field value (only for fields of "lov" type). X
lovKey Primary key column name (in the lovTable) (default to "id"). X
lovIcon LOV items have icons (only for fields of "lov" type). X X
deleteTrigger Deleting records in the lovTable will trigger a cascade delete (this property is only used for creating the database). X
object Model id for the object to link to (only for fields of "lov" type). X X
unique Field value must be unique. X X

UI: The property is used in UI models. BE: The property is used in the Backend models.

Field Group

Field Groups are used to visually group fields on the page for browsing or editing.

Field Groups are only used in UI models and are optional. By default a single group holds all fields.

Property Meaning UI BE
id Unique key for the group. It is optional. X
type Type of group. Only "panel" is currently implemented ("tab" and "accordion" will be added later). X
label Group title as displayed to the user. X
fields Array of field ids. X
width Width (in % of the container total width). X
help Optional help tooltip text. X
header Text to be displayed at the top of the group (just below the group title). X
footer Text to be displayed below the group. X

UI: The property is used in UI models. BE: The property is used in the Backend models.

Collection

Multiple Master-Details can be specified with collections.

Property Meaning UI BE
id Unique key for the collection. X X
title Collection title. X
table Table to query for the details list. X
column Column in the details table to match against object's id. X
object Model id for the object to link to. When specified, "column" and "table" can be omitted. X X
hideIfEmpty Hide Collection when it is empty in Edit view (always hidden when empty in Browse view). X
order Direction to order by "asc" or "desc". X
orderBy SQL order by clause, e.g. { orderBy: "id" }. X
fields Array of fields. Collections are not editable so their fields do not need as many properties as the main object's fields. X X
help Optional help tooltip text. X
header Text to be displayed at the top of the collection. X
footer Text to be displayed below the collection. X

UI: The property is used in UI models. BE: The property is used in the Backend models.

Sample models

Demo Apps

Models are descriptions of objects and their properties/fields, field groups, and sometimes nested-collections.

Organizer

Music

Test

Scripts

Evolutility-Models provides scripts (TypeScript in NodeJS) to generate the SQL for the database: the tables and data, and the models themselves. Evolutility-Server-Node and Evolutility-UI-React get the models from the database.

Database

Generate SQL script to create a Postgres DB with tables for all models.

In the command line type the following:

# Install dependencies
npm install

# Create SQL for sample database w/ demo tables
npm run codegen:db

The SQL scripts for creating the database and populating it are generated in the "/dist/db/sql/" directory

  • 001_create_db_{datetime}.sql to create the database
  • 002_seed_data_{datetime}.sql to populate the database with seed data
  • 003_create_models_{datetime}.sql to create the tables "evol_model" (one JSON document per model) and "evol_model_history" (every saved version of the models)
  • 004_seed_models_{datetime}.sql to store the models in the database (full models with UI and DB properties)
  • 005_create_users_{datetime}.sql to create the tables "evol_user" (users with a role: viewer, editor, or admin) and "evol_session" (login sessions). No user is created: create the first one with Evolutility-Server-Node (npm run user:add -- you@example.com admin, or npm run user:add -- you@example.com admin --name="Your Name" --password=a-long-password).

Storing models in the database lets Evolutility-Server-Node serve them and lets you edit them in the app.

The models script can run again after changing models: models that changed get a new version (the previous one is kept in the history), and the others are left alone. A model edited in the app is replaced by the version from the files.

To only generate the SQL for the models:

npm run codegen:db:models

Pull models from the database

Models edited in the app (with the Designer of Evolutility-UI-React) are saved in the database. To bring these changes back into the model files:

# Models that changed (or "--dry-run" to only list them)
npm run models:pull

# Only some models
npm run models:pull -- todo contact

Changed models are written in their file, and new models in "models/{world}/{id}.ts" (added to "models/all_models.ts"). Models only in the files are left alone. The files are written in the form stored in the database, so the SQL generated next is the same as the database (running it again changes nothing).

The database is set in "config.ts" ("connectionString") or with the environment variable DATABASE_URL.

Note: Models are stored in full (UI and DB properties). The UI and the back-end ignore what they do not need.

License

Evolutility-Models is released under the MIT license.

Copyright (c) 2026 Olivier Giulieri.

About

Meta-model, sample models, mock data, and scripts to build CRUD Apps with models rather than codeModels for Evolutility apps (metamodel, sample apps, demo data), and scripts to generate the SQL for the database: the tables, the data, and the models themselves (stored as JSON).

Topics

Resources

Stars

12 stars

Watchers

3 watching

Forks

Releases

Packages

Used by

Contributors

Languages