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

@fnet/filenet-infra

v0.1.2

Published

This project sets up a cloud infrastructure using Amazon Web Services (AWS) for hosting and managing a web service known as Filenet. The goal is to provide a structured setup that includes storage, compute, and networking resources in a scalable and effic

Downloads

11

Readme

infra

This project sets up a cloud infrastructure using Amazon Web Services (AWS) for hosting and managing a web service known as Filenet. The goal is to provide a structured setup that includes storage, compute, and networking resources in a scalable and efficient manner. It leverages the AWS Cloud Development Kit (CDK) to define infrastructure as code, ensuring consistency and repeatability.

How It Works

The project defines a stack of AWS resources using the AWS CDK, which allows for the automated provisioning of these resources. Core components include an S3 bucket for file storage, a Lambda function to handle serverless backend logic, an API Gateway to route HTTP requests, and CloudFront for content delivery. The setup integrates with AWS Route 53 for domain name management, enabling secure access via HTTPS with SSL certificates.

Key Features

  • S3 Bucket with Lifecycle Management: Automatically deletes objects after a set period to manage storage costs efficiently.
  • AWS Lambda Function: Handles computation for API requests, designed to operate in a serverless architecture for scalability.
  • API Gateway Integration: Provides a RESTful API interface for handling client requests to the service.
  • CloudFront Distribution: Ensures low-latency delivery of content globally via a content delivery network.
  • Route 53 Domain Management: Provides DNS services with integration for secure access using HTTPS.
  • Custom Caching Policies: Optimizes content delivery through tailored caching strategies based on client request characteristics.

Conclusion

The project delivers a robust AWS infrastructure setup that effectively combines cloud storage, serverless computation, and content delivery capabilities. Through the use of the AWS CDK, deploying the stack is streamlined, allowing for scalability and reliability. This setup is particularly useful for developers and companies looking to deploy web services with automated infrastructure management.

infra Developer Guide

Overview

The infra npm library is designed to simplify the deployment and management of AWS infrastructure by using the AWS Cloud Development Kit (CDK). By leveraging AWS CDK constructs, developers can programmatically define AWS resources in a scalable, reusable manner. This guide will demonstrate how to create resources like S3 buckets, Lambda functions, API Gateways, Route 53 domains, SSL certificates, and CloudFront distributions using infra.

Installation

To use infra, ensure you have Node.js installed, then install the library via npm or yarn:

npm install infra

or

yarn add infra

Usage

Below is an example demonstrating how to use the infra library to deploy a simple AWS infrastructure setup. This setup includes an S3 bucket, a Lambda function to process requests, an API Gateway to expose the Lambda function, a CloudFront distribution for caching, and a Route 53 domain for managing DNS.

Step-by-Step Example

  1. Create an S3 Bucket: The infra library allows you to create an S3 bucket with lifecycle rules.

  2. Lambda Function: Define a Lambda function that will handle requests. The Lambda function is linked with the S3 bucket to read and write data.

  3. API Gateway: Use an API Gateway to create and deploy endpoints that route requests to the Lambda.

  4. Route 53 and SSL Certificate: Manage DNS using Route 53 and secure your domain with an SSL certificate.

  5. CloudFront Distribution: Set up a CloudFront distribution that acts as a Content Delivery Network (CDN) for the API and static content from the S3 bucket.

Examples

Code Example

import * as cdk from 'aws-cdk-lib';
import { Stack } from 'aws-cdk-lib';
import * as s3 from 'aws-cdk-lib/aws-s3';
import * as lambda from 'aws-cdk-lib/aws-lambda';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';
import * as route53 from 'aws-cdk-lib/aws-route53';
import * as route53Targets from 'aws-cdk-lib/aws-route53-targets';
import * as certificatemanager from 'aws-cdk-lib/aws-certificatemanager';
import * as cloudfront from 'aws-cdk-lib/aws-cloudfront';
import { S3BucketOrigin, HttpOrigin } from 'aws-cdk-lib/aws-cloudfront-origins';

class HelloCdkStack extends Stack {
  constructor(scope, id, props) {
    super(scope, id, props);

    // S3 Bucket with automatic cleanup
    const bucket = new s3.Bucket(this, 'FilenetBucket', {
      versioned: true,
      removalPolicy: cdk.RemovalPolicy.DESTROY,
      autoDeleteObjects: true,
      lifecycleRules: [{ expiration: cdk.Duration.days(3) }],
    });

    // Lambda function connected to S3
    const filenetLambda = new lambda.Function(this, 'FilenetLambda', {
      runtime: lambda.Runtime.NODEJS_20_X,
      code: lambda.Code.fromAsset('infra-api-handler'),
      handler: 'index.handler',
      environment: { BUCKET_NAME: bucket.bucketName },
    });
    bucket.grantReadWrite(filenetLambda);

    // API Gateway setup
    const api = new apigateway.RestApi(this, 'FilenetApi', {
      restApiName: 'Filenet Service',
      description: 'This service serves Filenet API.',
    });
    const addressResource = api.root.addResource('hex').addResource('{address}');
    addressResource.addMethod('GET', new apigateway.LambdaIntegration(filenetLambda));
    
    // DNS with Route 53
    const hostedZone = route53.HostedZone.fromLookup(this, 'MyHostedZone', {
      domainName: 'filenet.pro',
    });

    // SSL certificate
    const certificate = new certificatemanager.DnsValidatedCertificate(this, 'SiteCertificate', {
      domainName: 'filenet.pro',
      hostedZone: hostedZone,
      region: 'us-east-1',
    });

    // CloudFront distribution
    const distribution = new cloudfront.Distribution(this, 'FilenetDistribution', {
      defaultBehavior: {
        origin: new S3BucketOrigin(bucket),
        viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
      },
      domainNames: ['filenet.pro'],
      certificate: certificate,
    });

    // Route 53 A Record
    new route53.ARecord(this, 'SiteAliasRecord', {
      recordName: 'filenet.pro',
      target: route53.RecordTarget.fromAlias(new route53Targets.CloudFrontTarget(distribution)),
      zone: hostedZone,
    });

    // Output the API Gateway URL
    new cdk



# Input Schema
```yaml
$schema: https://json-schema.org/draft/2020-12/schema
type: object
properties:
  env:
    type: object
    properties:
      CDK_DEFAULT_ACCOUNT:
        type: string
        description: AWS Account ID
      CDK_DEFAULT_REGION:
        type: string
        description: AWS Region
    required:
      - CDK_DEFAULT_ACCOUNT
      - CDK_DEFAULT_REGION
    oneOf:
      - properties:
          AWS_PROFILE:
            type: string
            description: AWS Profile Name
        required:
          - AWS_PROFILE
      - properties:
          AWS_ACCESS_KEY_ID:
            type: string
            description: AWS Access Key ID
          AWS_SECRET_ACCESS_KEY:
            type: string
            description: AWS Secret Access Key
          AWS_SESSION_TOKEN:
            type: string
            description: AWS Session Token
        required:
          - AWS_ACCESS_KEY_ID
          - AWS_SECRET_ACCESS_KEY
required:
  - env