willfarrell / sveltekit-adapter-middy

SvelteKit adapter for AWS Lambda with Middy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Middy SvelteKit Adapter

Middy logo

SvelteKit adapter for AWS Lambda using Middy

npm version npm install size GitHub Actions CI status badge
Standard Code Style Known Vulnerabilities CodeQL Core Infrastructure Initiative (CII) Best Practices
Chat on Gitter Ask questions on StackOverflow

Creates a lambda that supports a Function URL with streaming responses.

Features

  • Response Stream
  • Extendable with Middy middlewares:
    • http-content-encoding
    • http-security-headers
    • ssm/secrets-manger
  • Removes x-sveltekit-page headers
  • Override Origin header with ORIGIN env

Note: Bring your own deployment.

Getting started

npm i -D sveltekit-adapter-middy
import adapter from 'sveltekit-adapter-middy'

export default {
  kit: {
    adapter: adapter({
      // options
    })
  }
}

Options

  • handlerPath (string): Relative path to handler override file. Overriding allows you to add in Content-Encoding, Security Headers, and pass in secrets more securely. Defaults to build-in minimalist handler.
  • out (string): Relative path to build dir. Defaults to build
  • esbuildOptions (object): esbuild option overrides. See code for defaults.

Recommended Infrastructure

  • CloudFront: Route to static assets / pages, with fallback to server side rendering
  • S3: store static assets and pages
  • Lambda Function URL: server side rendering

Roadmap

  • infra diagram
  • cli to sync static assets to S3 w/ headers
  • LLRT

License

Licensed under MIT License. Copyright (c) 2017-2024 Luciano Mammino, will Farrell, and the Middy team.

FOSSA Status

About

SvelteKit adapter for AWS Lambda with Middy

License:MIT License


Languages

Language:JavaScript 100.0%