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

turbo-remote-cache-construct

v1.0.0

Published

A Turborepo Remote Cache implementation using AWS API Gateway, Lambda, S3, and DynamoDB.

Downloads

28

Readme

Turborepo Remote Cache API Construct

GitHub License Version Downloads PRs Welcome

An AWS CDK construct for easily deploying a Turborepo Remote Cache API infrastructure. This project implements a Remote Cache API for Turborepo using AWS services. It provides a scalable and efficient solution for storing and retrieving build artifacts in a distributed development environment.

Why use Remote Caching?

The Turborepo Remote Cache API allows teams to share and reuse build artifacts across different machines and CI/CD pipelines, significantly reducing build times and improving development efficiency. Read more about Remote Caching

Features

  • :zap: High-performance S3 integration for artifact storage
  • :lock: Secure authentication using API keys
  • :chart_with_upwards_trend: Scalable architecture using serverless AWS services
  • :globe_with_meridians: Optional custom domain support
  • :gear: Easy integration with existing CDK stacks
  • :moneybag: Cost-effective usage-based pricing model
  • :recycle: Automatic artifact cleanup to manage storage costs
  • :clock1: Significant build time reduction for large projects

Getting Started

Read the guide to deploy the Remote Cache API in your own AWS account and use it with your Turborepo project.

Installation

To use this construct in your CDK project, install it using npm, pnpm, or yarn:

npm install turbo-remote-cache-construct
pnpm add turbo-remote-cache-construct

Usage

Import and use the construct in your CDK stack:

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { TurboRemoteCache } from 'turbo-remote-cache-construct';
import * as acm from 'aws-cdk-lib/aws-certificatemanager';
import * as apigateway from 'aws-cdk-lib/aws-apigateway';

export class TurboRemoteCacheStack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // load TURBO_TOKEN from .env file
    dotenv.config({ path: path.join(__dirname, '..', '.env') });

    if (!process.env.TURBO_TOKEN) {
      throw new Error('TURBO_TOKEN is not set');
    }

    new TurboRemoteCache(this, 'TurboRemoteCache', {
      turboToken: process.env.TURBO_TOKEN,
      apiProps: {
        // optional domain name options for using a custom domain with API Gateway
        domainName: {
          domainName: 'your-custom-domain.com',
          // create a certificate in us-east-1 for custom domain
          certificate: acm.Certificate.fromCertificateArn(this, 'Certificate', 'arn:aws:acm:us-east-1:123456789012:certificate/12345678-1234-1234-1234-123456789012'),
          endpointType: apigateway.EndpointType.EDGE,
          securityPolicy: apigateway.SecurityPolicy.TLS_1_2,
        },
      },
      // optional S3 bucket props for to configure the artifacts bucket
      artifactsBucketProps: {
        bucketName: 'turbo-remote-cache-artifacts',
        removalPolicy: cdk.RemovalPolicy.RETAIN,
      },
      // optional DynamoDB table props for to configure the events table
      eventsTableProps: {
        tableName: 'turbo-remote-cache-events',
        removalPolicy: cdk.RemovalPolicy.RETAIN,
      },
    });
  }
}

The S3 bucket, DynamoDB table, and API Gateway can be configured using the optional props. The defaults are are provided in the jsdoc comments and can be viewed in the source code. The example above uses apiProps to configure a custom domain name for the API Gateway. It also uses artifactsBucketProps to customize the bucketName and removalPolicy to retain the bucket when the stack is deleted. Similar options are available for the DynamoDB table.

Architecture

The construct uses API Gateway, Lambda, S3 integration, and DynamoDB to create a serverless Turborepo Remote Cache REST API. The construct can be self-hosted in your AWS account and be used with the Turborepo Remote Cache.

Components

  • API Gateway: Used to create a REST API that will be used to interact with the Remote Cache.
  • Lambda: Used to handle the API requests and responses for non-artifact related endpoints.
  • S3 Integration: Allows API Gateway to integrate with S3 without a Lambda function which allows for a larger payload size and lower latency.
  • S3: Used to store the Remote Cache artifacts.
  • DynamoDB: Used to store the Remote Cache events.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This construct is licensed under the MIT License. See the LICENSE file for details.