Skip to content

juranki/sveltekit-cdk

Repository files navigation

SvelteKit CDK Adapter

WARNING: Not maintained

Have a look at SST instead.

WARNING: Not for production, yet!!

No compatibility between versions is garanteed while in initial development. It's recommended to use exact version in package.json to avoid suprices.

This repo contains tooling to deploy SvelteKit sites to AWS using CDK.

Tools are split to two packages: adapter that plugs into the sveltekit project, and constructs that are imported to CDK project to integrate SvelteKit site to other parts of your system.

  • @sveltekit-cdk/adapter

    • plugs into the sveltekit project and makes site available to be consumed in CDK stacks
    • npm version
  • @sveltekit-cdk/constructsv2

    • SvelteDistribution construct bundles and deploys the site to Lambda@Edge and S3, and distributes it with CloudFront
    • npm version

Howto

TODO: fill in details

  1. init sveltekit project
  2. init cdk project
  3. add adapter to sveltekit project and point it to cdk project
  4. add constructs to cdk project
  5. optionally edit cdk stacks to
    • hook site up with other resources
    • add custom domain and certificate
    • adjust capacity allocation
    • ...

Status

  • In initial development, API IS NOT STABLE!
  • I feel quite confident about overall structure
  • Areas of uncertainty that are likely to cause significant changes (== opinions, feedback and advice appreciated)
    • how to design constructs to be both intuitive and flexible; how much flexibility is really needed (2022-02-12: focus on ease or use and robustness, even at the expence of flexibility)
    • dependency management of constructs: cdk moves fast, v1 and v2 have different approaches to packaging and versioning (2022-02-12: only support v2)
    • adapter interface of sveltekit might still change a little

Links