Skip to content

lahdeero/mystash

Repository files navigation

mystash

Mystash @ https://mystash.70511337.xyz/

Mystash @ Cloudfront

Install development environment

Backend

  • Docker is required
  • Serverless is required
  • AWS CLI is required
npm install -g serverless
npm i
aws configure --profile mystashapp-dev

Add or update ~/.aws/config

[default]
s3 =
    endpoint_url = http://localhost:4566

Development

Backend

npm run dev

Frontend

npm start

Debug

List tables

aws dynamodb list-tables --endpoint-url http://localhost:8001

Delete table

aws dynamodb delete-table --table-name mystash-dev-users --endpoint-url http://localhost:8001

List users

aws dynamodb scan \
    --table-name mystash-dev-users \
    --endpoint-url http://localhost:8001

List notes

aws dynamodb scan \
    --table-name mystash-dev-notes \
    --endpoint-url http://localhost:8001

List files

aws dynamodb scan \
    --table-name mystash-dev-files \
    --endpoint-url http://localhost:8001
aws dynamodb delete-item \
    --table-name mystash-dev-users \
    --key '{"id": {"S": "replace-this-with-real-uuid"}}' \
    --endpoint-url http://localhost:8001
aws dynamodb delete-item \
    --table-name mystash-dev-notes \
    --key '{"id": {"S": "0de4eafa-4752-4535-aab0-79a3a9592b95"}}' \
    --endpoint-url http://localhost:8001
aws --endpoint-url=http://localhost:4566 s3 ls
aws --endpoint-url=http://localhost:4566 s3 ls s3://mystash-dev-infra-files-bucket --recursive

Deploy

sam local invoke "Register" -e event.json

Stack AWS CLI

Must install aws cli and cdk before. If cdk synth gives some docker error make sure esbuild is installed!

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
npm i -g aws-cdk
export AWS_PROFILE=mystashapp-prod
npm ci
aws s3 ls
aws sts get-caller-identity --profile mystashapp-prod
cdk bootstrap aws://AWS-ACCOUNT-ID-HERE/eu-north-1
cd stack
export AWS_PROFILE=mystashapp-prod
cdk synth --profile mystashapp-prod
cdk diff --profile mystashapp-prod
cdk deploy --profile mystashapp-prod