npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

serverless-url-shortener

v0.9.0

Published

A simple url-shortener, using Serverless framework

Downloads

12

Readme

Serverless URL Shortener

serverless dependencies dev-dependencies bitHound Overall Score coverage license

Serverless URL shortener provides a set of services to shorten urls and track opening completely built on AWS Lambda and Serverless 1.1 framework

A note about languages

The serverless framework relies on AWS Lambda and supports a variety of development languages such as Python, Java, and NodeJS. To this particular project, we found NodeJS being the best solution, due to its special requirements regarding fast time to market. Moreover, we believe NodeJS and Python being first citizens in the Serverless world, thanks to their inner flexibility.

This code is written using ES5 and plain Javascript with a bit of Promise flavor, provided by Bluebird. The reason for this choice (instead of ES6) is related to the support Lambda is currently providing that is NodeJS 4.3.2. We do not believe that using transpillers (such as Babel) is a good idea in an environment where you do not have access to the file system (and cannot debug remote code directly). Call this a conservative move, but we think the risk is not worth the game.

Getting Started

In order to install and run examples you need an AWS account properly configured on your system. To get started with AWS account configuration, please follow this link

Start using Serverless URL shortener is extremely easy

01. Start cloning this repository

git clone https://github.com/aletheia/serverless-url-shortener path-to-my-folder
cd path-to-my-folder

02. Install dependencies through NPM

npm install

03. Deploy CloudFormation stack and functions

Serverless commands are exposed through npm run to provide ease of usage and consistency for continuous integration

npm run sls deploy --stage <any stage> --region <your region>

Project structure

Serverless framework does not force any specific project structure, but relying on some conventions that can make you find your path across any project.

We usually use npm and GulpJS due to the better support for configuration and parameter passing provided by Gulp, but we do not involve any file copy or packing. Whenever this is required, we think that deferring all the uglify/package stuff to Webpack, maybe used as a serverless plugin, could be a great idea.

Going on, code that could be shared through multiple resources is stored into a shared folder, while

Archtiecture

Serverless does not mean architecture-less, moreover strong pattern culture is required since Serverless framework has an unopinionated view about Lambda function development. We have enforced some well-grounded principles into this project, making our code almost completely cloud-independent and enforcing segregation.

A layered archietcture

We adopted a layered architecture as follows for :

APIs

TBD

Where to go from here?

TBD