Skip to content

Repository files navigation

mystash

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

Mystash @ Cloudfront

Install development environment

Backend

  • PNPM is required
  • Docker is required
  • Serverless is required
  • AWS CLI is required

Install pnpm

npm install pnpm --global
pnpm setup

Setup environment variables

cp ./packages/backend/.env.example ./packages/backend/.env
pnpm install -g serverless
sudo pacman -S aws-cli
aws configure --profile mystashapp-dev

Add or update ~/.aws/config

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

Init

pnpm run init

Development

Login: dev@example.com / salasana

Backend

pnpm run dev

Frontend

pnpm 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

CDK

Setup 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

Install CDK

pnpm install -g aws-cdk
pnpm install -g ts-node

Prepare AWS environment

export AWS_PROFILE=mystashapp-prod
pnpm ci
aws s3 ls
aws sts get-caller-identity --profile mystashapp-prod
cdk bootstrap aws://AWS-ACCOUNT-ID-HERE/eu-north-1

Deploy

cd frontend
pnpm run build
cd stack
export AWS_PROFILE=mystashapp-prod
pnpm cdk synth --profile mystashapp-prod
pnpm cdk diff --profile mystashapp-prod
pnpm cdk deploy --profile mystashapp-prod

About

Monorepo notes CRUD app running on AWS

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages