# Publishing Applets to Apps

## Why would you transition from an applet to an app? <a href="#why-would-you-transition-from-an-applet-to-an-app" id="why-would-you-transition-from-an-applet-to-an-app"></a>

{% tabs %}
{% tab title="Applets " %}
**Purpose:** Applets are meant for development and to experiment with the parameters and analysis.

**Perks:** Applets are data objects that are easy to collaborate, members of the project can edit the code, and publish

**Goal:** Applets allow for increased efficiency in usage + ability to edit code efficiently
{% endtab %}

{% tab title="Apps" %}
**Purpose:** Apps are meant for stable applets, ready to use, and possibly moved to a wider audience.

**Perks:** Once apps are published, the app cannot be modified version control enforced can carry assets in their own private container.

**Goal:** Apps allow for increased efficiency in usage + enhance reproducibility and minimize risk.
{% endtab %}
{% endtabs %}

## Differences between an App and Applet <a href="#differences-between-an-app-and-applet" id="differences-between-an-app-and-applet"></a>

<table data-view="cards"><thead><tr><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td>Applets</td><td><strong>Location:</strong> in Projects</td><td><p><strong>Naming Structure:</strong> project:/applet_ID</p><p>project:/folder/name</p></td><td>Can</td></tr><tr><td>Apps</td><td><strong>Location:</strong> in the Tool Library, so long as you are a developer or an authorized user</td><td><strong>Naming Structure:</strong> app-name or app-ID</td><td></td></tr></tbody></table>

{% tabs %}
{% tab title="Applets" %}
**Location:** Applets are located in projects as a data object

**Naming Structure:** Applets have paths like any other data object. The options are: *project:/applet\_ID* or *project:/folder/name*

**How are they shared?** Applets are shared through projects as a data object.

**How are they updated?** Applets are updated through dx build, where you can either overwrite or archive the previous applet with the same name, and create a new, updated applet

**Versioning?** No versioning is present at the applet applet creation.
{% endtab %}

{% tab title="Apps" %}
**Location:** Apps are located in the Tool Library, so long as you are a developer or an authorized user

**Naming Structure:** Apps are published, and can be referenced without a path. The options are: app-name or app-ID

**How are they shared?** App developers manage a list of users who are authorized to access the app.

**How are they updated?** Apps are updated through dx build, where you will provide a new version with each edit.

**Versioning?** Each time the app is built, it must be given a new version.
{% endtab %}
{% endtabs %}

## Checklist of items to keep in mind: <a href="#checklist-of-items-to-keep-in-mind" id="checklist-of-items-to-keep-in-mind"></a>

When publishing an app, the following items are needed:

1. A working applet that you have tested
2. A name that is unique. Generally, the recommendation is to have an abbreviation for your org as part of the name. Example: If the org is named “academy\_demos” and the app is for fastqc, then the name of the app could be “academy-fastqc”, “academy\_demo-fastqc”, or “academydemo-fastqc”.
3. Documentation to add to a README.md for users to understand what your app does
4. Developer notes for you to keep track of version information and added to the Developer README.md
5. A default spending account set up for yourself as the app author. For published apps, they will require storage for their resources and assets, and the storage will be billed on a monthly basis to the billing account of the original author of each app. You can set multiple authors, but the original author is where the billing is tied to.
6. Decide if you want the app to be open source. In dxapp.json, add a key called "openSource" with a boolean value of true or false.
7. A consistent version policy for your meaningful updates. DNAnexus suggests Semantic Versioning.
8. Add authorized users. In dxapp.json, add a key called "authorizedUsers" with a value being an array of strings, corresponding to the entities allowed to run the app. Entities are encoded as user-username for single users, or org-orgname for organizations.

## To Publish the App <a href="#to-publish-the-app" id="to-publish-the-app"></a>

1. Use dx get applet-name to have the most recent version of your applet
2. Make your changes to the dxapp.json
3. Then use `dx build app_name --publish --app`

## Helpful Trick <a href="#helpful-trick" id="helpful-trick"></a>

* Forget to add users or need to add more users? Use:

```
dx add users USER OR ORG NAME OF APP
```

## Resources <a href="#resources" id="resources"></a>

[Transitioning from Applets to Apps](https://documentation.dnanexus.com/developer/apps/transitioning-from-applets-to-apps)

[App Metadata](https://documentation.adapt-tap.dnanexus.com/building-applets/app-metadata)
