Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions docs/docs/build_and_deploy/deploy_aws.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
sidebar_position: 4
---

# Deploy to AWS Amplify

This guide covers how to deploy Composable UI to AWS Amplify

## Prerequisite

- You'll need an AWS account, sign up here: https://aws.amazon.com/
- You'll need to fork the Composable UI github repository.
- This is required since later on you'll be authorizing AWS Amplify access to your forked copy of Composable UI.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Improve formatting and clarity in prerequisites section.

  1. Format the AWS URL as a proper Markdown link
  2. Fix list indentation
  3. Clarify the forking requirement

Apply these changes:

-##  Prerequisite
+## Prerequisites

-- You'll need an AWS account, sign up here: https://aws.amazon.com/
-- You'll need to fork the Composable UI github repository.
-   - This is required since later on you'll be authorizing AWS Amplify access to your forked copy of Composable UI.
+- You'll need an [AWS account](https://aws.amazon.com/)
+- You'll need to fork the Composable UI GitHub repository
+  - AWS Amplify requires access to your own copy of the repository, which is why forking is necessary
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
## Prerequisite
- You'll need an AWS account, sign up here: https://aws.amazon.com/
- You'll need to fork the Composable UI github repository.
- This is required since later on you'll be authorizing AWS Amplify access to your forked copy of Composable UI.
## Prerequisites
- You'll need an [AWS account](https://aws.amazon.com/)
- You'll need to fork the Composable UI GitHub repository
- AWS Amplify requires access to your own copy of the repository, which is why forking is necessary
🧰 Tools
🪛 LanguageTool

[typographical] ~13-~13: Consider adding a comma after this introductory phrase.
Context: ...repository. - This is required since later on you'll be authorizing AWS Amplify acces...

(LATER_ON_COMMA)

🪛 Markdownlint

13-13: Expected: 2; Actual: 3
Unordered list indentation

(MD007, ul-indent)


9-9: null
Multiple spaces after hash on atx style heading

(MD019, no-multiple-space-atx)


11-11: null
Bare URL used

(MD034, no-bare-urls)


## Create a new AWS Amplify app
- Sign into your AWS console
- Go to the AWS Amplify service. It can be found by searching for "AWS Amplify" in the search bar.
- Once in the AWS Ampliy dashboard, click on `Create new app`.

### Configure the new app
- Select `Github` as the Git provider, and click `Next`.
- Select your Composable UI repository from the `Select a repository` search bar.
- Note: You may need to click on the `Update Github permissions` button to authorize AWS access to your desired github organization and specific github repository.
- In `Select a branch`, select `main`.
- Select the `My app is a monorepo` checkbox.
- Set the `Monorepo root directory` to `composable-ui`.
- Click 'Next'

On the `App settings` screen:
- Click `Edit YML file`, and paste the below yml file into the editor, then click `Save`:
```yml
version: 1
applications:
- frontend:
phases:
preBuild:
commands:
- echo 'node-linker=hoisted' >> .npmrc
- npm install -g pnpm
- pnpm install
build:
commands:
- env >> .env
- npx turbo run build --filter=composable-ui
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- $(pnpm store path)
buildPath: composable-ui
appRoot: composable-ui

```
- The Environment Variables are configured in the the `Advanced Settings` section. We will skip this for now, and come back to this in a later step.
- Click `Next`.
- Click `Save and deploy`.

The deployment will succeed, however, we now need to setup the [Environment Variables](#configure-environment-variables).

### Configure Environment Variables

We need to obtain the domain that the app is being deployed on:
- Go to the main dashboard of your app in AWS Amplify.
- Click on `Hosting` => `Custom domains` and copy the URL to your clipboard. See the screenshot below for an example.

![image](/img/custom-domains.png)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update image path to match the correct location

The image exists at docs/static/img/custom-domains.png, but the current reference uses /img/custom-domains.png. The path needs to be updated and alt text should be added for accessibility.

-![image](/img/custom-domains.png)
+![AWS Amplify Custom Domains screen showing the app URL](/static/img/custom-domains.png)
🔗 Analysis chain

Verify image path and add alt text.

The image reference needs verification and accessibility improvements.

-![image](/img/custom-domains.png)
+![AWS Amplify Custom Domains screen showing the app URL](/img/custom-domains.png)
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if the image exists in the repository
fd -t f "custom-domains.png" img/

Length of output: 125


Script:

#!/bin/bash
# Let's first find the correct location of the images directory
fd -t d "img"

# Also check for alternative image directories like images, assets, etc.
fd -t d "(images|assets)"

# Let's also check the entire repository for this specific image
fd "custom-domains.png"

Length of output: 195


Now go to `Hosting` => `Environment variables`. We need to configure two environment variables for NextAuth.js:
- Create environment variable `NEXTAUTH_URL` and paste in the value we copied earlier from the the Custom domains screen.
- Create environment variable `NEXTAUTH_SECRET`. The is value is used by NextAuth.js to encrypt auth cookies. See the[ NextAuth.js docs](https://next-auth.js.org/configuration/options#nextauth_secret) for creating a strong secret. You can also set this to something like "changeme" and revisit this later on, prior to launching to production.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Enhance security guidance for NEXTAUTH_SECRET.

The current guidance for NEXTAUTH_SECRET could be stronger from a security perspective.

-- Create environment variable `NEXTAUTH_SECRET`. The is value is used by NextAuth.js to encrypt auth cookies. See the[ NextAuth.js docs](https://next-auth.js.org/configuration/options#nextauth_secret) for creating a strong secret. You can also set this to something like "changeme" and revisit this later on, prior to launching to production.
+- Create environment variable `NEXTAUTH_SECRET`. This value is used by NextAuth.js to encrypt authentication cookies. For production environments, generate a strong secret using:
+  ```bash
+  openssl rand -base64 32
+  ```
+  See the [NextAuth.js docs](https://next-auth.js.org/configuration/options#nextauth_secret) for more details.
+  
+  > **Warning**: Never use placeholder values like "changeme" in production environments as this compromises security.
🧰 Tools
🪛 LanguageTool

[duplication] ~71-~71: Possible typo: you repeated a word
Context: ...ste in the value we copied earlier from the the Custom domains screen. - Create environ...

(ENGLISH_WORD_REPEAT_RULE)


[uncategorized] ~72-~72: Did you mean “there is”?
Context: ...environment variable NEXTAUTH_SECRET. The is value is used by NextAuth.js to encrypt...

(THE_THERE)


[style] ~72-~72: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ...e "changeme" and revisit this later on, prior to launching to production. ### Redeploy ...

(EN_WORDINESS_PREMIUM_PRIOR_TO)

🪛 Markdownlint

72-72: null
Spaces inside link text

(MD039, no-space-in-links)

### Redeploy

After setting the `NEXTAUTH_URL` and `NEXTAUTH_SECRET` environment variables, the app is now ready to be redeployed:
- Go to the dashboard of your app, and click on the `main` deployment.
- Click the `Redploy this version` button.

When the app finishes deployment, your Composable UI storefront is ready to use! Go back to the dashboard of your app, and click `Visit Deployed URL`.

### Next steps

Visit the [integrations guide](../integrations/overview.md) to setup additional features like product filtering, product promotions, content orchestration, and payments.







Binary file added docs/static/img/custom-domains.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading