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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@lafken/bucket

v0.6.4

Published

Create and manage Amazon S3 buckets in TypeScript with automatic infrastructure generation

Readme

@lafken/bucket

@lafken/bucket helps you create and manage Amazon S3 buckets directly in your infrastructure. It provides decorators that automatically generate the required bucket resources, and also exposes a repository that can be used within your Lambda functions to perform S3 operations through the AWS SDK.

Installation

npm install @lafken/bucket

Configuration

To get started, you must add the resolver when creating your application. Import the BucketResolver and instantiate it, passing the bucket classes that are decorated with the @Bucket decorator. These decorated classes define the S3 buckets that will be created as part of your infrastructure.

import { ApiResolver } from '@lafken/bucket/resolver';

//...
@Bucket({
  name: 'lafken-example-documents',
  forceDestroy: true,
  eventBridgeEnabled: true,
})
export class DocumentBucket {}

// ...

createApp({
  name: 'awesome-app',
  resolvers: [
    new BucketResolver([DocumentBucket]),
  ],
  ...
});

Features

Bucket

You can define and configure an S3 bucket by creating a class and decorating it with the @Bucket decorator. This decorator allows you to specify all the necessary properties required to provision the bucket in Amazon S3.

@Bucket({
  name: 'lafken-example-documents',
  forceDestroy: true,
  eventBridgeEnabled: true,
  versioned: true,
  tracing: true,
  transferAcceleration: true,
  acl: 'public-read-write',
  lifeCycleRules: {
    docs: {
      condition: {
        objectSizeGreaterThan: 1000,
      },
      expiration: {
        days: 20,
      },
      transitions: [
        {
          days: 10,
          storage: 'glacier',
        },
      ],
    },
  },
})
export class DocumentBucket {}

Life cycle

Buckets support the creation of lifecycle rules through the lifeCycleRules property. These rules define how objects within the bucket are transitioned or expired over time. You can configure actions such as moving objects to different storage classes, archiving them, or deleting them after a specified period.

@Bucket({
  lifeCycleRules: {
    docs: {
      condition: {
        objectSizeGreaterThan: 1000,
      },
      expiration: {
        days: 100,
      },
      transitions: [
        {
          days: 10,
          storage: 'intelligent_tiering',
        },
        {
          days: 30,
          storage: 'glacier'
        }
      ],
    },
  },
  // ...
})
// ...

Repository

Once a bucket is defined, you can create a repository for it. A repository provides direct access to common S3 SDK operations such as uploading, moving, or deleting objects.

import { Bucket } from '@lafken/bucket/main';
import { createRepository } from '@lafken/bucket/service';
//...
export class DocumentBucket {}
export const documentRepository = createRepository(DocumentBucket);

// ... in lambda 

await documentRepository.putObject({
  Key: 'list.json',
  Body: JSON.stringify([1, 2, 3]),
});