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

elysia-lambda

v0.0.7

Published

A plugin for Elysia to deploy to AWS Lambda

Downloads

71

Readme

elysia-lambda

This plugin for Elysia attempts to make it easier to deploy your Elysia project to AWS Lambda.

Installation

bun install elysia-lambda

In your application, you will add the following to your code:

import { Elysia } from 'elysia'
import { lambda } from 'elysia-lambda'

const app = new Elysia()
    .use(lambda())

This is all you need to do to install the plugin into your codebase.

Usage

We strongly recommend running the init command,

bunx elysia-lambda --init

This will guide you through the process of setting up your project for deployment to AWS Lambda, and setting up the official Bun layer.

This application expects that you are configured with sufficient AWS CLI Permissions.

After the init command has been performed, you will have a yaml file for your lambda deployment and a deploy script added to your package.json.

The configuration file will look like the following:

deploy: src/index.ts
name: ElysiaLambda
region: us-east-1
arch: arm64
description: An Elysia Lambda app.
role: arn:aws:iam::672112969134:role/TestLambda
layers:
  - arn:aws:lambda:us-east-1:672112969134:layer:bun:8
environment: 
  SomeEnvVariable: SomeValue
memory: 256

Alternatively, it is possible to run the tool exclusively from the CLI:

Usage: elysia-lambda [options]

Options:
  --init                  Begin the setup to deploy to Lambda.
  --deploy <src>          Deploy to AWS
  --build <src>           Build for AWS
  -o, --out <dest>        Where to output the build zip.
  -r, --region <region>   AWS region to deploy to.
  --role <role>           AWS role to attach to the lambda.
  --name <name>           Name of the lambda.
  --layers <layers...>    AWS layers to attach to the lambda.
  -c , --config <config>  Path to a yaml/json config file.
  --description <desc>    Description of the lambda.
  --memory <MiB>          Memory to allocate to the lambda, in MiB. (default: "128")
  --arch <architecture>   AWS architecture to deploy to. (choices: "arm64", "x64")
  -h, --help              display help for command

After adding a deploy script to your package.json, you can run the following command to deploy your application:

bun run deploy

This will build your application and deploy it to AWS Lambda.

Demo

https://user-images.githubusercontent.com/2261916/235324906-17f1fdcf-d61a-487e-b498-595e7f94c836.mp4

Notes

The deployment script requires Bun versions newer than 0.6.0.

I may add support for ESBuild & the Elysia Node.js Polyfills in the future.