Overview
This guide walks through the full workflow, from authentication to deployment, using the Sutro API to build a full-stack application from a prompt.This guide will work for any of Sutro’s APIs.
Before you begin
Tools
jqandcurl
Security bundle
Downloadsecurity-bundle.zip from the Sutro Console during onboarding. Extract it and run all commands from that directory. The bundle includes your API client credentials (apiClient.id, mtls.key, mtls.crt), the Sutro CA certificate (ca.crt), and a pre-generated Builder JWT (builder.jwt) valid for 7 days.
Verify your connection
Test that your credentials work by calling the hello endpoint:Steps
Sutro takes you through every stage, from prompts to production, so you retain end-to-end visibility while Sutro does the heavy lifting.Create a new project
The first step is to create a new project. A project is like the container for your application, and it can have multiple components:Congratulations! You’ve just created your first Sutro Project.The project details are stored in
backend: A backend API hosted by Sutrofrontend: An optional frontend web application, hosted by Sutro, or exported as static bundle
components array controls what gets generated. If omitted, only ["backend"] is created by default. Since we’re building a full-stack app, we explicitly request both backend and frontend.It’s currently not possible to create a standalone frontend project.Call POST /projectsproject.json; refer to that file in upcoming steps.Create an app
Next, create an empty application within your project. This application will serve as the container for your generated code.Call Now you have an Application; next attach a prompt to it.
POST /projects/{projectId}/applicationsAttach a prompt
Attach a prompt to the application that describes what you want to build. This prompt will be used during the generation process.Call The prompt is attached and the Application is ready to generate.
POST /applications/{applicationId}/attachments.Generate the app
Generating an application takes a little time, so call the Sutro API to start the process and monitor it in the next step.This will automatically use the prompt that was attached to this specific application. Because you selected the This call returns quickly; your application is being generated.
backend and frontend components when creating the project, this will first generate a backend API, and then a frontend web application based on the prompt you attached.Call POST /applications/{applicationId}/generate.Monitor for generation to complete
Because Make this call every ~10 seconds until the status shows completion.Once the status shows
curl drives this guide, poll the API for the application’s status.The -s flag limits output to the Application status, so unexpected text may signal local network issues.Call GET /applications/{applicationId}/status."active", your application has been successfully generated and is ready to be published.Publish the application
Now that your application has been generated, you need to publish it to make it accessible. Publishing creates a new version of your application and deploys it.Just like Application generation, Application deployment takes a little time, so this API call will start a deployment.It will also create a new Version of your Application.Call The
POST /applications/{applicationId}/deploymentdeployment.json file contains the deploymentId of the deployment (so that we can check its status) and the versionId that was generated.Monitor for the deployment to complete
Monitor deployment the same way you monitored generation.Call Once the response says that the status is
GET /applications/{applicationId}/versions/{version}/deployment/{deploymentId}"Successful", your application has been deployed and is ready to use.Access your deployed application
Now that your application has been deployed, you can get the URL where it’s accessible.Call The response includes the application details, including the URL where your frontend application is accessible. You can now open this URL in your browser to view and interact with your deployed full-stack application.
GET /applications/{applicationId} to retrieve the application details, including the public URL.Your application is deployed, versioned, and ready for teammates or customers to explore. Share the URL with confidence!
Self-hosting the frontend
Instead of using Sutro’s hosted frontend, you can export a static bundle and serve it from your own infrastructure. This gives you complete control over hosting, CDN configuration, and deployment pipelines.Configure CORS on your backend
When self-hosting the frontend, your frontend will make requests to the Sutro-hosted backend from a different origin. You need to configure CORS to allow these requests.Call You can verify the current CORS configuration by calling
PATCH /applications/{applicationId}/corsFor production, replace
http://localhost:8080 with your actual domain (e.g., https://app.yourdomain.com). You can include multiple origins in the array.GET /applications/{applicationId}/cors.Export the frontend bundle
Download the production-ready frontend as a static bundle (HTML, CSS, JavaScript, and assets).Call The downloaded zip contains everything needed to serve your frontend from any static file server.
GET /applications/{applicationId}/frontendBundleExtract and serve locally
Extract the bundle and serve it with any static file server. Here’s how to test locally using Open
http-server:http://localhost:8080 in your browser to see your application running locally against the Sutro-hosted backend.Make sure the port matches the origin you configured in the CORS settings. If you’re using a different port, update the CORS configuration accordingly.