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.Before you begin
Roles & credentials
- All calls in this guide are made as a Builder. Make sure you’ve completed the steps to set up Builder authentication before getting started.
Tools
jqandcurl
Variables and files
- You’ll need the
sutro.keyandsutro.crtfiles created in Step 2 of the Builder authentication setup. - Use Step 4 to generate JWTs for your requests and store them in the
BUILDER_JWTenvironment variable. - Download the Sutro Certificate Authority (CA) certificate from
/certs/ca.crtso API requests remain secure.
Steps
Sutro takes you through every stage, from prompts to production, so you retain end-to-end visibility while Sutro does the heavy lifting.1
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
POST /projectsproject.json; refer to that file in upcoming steps.2
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}/applications3
Attach 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}/prompt.4
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.5
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.6
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.7
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.8
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!