Skip to content
LogoLogo

How to deploy an app

This guide shows you how to deploy a release version of an app. Each project that installs the app gets the newest release version.

Before you start, you need an app directory with a picked.config.ts file and a server that uses @picked/app-kit. The app section of picked.config.ts is the manifest. Build and install your first app makes both.

1. Deploy the server

Deploy the server code before you deploy the manifest. Put it at the endpoint that the manifest names.

Picked sends a request to the endpoint when a person installs or upgrades the app. If the server does not accept the request, Picked does not do the change and shows an error. A new workflow tool fails until the server has the code for it.

To put the server on Vercel, refer to How to host an app on Vercel.

The production dashboard sends requests only to a public https endpoint. Refer to Delivery.

2. Set the private key of the app

The CLI registers the public key of PICKED_APP_PRIVATE_KEY with the app. The server uses the same private key to call Picked. The CLI does not send the private key.

Set the variable in the shell that runs the CLI:

export PICKED_APP_PRIVATE_KEY='MC4CAQAwBQYDK2VwBCIEI…'

If the app has no key yet, make one with picked app keys generate. Refer to How to rotate an app key.

If the app holds the key already, the CLI keeps it. If the app holds two different keys, the CLI stops with An app holds at most 2 public keys; remove one before adding another.

The other key variables and messages of the CLI are in CLI variables.

3. Sign in the CLI

Sign in with your account:

npx picked login

You must have these scopes in the organization:

DeployScope
The first deploy of a handleorganization_apps/create
Each later deploy of the same handleorganization_apps/update

To deploy from CI, use an API key in place of picked login. Refer to Deploy from CI.

4. Deploy the manifest

In the app directory, deploy the manifest. Put the slug of your organization in place of acme:

npx picked app deploy --org acme
Deployed Lead Insights (lead-insights) version 1 [app_…]

The command does these things:

  • It reads the app section of picked.config.ts, picked.config.js or picked.config.json, in that order. Refer to The app section of picked.config.
  • It checks the manifest. If the manifest has errors, it shows each one below picked.config `app` is not a valid app manifest: and deploys nothing.
  • It registers the public key of PICKED_APP_PRIVATE_KEY.
  • It deploys the manifest as the next release version.

--org takes the slug or the ID of the organization. You can leave it out when your account is in one organization only. If your account is in more organizations, the command stops with Name the organisation with --org: and a list of the slugs.

The first deploy of a handle makes the app. The value in [ ] is the app ID. Each Picked environment gives the app a different app ID. The dashboard also shows the app ID on the page of the app, under App ID.

picked.config.ts is code. The CLI runs it when it reads the manifest, so the manifest can read process.env. For example, it can read the endpoint from a variable:

import { defineConfig } from '@picked/config/define'
 
const endpoint = process.env.APP_PUBLIC_URL ?? 'http://localhost:4103'
 
export default defineConfig({
  app: {
    handle: 'lead-insights',
    name: 'Lead Insights',
    endpoint,
    slots: [{ location: 'app-home', url: `${endpoint}/`, title: 'Recent leads' }],
  },
})

When nothing changed

If the manifest is the same as the newest release version, the command writes no version:

Lead Insights (lead-insights) is unchanged: the manifest matches version 1 [app_…]

The order of the keys in the manifest has no effect on this comparison. So you can run the command on each build.

An app that you made in the dashboard

The CLI can deploy an app that you made on the New app page. After the first CLI deploy, the app has the badge Deployed with the CLI. From then on, you cannot change the manifest in the dashboard. A dashboard deploy fails with <name> is deployed with the Picked CLI; deploy changes with picked app deploy.

5. Upgrade the installations

Picked does not move an installation to the new version. Each project that has the app shows New version available next to it. A person in the project chooses Upgrade and accepts the access of the new version. Refer to How to upgrade or uninstall an app.

A release version has no effect on an installation that uses a dev version. That installation upgrades only to a dev version.

Deploy from CI

When PICKED_API_KEY is set, the CLI sends the API key and needs no picked login session.

  1. Make an API key of the organization. Set its Project to All projects. Refer to Create a key.
  2. In Permissions, below Apps, choose Create and install apps and Deploy app versions and upgrade installations.
  3. Keep the API key and the private key of the app in the secret store of your CI.
  4. Find the ID of the organization. Project Settings shows it as Organization ID.
  5. Run the CLI after the step that deploys the server.

With an API key, --org must be the ID of the organization. An API key cannot read the list of the organizations. A slug, or no --org, gives this error:

Not signed in as a user, or no organizations are visible to this account. An API key has no organization list.

This GitHub Actions step deploys the manifest:

- name: Deploy the app manifest
  env:
    PICKED_API_KEY: ${{ secrets.PICKED_API_KEY }}
    PICKED_API_URL: https://api.picked.app
    PICKED_APP_PRIVATE_KEY: ${{ secrets.PICKED_APP_PRIVATE_KEY }}
    APP_PUBLIC_URL: https://lead-insights.example.com
  run: npx picked app deploy --org 3f6c2a1e-8b4d-4c2a-9e7f-5d1b0a9c8e72

PICKED_API_URL sets the Picked environment. Each Picked environment keeps a different copy of the app. Refer to Values for each Picked environment.

API and MCP

You can also do this task with the Management API, the MCP server, or code that you send to picked_run.

TaskGraphQLMCP toolRun
Deploy a release versionappDeployNoneNone

The CLI sends appDeploy with source: CLI, channel: RELEASE and the public key in publicKey.