- Generate a short URL
- List short URLs
- Statistics on visits of a particular short url as a graph.
Architecture is as follows:
- S3 web site hosting is used to host the frontend.
- API Gateway is used to communicate with backend.
- Generated short url will be saved in DynamoDB.
- Individual visits and visit count will be saved/updated in DynamoDB.
- Used single table design with DyanmoDB.
- SNS used to communicate/trigger count and statistics functions.
- Need to have sam cli and npm installed
-
Clone the repository
-
Goto the backend directory, and run:
sam build
sam deploy -g
providing Stack Name, region etc.
- Copy below values from the output:
ApiGatewayBaseUrl
PublicWebSiteURL
FrontendWebSiteBucket
-
Goto frontend directory.
-
Copy .env.example to .env and replace the values of
VUE_APP_API_BASE_URL
with aboveApiGatewayBaseUrl
value with a slash end of it. -
Run
npm install
-
Run
npm run build
This will create the build for production in dist directory.
- Then upload the build files to s3 web site using below command. Replace the value
FrontendWebSiteBucket
.
aws s3 cp dist s3://[FrontendWebSiteBucket] --recursive
- Once done, you can access the system using the value of
PublicWebSiteURL
Within the backend directory, run
aws cloudformation delete-stack --stack-name [StackName]