# elysia-lambda

> A plugin for Elysia to deploy to AWS Lambda

Latest version **0.0.7** (published 2023-06-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install elysia-lambda
pnpm add elysia-lambda
yarn add elysia-lambda
bun add elysia-lambda
```

Provides the command `elysia-lambda`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.7 |
| Published | 2023-06-06 |
| First published | 2023-04-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM |
| Dependencies | 9 |
| Unpacked size | 95.8 KB |
| Known vulnerabilities | 0 (+12 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 39 |
| Author | Jesse Daniel Mitchell |
| Maintainers | totaltechgeek |

## Links

- npm: https://www.npmjs.com/package/elysia-lambda
- Repository: https://github.com/TotalTechGeek/elysia-lambda
- npm.io page: https://npm.io/package/elysia-lambda

## Dependencies (9)

- [yaml](https://npm.io/package/yaml.md) ^2.2.2
- [chalk](https://npm.io/package/chalk.md) ^5.2.0
- [elysia](https://npm.io/package/elysia.md) ^0.4.13
- [adm-zip](https://npm.io/package/adm-zip.md) ^0.5.10
- [inquirer](https://npm.io/package/inquirer.md) ^9.2.0
- [commander](https://npm.io/package/commander.md) ^10.0.1
- [deep-equal](https://npm.io/package/deep-equal.md) ^2.2.1
- [superagent](https://npm.io/package/superagent.md) ^8.0.9
- [@aws-sdk/client-lambda](https://npm.io/package/@aws-sdk/client-lambda.md) ^3.322.0

## Recent versions

- 0.0.7 (latest) — 2023-06-06
- 0.0.6 — 2023-05-31
- 0.0.5 — 2023-04-30
- 0.0.4 — 2023-04-29
- 0.0.3 — 2023-04-29
- 0.0.2 — 2023-04-29
- 0.0.1 — 2023-04-29

## README

# elysia-lambda

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

## Installation

```bash
bun install elysia-lambda
```

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

```typescript
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,

```bash
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:

```yaml
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:

```txt
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:

```bash
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.

---
_Source: https://npm.io/package/elysia-lambda · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
