Skip to content

App

Source: src/AWS/Amplify/App.ts

An AWS Amplify Hosting app. This resource provisions the app container; it does not connect a Git repository.

Connecting a repository requires an OAuth handshake (via CodeConnections or a personal access token) that is inherently human-in-the-loop and cannot be automated from infrastructure code. To wire a repo, create the app with this resource, then connect the repository from the Amplify console or CLI. Manual-deploy branches (no repo required) are code-driven via the Branch resource plus the CreateDeployment/StartDeployment bindings. For a fully code-driven static/SSR site on AWS, prefer Alchemy’s own Website composites (S3 + CloudFront).

Basic App

const app = yield* App("MyApp", {
description: "Marketing site",
platform: "WEB",
});

App with Build Config and Redirects

const app = yield* App("MyApp", {
platform: "WEB_COMPUTE",
environmentVariables: { NODE_ENV: "production" },
customRules: [
{ source: "/<*>", target: "/index.html", status: "404-200" },
],
buildSpec: "version: 1\nfrontend:\n phases:\n build:\n commands: []\n",
});

Manual Deploy Pipeline (CreateDeployment + StartDeployment)

// init — bind the deployment operations to the app
const createDeployment = yield* AWS.Amplify.CreateDeployment(app);
const startDeployment = yield* AWS.Amplify.StartDeployment(app);
// runtime — stage, upload, release
const { jobId, zipUploadUrl } = yield* createDeployment({
branchName: "main",
});
// PUT the site zip to zipUploadUrl, then:
yield* startDeployment({ branchName: "main", jobId });

React to Deployment Status Changes

yield* AWS.Amplify.consumeDeploymentStatusChanges(
{ jobStatus: ["FAILED"] },
(events) =>
Stream.runForEach(events, (event) =>
Effect.log(`build failed on ${event.detail.branchName}`),
),
);