Skip to content

Commit 7318241

Browse files
authored
Merge pull request #64 from aws-samples/develop
WIP Maintenance: Update main branch
2 parents 974f535 + e3ed6fa commit 7318241

File tree

121 files changed

+23707
-50231
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+23707
-50231
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/build_test.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build & Test Workflow
2+
on:
3+
push:
4+
branches: [develop]
5+
paths:
6+
- '.github/workflows/*'
7+
- 'unicorn_shared/**'
8+
- 'unicorn_contracts/**'
9+
- 'unicorn_properties/**'
10+
- 'unicorn_web/**'
11+
env:
12+
AWS_REGION : "ap-southeast-2"
13+
14+
permissions:
15+
id-token: write
16+
contents: read
17+
18+
jobs:
19+
shared-infrastructure:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v4
23+
24+
- name: Configure AWS credentials
25+
uses: aws-actions/configure-aws-credentials@v4
26+
with:
27+
role-to-assume: arn:aws:iam::819998446679:role/GithubActions-ServerlessDeveloperExperience
28+
aws-region: ${{ env.AWS_REGION }}
29+
30+
- name: Deploy Shared Images
31+
working-directory: unicorn_shared
32+
run: make deploy-images
33+
34+
- name: Deploy Shared Namespaces
35+
working-directory: unicorn_shared
36+
run: aws cloudformation update-stack --stack-name uni-prop-namespaces --template-body file://uni-prop-namespaces.yaml --capabilities CAPABILITY_AUTO_EXPAND
37+
38+
uniorn-service:
39+
needs: shared-infrastructure
40+
runs-on: ubuntu-latest
41+
continue-on-error: true
42+
43+
strategy:
44+
max-parallel: 1
45+
matrix:
46+
folder: [unicorn_contracts, unicorn_web, unicorn_properties]
47+
48+
steps:
49+
- uses: actions/checkout@v4
50+
51+
- name: Setup NodeJS
52+
uses: actions/setup-node@v4
53+
with:
54+
node-version: 18.x
55+
56+
- uses: pnpm/action-setup@v3
57+
with:
58+
version: 8
59+
package_json_file: ${{ matrix.folder }}/package.json
60+
61+
- name: Install dependencies
62+
run: pnpm i
63+
working-directory: ${{ matrix.folder }}
64+
65+
- name: Run unit tests
66+
run: make unit-test
67+
working-directory: ${{ matrix.folder }}
68+
69+
- name: Configure AWS credentials
70+
uses: aws-actions/configure-aws-credentials@v4
71+
with:
72+
role-to-assume: arn:aws:iam::819998446679:role/GithubActions-ServerlessDeveloperExperience
73+
aws-region: ${{ env.AWS_REGION }}
74+
75+
- name: Configure AWS SAM
76+
uses: aws-actions/setup-sam@v2
77+
with:
78+
use-installer: true
79+
80+
- name: Build the SAM template
81+
run: sam build
82+
working-directory: ${{ matrix.folder }}
83+
84+
- name: Deploy the SAM template
85+
run: sam deploy --no-confirm-changeset
86+
working-directory: ${{ matrix.folder }}
87+
88+
- name: Run integration tests
89+
run: make integration-test
90+
working-directory: ${{ matrix.folder }}

.github/workflows/reusable_export_pr_details.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,19 @@ jobs:
7171
# otherwise the parent caller won't see them regardless on how outputs are set.
7272
- name: "Export Pull Request Number"
7373
id: prNumber
74-
run: echo ::set-output name=prNumber::$(jq -c '.number' ${FILENAME})
74+
run: echo prNumber=$(jq -c '.number' ${FILENAME}) >> "$GITHUB_OUTPUT"
7575
- name: "Export Pull Request Title"
7676
id: prTitle
77-
run: echo ::set-output name=prTitle::$(jq -c '.pull_request.title' ${FILENAME})
77+
run: echo prTitle=$(jq -c '.pull_request.title' ${FILENAME}) >> "$GITHUB_OUTPUT"
7878
- name: "Export Pull Request Body"
7979
id: prBody
80-
run: echo ::set-output name=prBody::$(jq -c '.pull_request.body' ${FILENAME})
80+
run: echo prBody=$(jq -c '.pull_request.body' ${FILENAME}) >> "$GITHUB_OUTPUT"
8181
- name: "Export Pull Request Author"
8282
id: prAuthor
83-
run: echo ::set-output name=prAuthor::$(jq -c '.pull_request.user.login' ${FILENAME})
83+
run: echo prAuthor=$(jq -c '.pull_request.user.login' ${FILENAME}) >> "$GITHUB_OUTPUT"
8484
- name: "Export Pull Request Action"
8585
id: prAction
86-
run: echo ::set-output name=prAction::$(jq -c '.action' ${FILENAME})
86+
run: echo prAction=$(jq -c '.action' ${FILENAME}) >> "$GITHUB_OUTPUT"
8787
- name: "Export Pull Request Merged status"
8888
id: prIsMerged
89-
run: echo ::set-output name=prIsMerged::$(jq -c '.pull_request.merged' ${FILENAME})
89+
run: echo prIsMerged=$(jq -c '.pull_request.merged' ${FILENAME}) >> "$GITHUB_OUTPUT"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
**/cdk.out/
2+
.vscode/settings.json
3+
node_modules

.npmrc

Whitespace-only changes.

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
![AWS Serverless Developer Experience Workshop Reference Architecture](/docs/workshop_logo.png)
1+
[![Build & Test Workflow](https://github.com/aws-samples/aws-serverless-developer-experience-workshop-typescript/actions/workflows/build_test.yml/badge.svg)](https://github.com/aws-samples/aws-serverless-developer-experience-workshop-typescript/actions/workflows/build_test.yml)
22

3-
# AWS Serverless Developer Experience workshop reference architecture (Typescript)
3+
<img src="./docs/workshop_logo.png" alt="AWS Serverless Developer Experience Workshop Reference Architecture" width="80%" />
44

5-
This repository contains the reference architecture for the AWS Serverless Developer Experience workshop.
5+
# AWS Serverless Developer Experience workshop reference architecture (TypeScript)
66

7-
The AWS Serverless Developer Experience workshop provides you with an immersive experience of a serverless developer. The goal is to provide you with an hands-on experience building a serverless solution using the [AWS Serverless Application Model (AWS SAM)](https://aws.amazon.com/serverless/sam/) and AWS SAM CLI.
7+
This repository contains the reference architecture for the AWS Serverless Developer Experience workshop.
88

9-
Along the way, we want to demonstrate principles of event-driven distributed architecture, orchestration, and serverless observability, and how to apply them in code.
9+
The AWS Serverless Developer Experience workshop provides you with an immersive experience as a serverless developer. The goal of this workshop is to provide you with hands-on experience building a serverless solution using the [**AWS Serverless Application Model (AWS SAM)**](https://aws.amazon.com/serverless/sam/) and **AWS SAM CLI**.
1010

11-
We'll also explore open-source tools, core features of AWS Lambda Powertools, and serverless CI/CD deployments. You can choose choose to run this workshop in a runtime of your choice — Python, TypeScript, Java, and .NET — and work with your own developer setup or use AWS Cloud9 to build the services.
11+
Along the way, you will learn about principals of distributed event-driven architectures, messaging patterns, orchestration, and observability and how to apply them in code. You will explore exciting open-source tools, the core features of Powertools for AWS Lambda, and simplified CI/CD deployments supported by AWS SAM Pipelines.
1212

13-
This workshop will take approximately 4 hours to complete. We are assuming that you have some practical development skills in one of the supported runtimes, and are familiar with some of the services that we will use in this solution which include: [Amazon API Gateway](https://aws.amazon.com/apigateway/), [AWS Lambda](https://aws.amazon.com/lambda/), [Amazon EventBridge](https://aws.amazon.com/eventbridge/), [AWS Step Functions](https://aws.amazon.com/step-functions/) and [Amazon DynamoDB](https://aws.amazon.com/dynamodb/).
13+
At the end of this workshop, you will be familiar with Serverless developer workflows and microservice composition using AWS SAM, Serverless development best practices, and applied event-driven architectures.
1414

15-
## About the Architecture
15+
## Introducing the Unicorn Properties architecture
1616

17-
![AWS Serverless Developer Experience Workshop Reference Architecture](/docs/architecture.png)
17+
![AWS Serverless Developer Experience Workshop Reference Architecture](./docs/architecture.png)
1818

1919
Our use case is based on a real estate company called **Unicorn Properties**.
2020

2121
As a real estate agency, **Unicorn Properties** needs to manage the publishing of new property listings and sale contracts linked to individual properties, and provide a way for their customers to view approved property listings.
2222

23-
To support their needs, Unicorn Properties have adopted a serverless, event-driven approach to designing their architecture. This architecture is centred around two primary domains: boundaries–Contracts (managed by the Contracts Service) and Properties (which are managed by the Properties Web and Properties Services).
23+
To support their needs, Unicorn Properties have adopted a serverless, event-driven approach to designing their architecture. This architecture is centred around two primary domains: **Contracts** (managed by the Contracts Service) and **Properties** (managed by the Web and Properties Services).
2424

25-
The **Contracts Service** is a simplified service that manages the contractual relationship between a seller of a property and Unicorn Properties. Contracts are drawn up that define the property for sale, the terms and conditions that Unicorn Properties sets, and how much it will cost the seller to engage the services of the agency.
25+
The **Unicorn Contracts** service (namespace: `Unicorn.Contracts`) is a simplified service that manages the contractual relationship between a seller of a property and Unicorn Properties. Contracts are drawn up that define the property for sale, the terms and conditions that Unicorn Properties sets, and how much it will cost the seller to engage the services of the agency.
2626

27-
The **Properties Web** service manages the details of a property listing to be published on the Unicorn Properties website. Every property listing has an address, a sale price, a description of the property, and some photos that members of the public can look at to get them interested in purchasing the property. **Only properties that have been approved for publication can be made visible to the public**.
28-
29-
The **Properties Service** approves a listing. This service implements a workflow that checks for the existence of a contract, makes sure that the content and the images are safe to publish, and finally checks that the contract has been approved. We don’t want to publish a property until we have an approved contract!
27+
The **Unicorn Web** (namespace: `Unicorn.Web`) manages the details of a property listing to be published on the Unicorn Properties website. Every property listing has an address, a sale price, a description of the property, and some photos that members of the public can look at to get them interested in purchasing the property. Only properties that have been approved for publication can be made visible to the public.
3028

29+
The **Unicorn Properties** service (namespace: `Unicorn.Properties`) approves a property listings. This service implements a workflow that checks for the existence of a contract, makes sure that the content and the images are safe to publish, and finally checks that the contract has been approved. We don’t want to publish a property until we have an approved contract!
3130

31+
Have a go at building this architecture yourself! Head over to the [Serverless Developer Experience Workshop](https://catalog.workshops.aws/serverless-developer-experience) for more details.
3232
## Credits
3333

3434
Throughout this workshop we wanted to introduce you to some Open Source tools that can help you build serverless applications. This is not an exhaustive list, just a small selection of what we will be using in the workshop.

docs/architecture.png

-47.9 KB
Loading

unicorn_contracts/.gitignore

Lines changed: 86 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,4 +143,89 @@ dist
143143
# SvelteKit build / generate output
144144
.svelte-kit
145145

146-
# End of https://www.toptal.com/developers/gitignore/api/node
146+
# End of https://www.toptal.com/developers/gitignore/api/node
147+
148+
### Linux ###
149+
**/*~
150+
**/.fuse_hidden*
151+
**/.directory
152+
**/.Trash-*
153+
**/.nfs*
154+
155+
### OSX ###
156+
**/*.DS_Store
157+
**/.AppleDouble
158+
**/.LSOverride
159+
**/.DocumentRevisions-V100
160+
**/.fseventsd
161+
**/.Spotlight-V100
162+
**/.TemporaryItems
163+
**/.Trashes
164+
**/.VolumeIcon.icns
165+
**/.com.apple.timemachine.donotpresent
166+
167+
### JetBrains IDEs ###
168+
**/*.iws
169+
**/.idea/
170+
**/.idea_modules/
171+
172+
### Python ###
173+
**/__pycache__/
174+
**/*.py[cod]
175+
**/*$py.class
176+
**/.Python
177+
**/build/
178+
**/develop-eggs/
179+
**/dist/
180+
**/downloads/
181+
**/eggs/
182+
**/.eggs/
183+
**/parts/
184+
**/sdist/
185+
**/wheels/
186+
**/*.egg
187+
**/*.egg-info/
188+
**/.installed.cfg
189+
**/pip-log.txt
190+
**/pip-delete-this-directory.txt
191+
192+
### Unit test / coverage reports ###
193+
**/.cache
194+
**/.coverage
195+
**/.hypothesis/
196+
**/.pytest_cache/
197+
**/.tox/
198+
**/*.cover
199+
**/coverage.xml
200+
**/htmlcov/
201+
**/nosetests.xml
202+
203+
### pyenv ###
204+
**/.python-version
205+
206+
### Environments ###
207+
**/.env
208+
**/.venv
209+
**/env/
210+
**/venv/
211+
**/ENV/
212+
**/env.bak/
213+
**/venv.bak/
214+
215+
### VisualStudioCode ###
216+
**/.vscode/
217+
**/.history
218+
219+
### Windows ###
220+
# Windows thumbnail cache files
221+
**/Thumbs.db
222+
**/ehthumbs.db
223+
**/ehthumbs_vista.db
224+
**/Desktop.ini
225+
**/$RECYCLE.BIN/
226+
**/*.lnk
227+
228+
### requirements.txt ###
229+
# We ignore Python's requirements.txt as we use Poetry instead
230+
**/requirements.txt
231+
**/.aws-sam

0 commit comments

Comments
 (0)