Define your App
How to use App Specs to define your app to the platform before writing the business logic
Your app is described to the platform by App Spec files which you control and update via Studio's Developer interface.
App Specs tell Studio how to display your App Setup settings, interactive content Elements, and other Services. Learn more about App Spec files here.
Let's make your first App Spec.
Create your App Spec
The App Spec has a root and then child JSON files which describe amongst other things:
Elements: which content Elements are enabled such as poll, vote or prediction
Configuration in Studio: how your users will configure styling, object visibility, gamification settings
Extensions: which features are enabled, for example, Gamify, Identify, Vote, or Forms
Example Root App Spec file:
When developing a new app from scratch, you’ll first need to upload a starter App Spec which you can edit later.
You can download the app spec below as a basis, but please ensure you follow the next section to update the relevant parts.
Create an empty App Spec
The first step in the creation of an App Spec is to create the required JSON files. The resulting file structure should look like this:
Where:
elements.json
andfields.json
contain an empty arrayproject_settings.json
contains a JSON object with a property called sections that contains an empty array.spec.json
contains an empty JSON object.
Once the structure is created, update the spec.json
file with the following content:
Where:
name
is the user-friendly name that will be visible in Studioid
is the unique identifier for the appversion
is the version of the app. We recommend using semantic versioning.schedule
specifies whether events are supported in the project or not.base_apps_url
is the Base URL for App location.dash_image
is the URL to the app logo that will be displayed in Studiofields
is a pointer to the fields.json file that you have created alongside spec.json. This guide assumes you’ll upload these files to a server so you havehttps://yourhosting.com/apps/spec/spec.json
alongsidehttps://yourhosting.com/apps/spec/fields.json
and so onelements
is akin to fields, but pointing to elements.jsonembed_url
is the URL that will be used when embedding your appproject_settings
is akin to fields but pointing to project_settings.jsonlocalisation
specifies whether to support multiple locales or not in the app.
Add Project Settings into the App Spec
Open the project_settings.json
file in your text editor and add the following lines:
With this settings file you’ll be able to specify the title of your application from Studio. This may seem a bit trivial, but the same mechanism can power plenty of functionality within your app such as:
White labelling and styling your UI
Feature flagging
Hosting metadata of your app
Reacting in real-time to changes in the metadata
Add a Poll Element into the App Spec
As it stands, your App Spec will not yet have defined any interactive Elements. Let’s go ahead and create a Poll Element so we can add interactivity in our app.
To do so, open elements.json
in your text editor and enter the following JSON:
Deploy your App Spec to a public URL
In order to use your App Spec, the platform needs to be able to load its files from the internet, so make sure you can see them if you paste the URL into your browser. There are at least two ways to achieve this:
Upload the production build to the CDN of your choice. This approach is useful when you want to distribute the final result to all users.
Expose the local server to the public using a tunneling service, such as ngrok or localtunnel. This method is useful when you want to tinker with the source code and check the changes in real time.
During development, you’ll likely want to iterate through changes in App Spec quickly. We find that exposing your local copy of the App Spec by a reverse proxy services maximises developer efficiency by reducing deployment delays.
To upload the production build to a Content Delivery Network (CDN), various options are available. At Monterosa, we utilise AWS S3 along with the AWS CLI for transferring files to the CDN:
Last updated