Deploy from a chat #

View this page as Markdown

On this page

Prompt: paste this into your AI assistant.

Deploy this app to Turn Zero Cloud.

Also works:

  • "Build this with Turn Zero and put it online."
  • "Ship it."

This page describes how an AI assistant without a shell, and so without the turnzero command, builds and deploys: in Claude's or ChatGPT's chat, or in a cloud workspace. With a shell, follow Deploy from your computer.

What your AI does #

  • Designs and builds the app you describe, using an example app if one helps.
  • Creates an application if the task needs one, chooses a size if it runs a server, configures the services, and deploys.
  • Tests what its tools can verify and gives you the link, with any checks left for you.

For an app within the limits below, no terminal, ZIP file, or folder on your computer is needed. If your AI assistant can write files on your computer, it also saves the app's source in the agreed project folder. An AI chat app can use the platform's AI route without a separate provider key. Its calls draw the account's balance at the pricing page's rates.

What you need #

  • A signed-in Turn Zero Cloud connection in your chat.
  • Room to create an application if the task needs one. Size limits explains which live applications count. If creation returns account_application_limit, follow step 2.

With a usable shell, your AI can use turnzero scaffold --origin https://dev.turnzero.ai to start from a template, install dependencies, and run tests. The MCP connection and CLI have separate credentials; follow Authorize this computer for deploys before using the CLI.

Before your AI starts #

For the AI assistant: The checks and procedures below address you directly. When a step needs the person, tell them what to do and wait for their response.

Build the app the person requested. You may browse the example apps, choose a useful starting point, and adapt it, or write the app yourself. A template's features are examples, not requirements for the person's app. Choose serverless for a new app with static files, functions, or both unless the app needs a server.

Read the skill:deploy skill through read_context, plus the skills for the services you need, such as skill:add-sign-in and skill:use-ai-generation. Keep their approval and retry rules. With no usable shell, use the MCP steps below in place of instructions to scaffold, run local commands, or deploy through the CLI. Do not ask the person to create a local folder or install the CLI for this route.

Steps #

1. Design and write the app #

Use the person's prompt to decide what to build. If you can write local files, save the app's source in the agreed project folder too, so the person keeps it. If you use an example, read its complete source before adapting it. The example catalog lists the available templates; none is required.

For a small site with a database-backed form that fits in one function, start with the functions-database example. Before you deploy, agree on who can submit the form and who can read its saved entries. The example lets anyone with the address do both. Check those two decisions in the manifest and in the routes you write.

If a web fetch fails or returns a summary, use read_documentation with tree: "cloud" and the page's path, such as /examples/overview. Follow each response's next_offset and stamp until you have the whole page. Example pages include all their files inline and link to text downloads. The downloads' .txt suffix is not part of an application's filename.

For sign-in, use the platform's sign-in pages and verify sessions through the Account package. Keep each user's saved data private to that user. For a new app with sign-in and private records, start with the functions-sign-in example if the app can run as functions. Use the server-sign-in example when the app needs a server. For a server's database setup, With no shell in Build a database-backed service lists the calls in order. Use the AI Generation package for calls through the platform's AI route.

A shared database is one monthly item for the application; stored files are charged by size (Stay inside the Free Allowance).

Without sign-in, your application can use its own cookie to tell browsers apart, but that does not identify a person.

2. Create the application #

For an existing app, use list_applications to find and confirm its ID. Carry that ID into step 3.

For a new serverless app, call create_application with its name and kind: "serverless" and leave out size. This covers static files, functions, and a site that uses both. For a site with only static files, follow Publish a static site.

For a new server, use the size the person named: Shared 0.5 GB or Shared 1 GB. If they named none, ask which size to use. With nobody to ask, use Shared 0.5 GB. Report the size, that nobody was available, its awake-time charge and the option to request Shared 1 GB for more memory or CPU. Call create_application with size set to shared-0.5gb or shared-1gb and keep its identifier. Make no separate capacity check first.

At the account limit, create_application returns account_application_limit and creates nothing. Ask whether to use an existing application; with nobody to ask, create nothing and report the limit. Do not delete an application without approval. A new application has production only. Use production alone unless the person asks to try versions on development first.

3. Declare the services and libraries #

For a complete manifest with a database, sign-in, an invited audience and a plain setting, see A manifest that works.

Submit a manifest for the services, region, audience, and external hosts the app needs. A server also declares its health path; a static site needs none. Read each required library entry with read_library, naming it in entry, and put its current name and version in the manifest's packages list. Use the library name, such as account, not the dependency name @turnzero/account. Copy the version returned by the read, not one from an old example.

In package.json, declare these packages as local library dependencies, such as "@turnzero/account": "file:lib/account". Keep the app's other dependencies too. Omit the library folders from deploy_files: Cloud fills them from the entries listed in the submitted manifest. You do not need to download those copies first.

A library copy Cloud fills needs no entry in package-lock.json, so do not write a lockfile for it. If the project already has a lockfile npm wrote, send it unchanged.

Call submit_manifest with the application's identifier and completed manifest. A manifest.json file in the upload is optional; deployment uses the submitted manifest. If you keep that file, keep it consistent with what you submitted. No local credential file or local_run request is needed for this route.

For a serverless app with a database, declare the database service and include its SQL files under migrations/ in the deploy list. Cloud applies them before the version serves. The handler reads the database connection from APP_DATABASE_URL; see the functions-database example.

A realm is the app's sign-in configuration and end-user accounts. New realms enable Google, GitHub, emailed codes, and passkeys, with open sign-up. Call read_app_sign_in to inspect the effective settings, including audience restrictions, then configure the methods and access your app needs.

4. Check and deploy the files #

Review the complete file set. With no usable shell, do not claim to have run Node.js tests or started the app locally. Keep useful tests from any example you adapt, updating them to match your app.

Call check_deploy before the first deploy and after fixing what it reports, whichever route you use. Resolve its refusals and read its missing-credential reports. It checks platform readiness, not your code.

Without a shell, send the complete file list to deploy_files with check_only: true, as shown in without_command. This checks the files and deployment setup, stops at the first refusal, and starts no deploy. It does not report missing credentials. The account pause check runs when you start the deploy. The code-only check is recommended. It is not required. If you skip it, deploy the complete file list without check_only.

Name the same environment on the readiness check, the file check, and the deploy. Add environment to the arguments copied from without_command; the returned arguments do not carry it. Use that environment again when you check the running routes.

Each entry needs an application-relative path and content, stored, or a sha256 returned for content the platform still holds. Use { path, sha256 } for a file an earlier call kept. For a server, put package.json at the root. Include package-lock.json if the app has one, so deployments use the same dependency versions. Leave out credentials, node_modules, and library folders Cloud fills. In a chat connection, check_deploy returns no shell command; its detail directs you to the deploy_files check described in without_command.

For a binary file you cannot read, call list_storage_areas and choose an area whose bound application is this app. Use its returned name as stored.area. If the application has no area, declare one with declare_storage_area.

If the file is already stored there, ask your user for its stored name from the area's file list on the application's page. Otherwise, ask them to follow Upload a file from the application's page and tell you its stored name.

Include { path, stored: { area, name } } in the complete list; the platform copies the uploaded bytes exactly. Do not call mint_upload_grant for this page upload.

The file check returns only the files it accepted in kept, with each file's path and sha256. The list never includes library copies Cloud fills.

If a per-file refusal includes kept, reuse those paths and hashes for files that are still unchanged. Fix the files listed in refused before you send the list again.

The daily cleanup normally deletes accepted content at least a day and at most two days after it was last kept, unless a serving or in-flight version lists it. If a later call lists a file as missing, send it again with content, or stored for a file in storage.

If the answer is awaiting_files, read its missing list. Resend the complete list with content or stored entries for the missing paths. Keep check_only: true when you are checking files.

Once the check returns files_checked, call deploy_files without check_only, listing every included file by its returned path and hash. These checks cover deployment requirements and source syntax. Use the hosted checks below to test the app's behavior.

For serverless apps, deploy_files can return artifact_notice on a deploy or with check_only: true. It flags a literal relative import or export whose target is missing from the function source selected from the ZIP. The notice is advisory.

Inline files are limited to 512 KiB each. Stored entries have no per-file cap. Both count toward 200 listed entries and 4 MiB total; library copies Cloud fills also count toward the total. The JSON request has a separate 4 MiB limit. If inline content will not fit in one request, send files first using file, then list their returned hashes; see the deploy_files reference. This does not raise the total or entry-count limits. Never truncate a file to fit.

If the deploy has not ended, its answer's next is the read_status call to make next. Follow it until deployment ends; a build can take several calls. If your tool allows less time than the call's wait_seconds, pass fewer seconds on the starting deploy_files call and on these status calls. Check filled for the library copies. If a response does not establish whether deployment started, read status before retrying. Once deployment ends successfully, continue with step 5 (Verify the app).

Continue in a later chat #

If you stopped before any deploy, ask for the stored name of any file the person uploaded from the application's page and list it as stored. Send every other file again in the complete file list.

If a later chat lacks the earlier kept answer, call list_versions for the application. Read kept on the serving version in the environment you will deploy to: production with one environment, development with two. It lists the recorded files by path and sha256. Match your files to those entries by path, without computing hashes.

For each file you know is unchanged, copy the entry's path and sha256; the hash deploys the bytes the platform holds. Send changed or added files, and pasted files you cannot be sure are unchanged, with content, or with stored for a file in storage.

Before a first deploy, run the recommended check_deploy if you have yet to run it. Also run it after fixing something it reported. Resolve its refusals and read its missing-credential reports.

For the recommended code-only check, call deploy_files with check_only: true and the complete file list, including unchanged files by hash. Leave out files you intend to remove and library copies Cloud fills. Once the answer is files_checked, deploy the complete list using the paths and hashes this check returned in kept, as above. If you skip the code-only check, deploy the complete list using the hashes an earlier call kept for unchanged files.

kept appears only for versions currently serving requests. A null value means the version recorded no path-and-hash list; it does not mean the app has no files. Where it is null, or no version serves in the target environment, send the complete file list with content or stored instead of hashes. Ask the person for any binary or stored file you cannot see, together with its application path. If nobody is available to supply the file or agree to deploying without it, leave the deploy pending and tell the person what waits.

5. Verify the app #

In read_status, check that the deploy succeeded and the intended version is serving in the target environment.

Read the deploy result for the server's health check. A request from outside an invited or workforce app can require sign-in even when the deploy's internal health check passed. Keep the app's audience rule.

Use request_route with environment set to the environment the deploy targeted. Check the home page and any protected routes the app has. Check sign-in and AI behavior separately where the app uses them.

For a form that saves data, use write_route with the same path, content type, and body the form sends. Keep the returned identifier if it gives one, then read the entry back through the app and check its saved value. To check a same-host 303 response itself, set follow_redirects: false on the write call. Report any test rows left behind. If you have no browser, the person can open the site and use the form to check its layout and buttons.

With a minted token that lacks test_end_users, check production routes that allow signed-out requests. For a gated route, check that it requires sign-in. To check its signed-in response on production, use the app owner’s browser-signed-in AI connection or a token with test_end_users. Report any signed-in checks you could not run.

For signed-in route checks without a browser or shell, use your signed-in MCP session. Pass the temporary user's identifier as test_end_user and set environment to the environment you want to check. The platform signs the user in for that call. It sends a cookie by default. Pass session_as: "bearer" if your route expects a bearer token.

To verify the first deploy on an app with no real users, you can write as a temporary test end user. Test writes in development when it is available. On an app with real users, get the owner's confirmation before a production write beyond the first-deploy exceptions below. Treat a GET with side effects, or a route whose effects you cannot tell, as a write. Use request_route for GET and write_route for other methods.

If you use a token you created, it needs the test_end_users grant on production. If the app uses the workforce audience, that token needs the grant in both environments. Do not substitute sign_in_test_end_user's CLI command when you have no shell.

For a browser or direct HTTP check with cookies, follow Test sign-in with test end users. Your signed-in MCP session can read the temporary users' codes.

Test the signed-in behavior the person requested. If the app includes AI chat, also check that it gives an AI answer.

When verifying the first deploy of an app that uses the accounts service, create a temporary test end user for its signed-in reads or AI chat checks. These checks need no further confirmation, even if the app stores that user's own chat turns. Removing the data these checks wrote for that test user also needs no further confirmation. The test user expires after 48 hours. On an app with real users, ask the owner to confirm any other production write; a request to build, deploy, or test alone does not approve it.

On an app with no real users, test writes on development if it is available. If the app has only production, you can test writes there freely. Report the test rows you wrote so the person can remove them before launch. Email beyond the person's own test addresses and paid calls with stored keys still need their request for this run. Check the release defines when an app has no real users.

After testing, remove the test data through the application's existing cleanup routes. Use write_route with that user's identifier as test_end_user and environment set to the environment the user signed in to. If the app has no cleanup route, leave the data and tell the person which rows remain and where. Name the test user's label and the route that wrote them.

At the end of the check, discard the test users' cookies. To remove the test end users this run created, call add_test_end_users with the same application and environment and remove: true. List only their identifiers in end_users, leave all unset, and tell the person whether they were removed. Deleting a test user does not delete the app's saved data automatically.

If your available tools cannot complete sign-in, say which checks remain. Give the person the deployed link and ask them to sign in and try the app. Do not describe an untested sign-in or AI call as verified.

Expected result #

The app is deployed at its own address. You have its link and a clear account of the behavior your AI tested and any checks left for you. The report also says who can sign up, what the app stores, where its source lives, and which test records remain.

Refusals #

Refusal Status Cause Remedy
deploy_files_too_large 413 An inline file, the total file size or the entry count exceeds a limit, or a stored file changed size during the read Use a stored entry for an oversized inline file; the total and entry limits still apply. Follow the returned details. If a stored file changed, send the list again or ask your user to upload it again. Never truncate source.
request_too_large 413 The JSON request exceeds its 4 MiB limit Send files first using file, then list their returned hashes. The total and entry-count limits still apply. Never truncate a file to fit.
deploy_files_syntax_error 422 A file does not parse Fix the file at the line and column the detail gives, and send it again.

See the deploy_files reference for the complete refusal list.

Give the person a copy of the complete source with its application-relative paths, including the manifest and migrations. If you cannot save it in their project folder, offer a downloadable copy where the chat supports it, or provide the files with their paths in the chat so the person can save them. Keep this copy for later edits. Paths and hashes from kept can reuse unchanged files in a deploy. To edit a file, you need its source. To work locally later, follow Test your application locally.