The goal of this project was to create a full stack AWS native project template. The secondary goal is to keep the DTO types in sync between the frontend and backend using code generation. Here is the achieved stack:
- Backend:
- Frontend:
- Infrastructure:
smithy-go Does not yet work. Track this issue to see updated status
The go and typescript type generation rely on smithy-go and smithy-typescript, both products are not yet GA. As such they still have some quirks to work through. Overall it seems that the typescript code generation tool is a bit more stable.
If you stumbled across this guide another resource that wasn't GA but looks promising is: aws-prototyping-sdk, specifically the type-safe-api.
^last updated 11/05/2023
This project assumes the following are installed on your system:
- Clone the repo:
git clone git@github.com:zfz7/tetris_aws.git
- Export the following variables:
export AWS_PROFILE=AdministratorAccess-123456789012
export AWS_ACCOUNT=123456789012
export ROOT_HOSTED_ZONE_ID_GO=ABCDEFGHIJKLIMOP
export ROOT_HOSTED_ZONE_NAME_GO=example.com
- Build the project (from root):
./gradle build
- Login to AWS:
aws sso login
- Deploy the project (from root):
./gradle deploy
###Clean
./gradlew clean #clean all projects
./gradlew <project>:clean
./gradlew backend:clean
###Build
./gradlew build #build all projects
./gradlew <project>:clean
./gradlew model:build
###Deploy
./gradlew deploy
###Testing the endpoint with Cognito
export C_TOKEN="$(aws cognito-idp initiate-auth --region us-west-2 --auth-flow USER_PASSWORD_AUTH --client-id <YOUR_CLIENT_ID> --auth-parameters USERNAME=<USERNAME>,PASSWORD=<PASSWORD> | jq -r .AuthenticationResult.IdToken)"'
curl -H "Authorization: Bearer $C_TOKEN" https://api.daniel-eichman.com/hello\?name\=hi