---
title: Build, test and publish an app
description: Build a new app or bring existing code, test it locally and in development, then publish the tested version to production.
slug: /getting-started/build-test-and-publish-an-app
order: 14
visibility: public
redirects_from: []
---

# Build, test and publish an app

Prompt:

> Build me a notes app with sign-in. Let me test it before you put it live.

Start with [a template or the code you already have](#1-start-from-a-template-or-existing-code). Then follow the linked steps to test your app and put the checked version into production. Choose serverless for a new app with static files, functions, or both unless [the app needs a server](/cloud/concepts/serverless-applications-and-servers/#choose-the-kind).

## What your AI does

Your AI assistant writes or adapts the app, tests its behavior, and deploys it to a development environment. It promotes the tested version when you ask, then checks production.

## What you need

- An AI assistant connected and signed in through [Connect your AI assistant](/cloud/getting-started/connect-your-tool/), or a computer with a token that covers the required actions. For the token route, follow [With an existing token](/cloud/guides/deploy-with-nobody-at-the-keyboard/#with-an-existing-token).
- A description of what the app should do, or access to the existing project's files.
- For local runs and tests, the software in [What your computer needs](/cloud/getting-started/prerequisites/). Its [Windows PowerShell section](/cloud/getting-started/prerequisites/#windows-powershell) gives the Windows commands.

Without a shell, use [Deploy from a chat](/cloud/getting-started/build-an-app-from-a-chat/) for the file workflow. Your AI assistant can check the hosted app, but it reports local tests as not run.

## Before your AI starts

Your AI should confirm the intended behavior, the project folder, and whether this is a new or existing application. For a server, ask the person to choose a size. [Size and usage](/cloud/guides/plan-and-usage/) explains the choices. If nobody can answer, follow the behavior the request states and keep any size it names. For a server without a named size, use the unattended default in `skill:deploy:prepare` and report the choice. When you build a demo, there is no free plan or tier to select, and its charges draw first from the account's monthly [Free Allowance](/cloud/guides/stay-inside-the-monthly-free-usage/).

Before the first deploy of the person's app, tell them which resources it will use, including any server size, database, or file storage, and point to [pricing](https://dev.turnzero.ai/pricing) and `read_balance`. If the app needs sign-in, ask whether sign-up is open to anyone, limited to [invited people](/cloud/guides/make-sign-up-invitation-only/), or requires [a work account](/cloud/guides/add-work-account-or-apple-sign-in/).

For this workflow, confirm that the person wants development before the first deploy. With nobody to ask, turn it on only if their request already asks for development. Otherwise stop and report before deploying. An application starts with production alone, so a deploy without development puts the version live.

For an unattended run or a computer using a token, follow [Deploy with nobody at the keyboard](/cloud/guides/deploy-with-nobody-at-the-keyboard/). Keep the token's value out of chat.

## Steps

For the AI assistant: follow these phases in order. Read each linked procedure before doing its work.

### 1. Start from a template or existing code

With a shell and a new app, follow [Starting a new service](/cloud/concepts/turnzero-command/#starting-a-new-service) to choose a template and create the project. For sign-in and private notes, choose [`functions-sign-in`](/cloud/concepts/turnzero-command/#the-functions-sign-in-template) if the app can run as functions, or [`server-sign-in`](/cloud/concepts/turnzero-command/#the-server-sign-in-template) if it needs a server. Create the functions app without a size.

For existing code, read `skill:move-existing-app` with `read_context` and use [Bring an existing application](/cloud/guides/bring-an-existing-application/) to prepare the code. Keep its project layout; do not scaffold over it. Before adding a capability, read [Use the feature package library](/cloud/guides/use-the-library/) to check for a feature package and its integration instructions.

Without a shell, follow [Design and write the app](/cloud/getting-started/build-an-app-from-a-chat/#1-design-and-write-the-app) to prepare the files. For existing code, keep its layout. In this phase, prepare the project only. Follow phases 2 and 3 below before any linked procedure reaches a deploy.

### 2. Create the application and turn development on

Read the deployment skill with `read_context`, id `skill:deploy`. Follow [Create the application](/cloud/getting-started/deploy-an-application/#1-create-the-application), reusing the application's identifier if it already exists.

Read `skill:develop-then-promote` and `skill:release` with `read_context`. Then follow [Turn the development environment on](/cloud/guides/turn-on-development-and-promote/#turn-the-development-environment-on), before deploying. Record the development hostname the response returns. Take production's hostname from a later platform response, rather than composing it. Keep each check on its intended environment.

### 3. Declare the services and prepare local settings

Read `skill:manifest-author` with `read_context`, then follow [Author the manifest](/cloud/guides/author-the-manifest/) to submit the whole declaration. For sign-in, also read `skill:add-sign-in` and follow [Add sign-in to your app](/cloud/guides/add-sign-in-to-your-app/).

Before deploying, follow [Store a secret](/cloud/getting-started/store-a-secret/) to supply each secret a manifest setting references, in the environment you are about to deploy to. Check development and production separately; a value stored only for one does not supply the other.

For a local run of a server app, follow [Run your app on your computer](/cloud/guides/run-your-application-on-your-machine/). Its provision command writes the development credentials into the environment file without passing their values through chat. Keep that file out of Git and follow the guide for settings the command does not write.

Without a shell, skip local provisioning. Follow [Declare the services and libraries](/cloud/getting-started/build-an-app-from-a-chat/#3-declare-the-services-and-libraries) for the manifest and any package files needed on the hosted app.

### 4. Test locally and deploy to development

With a shell, follow [Test your application locally](/cloud/guides/test-your-application-locally/) to check the app's behavior. For a server app, start and check the real local server using [Run your app on your computer](/cloud/guides/run-your-application-on-your-machine/), then stop the processes you started. For `functions-sign-in`, use the template’s tests for the local check and verify browser sign-in in development in phase 5.

Fix failing checks before deployment. Follow [Deploy to development](/cloud/guides/turn-on-development-and-promote/#deploy-to-development) and its linked upload procedure. Wait until the deploy ends successfully, following the returned status call where needed.

Without a shell, use the app ID and manifest from the earlier phases and follow [Check and deploy the files](/cloud/getting-started/build-an-app-from-a-chat/#4-check-and-deploy-the-files). The earlier `create_environment` step means this deploy goes to development. Report which local checks could not run, then perform the hosted checks in phase 5.

### 5. Check the task in development

Follow [Check development before promoting](/cloud/guides/turn-on-development-and-promote/#check-development-before-promoting). Check the behavior the person requested, its saved data where applicable, and the logs. A successful health check alone does not prove the app works.

For sign-in, follow [Test sign-in with test end users](/cloud/guides/test-sign-in-with-test-end-users/), explicitly choosing development. For the notes app, check that a signed-in user can save and read their notes, and another user cannot read them.

Fix a failed check and deploy the corrected version to development before repeating it. Give the person the development address so they can try the app. Report the development version you checked and the results to the person. Keep that version number to pass to `promote`. If the person has yet to ask for this promote, ask whether to publish it.

### 6. Promote and check production

Promote only when the person has asked for that promote. Otherwise ask and wait. Follow [Promote to production](/cloud/guides/turn-on-development-and-promote/#promote-to-production), including its database migration cautions. Pass the development version number you checked in phase 5 as `version`, then wait for the outcome.

Follow [Check the release](/cloud/getting-started/deploy-an-application/#check-the-release) against production. That section covers read-only checks and checks using a test end user on the first deploy. It also explains when other production writes on an app with real users need the owner's confirmation. Apply those production-write limits when checking signed-in behavior too.

Check that production is serving the promoted version. Report the production address, the version serving there, the checks that passed, and anything still unchecked. If the promote fails, read its recorded outcome before choosing the recovery in the linked guide. Also report who can sign up, what the app stores, where its source lives, and which test records remain.

## Expected result

Development serves the version whose requested behavior you checked. After an authorized promote, production's status shows that version as deployed, and the production checks report what worked and what remains unchecked.

Your AI assistant gives you the production address and check results. In a run without a shell, it identifies local checks as not run.

## Refusals

This table covers common refusals only. The linked procedures and the [refusals reference](/cloud/reference/refusals/) give the other causes and remedies.

| Refusal | Cause | Remedy |
| --- | --- | --- |
| `manifest_missing` | The application has no manifest on file. | Submit it using phase 3 before deploying. |
| `setting_secret_missing` | The target environment lacks a secret a setting needs. | Use [Store a secret](/cloud/getting-started/store-a-secret/), then repeat the refused operation. |
| `deploy_in_flight` | Another deploy is still running. | Read its status and wait for its outcome before starting another. |
| `nothing_to_promote` | Development is running no version, and the promotion request does not specify one. | Complete the development deploy in phase 4 first. |
| `environment_not_created` | The application has production alone. | Confirm the intended workflow and turn development on using phase 2. |

For a local test failure, use [Test your application locally: Refusals](/cloud/guides/test-your-application-locally/#refusals) and the affected package's test-double instructions. If a prerequisite remains unavailable, stop and report what is needed before continuing.

## Related

- [Find the guide for a task](/cloud/getting-started/find-a-guide/) covers other application tasks.
- [Deploy from your computer](/cloud/getting-started/deploy-an-application/) gives the full deploy procedure.
- [Test in development, then promote](/cloud/guides/turn-on-development-and-promote/) explains the environment changes and production switch.
- [Manage versions and environments](/cloud/guides/manage-versions-and-environments/) covers version history and rollback.
