An open API service indexing awesome lists of open source software.

https://github.com/jill64/sveltekit-adapter-aws

🔌 SveleteKit AWS adapter with multiple architecture
https://github.com/jill64/sveltekit-adapter-aws

adapter aws sveltekit

Last synced: about 1 year ago
JSON representation

🔌 SveleteKit AWS adapter with multiple architecture

Awesome Lists containing this project

README

          

# @jill64/sveltekit-adapter-aws

npm-version npm-license npm-download-month npm-min-size deploy-test-buffered.yml deploy-test.yml

🔌 SveleteKit AWS adapter with multiple architecture

## Introduction

If you are building a SPA, consider AWS Amplify + [adapter-static](https://kit.svelte.dev/docs/single-page-apps).
If you want to use always-on servers (not serverless), consider EC2 (ECR) + [adapter-node](https://kit.svelte.dev/docs/adapter-node).

## Install

1. Install [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) in local machine

2. [Configure authentication and access credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html) in AWS CLI

3. Install adapter in your SvelteKit project

```sh
npm i -D @jill64/sveltekit-adapter-aws
```

4. If using pnpm, additional dependency is required.

```sh
pnpm i -D aws-cdk-lib dotenv
```

```js
// svelte.config.js
import adapter from '@jill64/sveltekit-adapter-aws'

const config = {
// ...
kit: {
adapter: adapter({
name: 'Your Application Name',
deploy: true,
architecture: 'lambda-s3'
// ...
// Other Adapter Options
// ...
})
}
}

export default config
```

See [Full Adapter Options](./packages/adapter/src/types/AdapterOptions.ts)

## Architecture

This adapter allows you to choose from multiple architectures depending on your use case.

| Name | Response Streaming | Assets Scaling | Low Round Trip | Unlimited SSG | Demo Site (Streaming) | Demo Site (Bufffered) |
| ------------------------------------------------- | ------------------ | -------------- | -------------- | ------------- | ---------------------------------------------- | ------------------------------------------------------- |
| [lambda-mono](./docs/lambda-mono/README.md) | ✅ | | ✅ | | [Link](https://lambda-mono.adapter-aws.com) | [Link](https://buffered.lambda-mono.adapter-aws.com) |
| [lambda-s3](./docs/lambda-s3/README.md)(Default) | ✅ | ✅ | ✅ | | [Link](https://lambda-s3.adapter-aws.com) | [Link](https://buffered.lambda-s3.adapter-aws.com) |
| [edge-bundled](./docs/edge-bundled/README.md) | | ✅ | ✅ | ✅ | | [Link](https://edge-bundled.adapter-aws.com) |
| [edge-unbundled](./docs/edge-unbundled/README.md) | ✅ | ✅ | | ✅ | [Link](https://edge-unbundled.adapter-aws.com) | [Link](https://buffered.edge-unbundled.adapter-aws.com) |

## CI/CD Pipeline

[GitHub Actions Example](./.github/workflows)

1. Setup AWS CLI (Not required in GitHub Actions)
2. Setup AWS Credential
3. Build Application with `deploy: true` option

## CDK Bootstrap

The first time the AWS CDK stack is deployed, `bootstrap` must be run.
Normally this is handled automatically by the adapter.
However, this requires additional permissions, so you can optionally skip the `bootstrap` step.

```js
{
// Adapter Option
skipBootstrap: true
// ...
}
```

## Manual Deploy

If the automatic deployment option is false, you can deploy the app at any time by running the following command after the app build is complete.

```sh
cd ./build && npx cdk deploy
```

## Delete All Resources

```sh
cd ./build && npx cdk destroy --all
```

## License

[MIT](LICENSE)