{"id":28932413,"url":"https://github.com/juspay/sveltekit-aws-adapter","last_synced_at":"2025-07-13T06:33:05.861Z","repository":{"id":204758492,"uuid":"711270650","full_name":"juspay/sveltekit-aws-adapter","owner":"juspay","description":" A sveltekit adapter which makes it possible to run svletekit on a AWS lambda@edge function and S3.","archived":false,"fork":false,"pushed_at":"2024-02-16T18:17:06.000Z","size":145,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":5,"default_branch":"release","last_synced_at":"2025-06-22T16:57:52.191Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/juspay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-10-28T18:12:46.000Z","updated_at":"2024-03-26T12:41:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"8495dfcd-6ab7-42ad-9b52-d00fd7510697","html_url":"https://github.com/juspay/sveltekit-aws-adapter","commit_stats":null,"previous_names":["juspay/sveltekit-aws-adapter"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/juspay/sveltekit-aws-adapter","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fsveltekit-aws-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fsveltekit-aws-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fsveltekit-aws-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fsveltekit-aws-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/juspay","download_url":"https://codeload.github.com/juspay/sveltekit-aws-adapter/tar.gz/refs/heads/release","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/juspay%2Fsveltekit-aws-adapter/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265099166,"owners_count":23711290,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-06-22T16:42:16.695Z","updated_at":"2025-07-13T06:33:05.856Z","avatar_url":"https://github.com/juspay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS adapter for SvelteKit\n\nAn adapter to build a [SvelteKit](https://kit.svelte.dev/) app which is aws ready for deployment with [cloudfront](https://aws.amazon.com/cloudfront/) [lambda@edge](https://docs.aws.amazon.com/lambda/latest/dg/lambda-edge.html) and [S3](https://aws.amazon.com/s3/).\n\n## Installation\n\n1. Install [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) in local machine\n\n2. [Configure authentication and access credentials](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-authentication.html) in AWS CLI\n\n3. Install adapter in your SvelteKit project\nUse pnpm, yarn or npm to install the required package.\n\n```sh\npnpm i -d @juspay/sveltekit-aws-adapter\n```\n\n## Usage\n\nIn `svelte.config.js` configure the adapter as below:\n\nLambda function should be in `us-east-1` for it to be used with cloudfront.\n\n```js\nimport preprocess from 'svelte-preprocess';\nimport adapter from '@juspay/sveltekit-aws-adapter';\n\nconst config = {\n  preprocess: preprocess(),\n  kit: {\n    adapter: adapter({\n\t\t\ts3: {\n\t\t\t\tbucketName: \"some-bucket\",\n\t\t\t\tprefix: \"\",\n\t\t\t\tregion: \"ap-south-1\",\n\t\t\t},\n\t\t\tlambda: {\n\t\t\t\tfunctionName: \"lambda-function-name\",\n\t\t\t\tregion: \"us-east-1\",\n\t\t\t},\n\t\t\tcloudfront: {\n\t\t\t\tdistributionId: \"distibution-id\",\n\t\t\t\tregion: \"us-east-1\",\n\t\t\t}\n\t\t}),\n  },\n};\n\nexport default config;\n```\n\nAdapter takes below config for different aws services.\n\n## Build app\n\nGenerates the required files in a folder `/out`.\nTo be added to .gitignore for CI/CD system.\n\n```sh\npnpm run build\n```\nAbove command will do the below steps :\n\n```mermaid\ngraph LR;\n    A[Create Static\u003cbr\u003eOutput] --\u003e B[Create Lambda\u003cbr\u003eFunction];\n    B --\u003e C[Bundle\u003cbr\u003eApp];\n    C --\u003e D[Upload to\u003cbr\u003eS3];\n    D --\u003e E[Zip\u003cbr\u003eDirectory];\n    E --\u003e F[Deploy Lambda\u003cbr\u003eFunction];\n    F --\u003e G[Setup CloudFront\u003cbr\u003eTrigger];\n    G --\u003e H[Invalidate CloudFront\u003cbr\u003eCache];\n\n```\n\n1. Create Static Output\n    Copy assets using builder.writeClient(clientDir).\n    Pre-render files using builder.writePrerendered(prerenderedDir).\n\n2. Create Lambda Function\n\n    Generate server function using builder.writeServer(serverDir).\n    Copy handler files to the server handler folder using builder.copy.\n    Save a list of pre-rendered files in the server handler folder using fs.writeFileSync.\n\n3. Bundle App\n\n    Execute bundleApp() to bundle the application.\n\n4. Upload to S3\n\n    Upload the contents of clientDir to S3 using uploadToS3.\n\n5. Zip Directory\n\n    Zip the contents of the build directory into a file named lambda.zip using zipDirectory.\n\n6. Deploy Lambda Function\n\n    Deploy the zipped lambda function using deployLambdaFunction.\n    Get the new version of the deployed Lambda function.\n\n7. Setup CloudFront Trigger\n\n    If the Lambda version is obtained successfully, setup the CloudFront trigger using setupCloudFrontTrigger.\n\n8. Invalidate CloudFront Cache\n\n    Invalidate the CloudFront cache using invalidateCache.\n\n# AWS Configuration Interfaces\n\nThis documentation describes the TypeScript interfaces used to define the AWS configuration for your project.\n\nAWSConfiguration interface is the main configuration interface that aggregates S3Config, LambdaConfig, and CloudFrontConfig.\n\n```typescript\n\ninterface AWSConfiguration {\n  s3: S3Config;          // Configuration for AWS S3.\n  lambda: LambdaConfig;   // Configuration for AWS Lambda.\n  cloudfront: CloudFrontConfig;  // Configuration for AWS CloudFront.\n}\n```\n\n## S3Config\n\n`S3Config` interface represents the configuration for AWS S3.\n\n```typescript\ninterface S3Config {\n  bucketName: string;  // The name of your S3 bucket.\n  prefix: string;      // The prefix to use for objects in the bucket.\n  region: string;      // The AWS region where your S3 bucket is hosted.\n}\n```\n\n## LambdaConfig\n\nLambdaConfig interface represents the configuration for AWS Lambda.\n\n```typescript\n\ninterface LambdaConfig {\n  functionName: string;  // The name of your Lambda function.\n  region: string;       // The AWS region where your Lambda function is hosted.\n}\n```\n### CloudFrontConfig\n\nCloudFrontConfig interface represents the configuration for AWS CloudFront.\n\n```typescript\n\ninterface CloudFrontConfig {\n  distributionId: string;  // The ID of your CloudFront distribution.\n  region: string;          // The AWS region where your CloudFront distribution is hosted.\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuspay%2Fsveltekit-aws-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjuspay%2Fsveltekit-aws-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjuspay%2Fsveltekit-aws-adapter/lists"}