All Projects → ericellb → Lightning-Link

ericellb / Lightning-Link

Licence: GPL-3.0 license
Scalable URL Shortener in Typescript / Express + React frontend

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects
HTML
75241 projects

Lightning Link

Scalable URL Shortener written in TypeScript / Express with React frontend. Live Version @ https://ltng.link/

The goal of Lightning Link is to design a highly scalable URL shortener that does not have collisions when generating a new url and minimal number of database queries.

The API sit behind a Load Balancer, as many API services can be launched as needed.

Load balancing occurs in a round robin format (mostly for proof of concept), and rate limiting is shared across all API instances using Redis for storing Rate Limiting data.

Analytic data is provided to the Creator of the short URL showing the Geo locations of visitors and total number of visits.

layout image

layout image

Implemented Features

  • Basic Scalable URL Shortener Backend
  • Backend Analytics (See visits, geographic data etc..)
  • Frontend for URL Shortener
  • Frontend Auth + Analytics (Working on it..)

Planned Features

  • Optimization + Design Tweaks

API Documentation

Shorten URL

Returns an Short URL for Given Destination URL.

If userId given allows you to pull analytic data and links shortened route to your userId

  • URL

    /shorten

  • Method:

    POST

  • URL Params

    Required:

    destination=[string]

    Optional:

    forceNewUrl=[boolean]

    userId=[string]

  • Success Response:

    • Code: 200
      Content: slug : 0daajd
  • Error Response:

    • Code: 400 BAD REQUEST
      Content: Must provide a long url
  • Sample Call:

      axios.post('/shorten?destination=www.google.com')
      .then((res) => {
      	console.log(res) -> "0004c92"
      }

Get Redicretion URL

Returns the original URL for you to redirect the user to

  • URL

    /:slug

  • Method:

    GET

  • URL Params

    Required:

    slug=[string]

  • Success Response:

    • Code: 200
      Content: destination : www.google.com
  • Error Response:

    • Code: 400 BAD REQUEST
      Content: Must provide a long url
  • Sample Call:

      axios.get('/0004c92')
      .then((res) => {
      	console.log(res) -> "http://www.google.com"
      }

Get Analytic Data

Returns the Analytic Data of a Short URL given your UserID is the creator

  • URL

    /analytic/:slug

  • Method:

    GET

  • URL Params

    Required:

    slug=[string]

    userId=[string]

  • Success Response:

    • Code: 200
      Content: { "urls_slug": "000BLjl", "creator_user_id": "some_user_id", "visits": 3, "worlds": "[{\"city\": \"Montreal\", \"visits\": \"2\", \"country\": \"Canada\", \"continent\": \"NA\"}]" }
  • Error Response:

    • Code: 401 UNAUTHORIZED
      Content: Unauthorized Route
  • Sample Call:

      axios.get('/analytics/0004c92')
      .then((res) => {
      	console.log(res)
      }

License

Copyright Eric Ellbogen 2019

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].