DATA STRUCTURES

Creating WebApps from the CLI

6min
we are using 99 as an example webapp id in this doc depending on the webapp id that you'd like to use, replace 99 with the correct id keep in mind that if you already have webapps in the site you are working on then then some webapp ids may already be reserved webapps in siteglide rely on 3 different files to work correctly json structure used by siteglide admin and front end to define structure of the webapp with user friendly names, and other ui metadata schema used to define the database structure itself form configuration used when submitting webapp items front end there are 2 ways to create/edit a webapp via cli safest create/edit the json structure file ( marketplace builder/views/partials/tables/webapps/99 liquid ), and then in siteglide admin simply click 'save' in the table builder view this will generate a matching form configuration and schema file most flexible create/edit each of the 3 files manually however, this relies on you keeping all 3 files in sync json structure this is used by siteglide admin to output webapp field data with user friendly names and other ui options (order, field type, etc ) location marketplace builder/views/partials/tables/webapps/99 liquid contents { &#x9;"id" 99, &#x9;"type" "webapp", &#x9;"name" "my cli webapp", &#x9;"slug" "my cli webapp", &#x9;"detail" true, &#x9;"detail template" "templates/1", &#x9;"detail default layout" "default", &#x9;"sz" false, &#x9;"sz updated" true, &#x9;"sz display type" "404", &#x9;"system fields" { &#x9; "name" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "slug" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "weighting" { &#x9; "type" "integer", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "release date" { &#x9; "type" "integer", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "expiry date" { &#x9; "type" "integer", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "enabled" { &#x9; "type" "boolean", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "category array" { &#x9; "type" "array", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "meta title" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "meta desc" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "og title" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "og desc" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "og type" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "twitter type" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "secure zone array" { &#x9; "type" "array", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "location" { &#x9; "type" "geojson", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "address" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "og image" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; }, &#x9; "og url" { &#x9; "type" "string", &#x9; "editable" true, &#x9; "hidden" false, &#x9; "live" true, &#x9; "order" 0, &#x9; "required" false &#x9; } &#x9;}, &#x9;"custom fields" { &#x9; "webapp field 99 1" { &#x9; "name" "custom field", &#x9; "type" "input text", &#x9; "live" true, &#x9; "order" 1, &#x9; "editable" true, &#x9; "hidden" false, &#x9; "required" false &#x9; } &#x9;}, &#x9;"automations" {}, &#x9;"install to site" true, &#x9;"use standard fields" true } please see the field types https //developers siteglide com/field types document for all the relevant types schema file this is what defines the database table structure, and how data will be stored location marketplace builder/custom model types/webapps/webapp 99 yml contents \ name webapp 99 properties \ name name type string \ name slug type string \ name weighting type integer \ name release date type integer \ name expiry date type integer \ name enabled type boolean \ name category array type array \ name meta title type text \ name meta desc type text \ name og title type text \ name og desc type text \ name og image type text \ name og type type string \ name twitter type type string \ name full slug type string \ name secure zone array type array \ name location type geojson \ name address type text \ name webapp field 99 1 attribute type string \ the above are all the default fields that are needed, the last field is an example of a standard text field please see the field types document for all the relevant types form configuration this is used when submitting a webapp item front end this file was also previously used to output webapp structure data in siteglide admin, but that is now the job of the json structure file location marketplace builder/form configurations/webapps/webapp 99 liquid contents \ name webapp 99 resource webapp 99 resource owner anyone configuration properties webapp name name webapp name value 'my cli webapp' property options virtual true webapp slug name webapp slug value 'my cli webapp' property options virtual true webapp detail name webapp detail value true property options virtual true webapp detail template name webapp detail template value 'templates/1' property options virtual true webapp detail default layout name webapp detail default layout value 'default' property options virtual true webapp sz name webapp sz value false property options virtual true webapp sz updated name webapp sz updated value false property options virtual true webapp sz display type name webapp sz display type value '404' property options virtual true name name name type string slug name slug type string weighting name weighting type integer release date name release date type integer expiry date name expiry date type integer enabled name enabled type boolean category array name category array type array meta title name meta title type string meta desc name meta desc type string og title name og title type string og desc name og desc type string og image name og image type string og type name og type type string twitter type name twitter type type string full slug name full slug type string secure zone array name secure zone array type array location name location type geojson address name address type string webapp field 99 1 name "custom field" type input text live true hidden false order 1 editable true required false validation {} \ {% capture form layout %}layouts/webapps/webapp 99/form/{{ layout}}{% endcapture %} {% include form layout %} after both the above files are synced you will then need to refresh siteglide admin and your webapp will appear under webapps in the sites left hand menu layouts if you need layouts for your webapp, these will be saved to marketplace builder/views/partials/layouts/webapps/webapp 99/detail/default liquid marketplace builder/views/partials/layouts/webapps/webapp 99/list/default liquid both files contain the following layout by default \<p>{{this\['name']}}\</p>