Skip to content

mourjo/liliput

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Liliput: Serverless shortlinks on AWS

This is a project that shortens links, built on AWS. This is deployed here: https://liliput.mourjo.me

Goal

  • Authenticated users can create new short links
  • Short links can be visited without signing in
  • Rudimentary statistics viewable by the creator - number of visits

sequence.svg

Demo

https://liliput.mourjo.me

liliput.mp4

Implementation

Following are the major implementation pieces - all built on AWS and deployed here: https://liliput.mourjo.me

Serving the static HTML with S3

  • A single HTML page is served from S3 which then makes XHR requests for getting the current user's links and creating new short links

Homepage: Showing list of previously created links

  • The current user is inferred from the lambda function CookieAuthorizer which reads the cookie header and identifies the user
  • A lambda function ListLinksHandler serves the current user's links from DynamoDB
  • Creation of a new short link is similar to this flow, except a link is inserted into DynamoDB instead of reading from it.

Visiting a short link

  • Anonymous users can visit existing shortlinks
  • A Lambda function fetches the original link from DynamoDB and redirects the user to it

Authentication flow with AWS Cognito

auth_sequence.svg

Custom domain

  • AWS cognito supports custom domains, in this project Cognito is configured with auth.liliput.mourjo.me
  • REST APIs in API gateway supports custom domains, liliput.mourjo.me is used in this case

Social Login with Google

Limitations

  • Lambda functions using Java are slow, even with Snapstart. Since each API request is served by a different Lambda, the UI can feel quite slow. Possible alternatives are: reserved concurrency(which is costly) or a different runtime.

About

Serverless Shortlinks on AWS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published