Skip to content

evoluteur/evolutility-models

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

147 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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 thuth.

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 const = {
  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 which value is used as record title. titleField can also be a function. X X
titleFunction Function to calculate the record title based it's 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). Default 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

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 dependant field. Used when selecting in one list changes the content of dependant list (among 2 fields of type "lov").records. 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 Determine 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
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 "accordeon" 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 where 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 description of objects and their properties/fields, field groups, and sometimes nested-collections.

Organizer

Music

Designer (Models of models)

With models of models, we can store models in the database (instead of JSON files) and have an app to build other apps.

Test

Scripts

Evolutility-Models provides scripts (TypeScript in NodeJS) to transform your models.

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 creation 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

Models

This project provides scripts to make UI-models for Evolutility-UI-React and DB-models for Evolutility-Server-Node from models.

# Install dependencies
npm install

# Generate DB and UI models
npm run codegen:models

## Generate DB models
npm run codegen:models:db

## Generate UI models
npm run codegen:models:ui

Generated models are saved in the directories /dist/ui/models and /dist/db/models.

For generating SQL scripts and models in one go:

# Create SQL scripts and models
npm run codegen

Note: The full models can be used as they are by both UI and back-end (which ignore what they do not need in the models).

License

Evolutility-Models is released under the MIT license.

Copyright (c) 2026 Olivier Giulieri.

Packages

 
 
 

Contributors