Skip to content

Serverless URL shortner with AWS Lambda, S3, SNS, DynamoDB with VueJS

Notifications You must be signed in to change notification settings

pubudusj/serverless-url-shortner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fully Serverless URL Shortner

with AWS Lambda, API Gateway, S3, SNS, DynamoDB, VueJS

Functionality:

  1. Generate a short URL
  2. List short URLs
  3. Statistics on visits of a particular short url as a graph.

Architecture is as follows:

Image of Architecture

  1. S3 web site hosting is used to host the frontend.
  2. API Gateway is used to communicate with backend.
  3. Generated short url will be saved in DynamoDB.
  4. Individual visits and visit count will be saved/updated in DynamoDB.
  5. Used single table design with DyanmoDB.
  6. SNS used to communicate/trigger count and statistics functions.

Prerequisites

  • Need to have sam cli and npm installed

How to install

  1. Clone the repository

  2. Goto the backend directory, and run:

sam build
sam deploy -g

providing Stack Name, region etc.

  1. Copy below values from the output:
ApiGatewayBaseUrl
PublicWebSiteURL
FrontendWebSiteBucket
  1. Goto frontend directory.

  2. Copy .env.example to .env and replace the values of VUE_APP_API_BASE_URL with above ApiGatewayBaseUrl value with a slash end of it.

  3. Run npm install

  4. Run npm run build

This will create the build for production in dist directory.

  1. Then upload the build files to s3 web site using below command. Replace the value FrontendWebSiteBucket.
aws s3 cp dist s3://[FrontendWebSiteBucket] --recursive
  1. Once done, you can access the system using the value of PublicWebSiteURL

Deleting the stack

Within the backend directory, run

aws cloudformation delete-stack --stack-name [StackName]

Example screenshots

Add and List short urls: Add and List short urls

Stats of a single short url: Stats of a single short url

About

Serverless URL shortner with AWS Lambda, S3, SNS, DynamoDB with VueJS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published