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

@amazon-codecatalyst/blueprints.serverless-tinyurl

v0.3.0

Published

This blueprint creates a serverless Tiny URL Java Web Application using AWS Lambda, Amazon S3, Amazon API Gateway and Amazon DynamoDB. This project also includes canary tests using Cloudwatch Synthetics.

Downloads

3

Readme

About this blueprint:

This blueprint builds a functional tiny URL single-page application with a serverless backend and deploys it into a given AWS account. The repository generated by this blueprint will contain both projects and the CDK stacks that are used to deploy both the frontend and backend.

Architecture overview:

The application architecture uses Amazon CloudFront, AWS Lambda, Amazon API Gateway, Amazon DynamoDB, and Amazon S3.

  • AWS API Gateway to provide the REST interface to the user
  • Amazon DynamoDB for URL persistence
  • AWS Lambda process the API gateway requests for create and retrieve the data from DynamoDB table
  • Amazon CloudFront to provide a unified endpoint with origins for both frontend and backend
  • Amazon S3 to store the frontend resources and served through CloudFront

The frontend application framework uses ReactJS with TypeScript and uses CloudScape for the user interface.

The build pipeline runs unit and integration tests on the frontend and backend, and produces testing reports. Failed tests will stop the artifacts from publishing. The frontend code is compiled and optimized for production deployment.

The Amazon CloudFront CDN is used to pull both the frontend and backend together under a single logical internet-accessible domain under the AWS account that is connected. Cloudfront provides HTTPS support for the domain as well as forward caching for the front-end.

Architecture Diagram

Configuring the account connection

An AWS account connection is required before deploying this project. An IAM role with below policy statement is required for the blueprint to deploy successfully.

In order to deploy the application successfully, the account should be CDK bootstrapped. Please refer AWS doc on CDK bootstrap for bootstrapping the account. The account should be bootstrapped in the region where the application needs to be deployed.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "iam:PassRole",
                "iam:DeleteRole",
                "iam:GetRole",
                "iam:TagRole",
                "iam:CreateRole",
                "iam:AttachRolePolicy",
                "iam:DetachRolePolicy",
                "iam:DeleteRolePolicy",
                "iam:PutRolePolicy",
                "s3:*",
                "cloudformation:*",
                "lambda:*",
                "apigateway:*",
                "ssm:*",
                "ecr:SetRepositoryPolicy",
                "ecr:GetLifecyclePolicy",
                "ecr:PutImageScanningConfiguration",
                "ecr:DescribeRepositories",
                "ecr:PutImageTagMutability",
                "ecr:ListTagsForResource",
                "ecr:CreateRepository",
                "ecr:DeleteRepository"
            ],
            "Resource": "*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "sts:AssumeRole"
            ],
            "Resource": [
                "arn:aws:iam::*:role/cdk-*"
            ]
        }
    ]
}

Note: If you add more resources, you will need to update the policy

IAM role also requires below trust policy.

{
  "Version": "2012-10-17",
  "Statement": [
      {
          "Sid": "CodeCatalyst",
          "Effect": "Allow",
          "Principal": {
              "Service": [
                  "codecatalyst-runner.amazonaws.com",
                  "codecatalyst.amazonaws.com"
              ]
          },
          "Action": "sts:AssumeRole"
      }
  ]
}

Project resources

This blueprint will create the Amazon CodeCatalyst Resources and along with a source code Repository for the project. The project contains below modules / files

  • .codecatalyst/workflows/build-and-release.yaml: The template that defines the project's workflow

  • backend

    • cdk: Java maven module for creating the Application.

    • lambda: Java maven module for the Lambda function used by the Application to create tiny URL and retrieve long URL.

    • pom.xml: Maven configuration for dependency management, plugin management, build and packaging

    • cdk.json: To execute the CDK code

  • frontend

    • canary: Canary test script

    • cdk : Typescript package to code the frontend infrastructure

    • src: React components using to power the frontend

    • public: static html resources

Additional resources

See the Amazon CodeCatalyst user guide for additional information on using the features and resources of Amazon CodeCatalyst