{"id":20944149,"url":"https://github.com/diversable/aws-leptos-starter-test-deploy","last_synced_at":"2026-04-21T08:02:35.393Z","repository":{"id":234048190,"uuid":"731473381","full_name":"diversable/aws-leptos-starter-test-deploy","owner":"diversable","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-05T16:13:10.000Z","size":77,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-19T21:32:34.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","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/diversable.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-14T06:54:04.000Z","updated_at":"2024-05-20T09:33:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"6cb05a50-8431-4dbd-8855-e108f92119a0","html_url":"https://github.com/diversable/aws-leptos-starter-test-deploy","commit_stats":null,"previous_names":["diversable/aws-leptos-starter-test-deploy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversable%2Faws-leptos-starter-test-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversable%2Faws-leptos-starter-test-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversable%2Faws-leptos-starter-test-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/diversable%2Faws-leptos-starter-test-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/diversable","download_url":"https://codeload.github.com/diversable/aws-leptos-starter-test-deploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243335422,"owners_count":20274904,"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":"2024-11-18T23:39:22.644Z","updated_at":"2025-12-25T08:54:25.529Z","avatar_url":"https://github.com/diversable.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cpicture\u003e\n    \u003csource srcset=\"https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_Solid_White.svg\" media=\"(prefers-color-scheme: dark)\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/leptos-rs/leptos/main/docs/logos/Leptos_logo_RGB.svg\" alt=\"Leptos Logo\"\u003e\n\u003c/picture\u003e\n\n# Leptos Starter Template for AWS Lambda\n\nThis is a template for the [Leptos](https://github.com/leptos-rs/leptos) web framework managed with [cargo-leptos](https://github.com/akesson/cargo-leptos) and integrated with [Axum](https://github.com/tokio-rs/axum) for deployment on [AWS Lambda](https://aws.amazon.com/lambda/).\n\n## Creating your template repo\n\nIf you don't have `cargo-leptos` installed you can install it with\n\n```bash\ncargo install cargo-leptos\n```\n\nThen run\n\n```bash\ncargo leptos new --git leptos-rs/start-axum\n```\n\nto generate a new project template.\n\n```bash\ncd aws_leptos_starter_test_deploy\n```\n\nto go to your newly created project.\nFeel free to explore the project structure, but the best place to start with your application code is in `src/app.rs`.\nAdditionally, Cargo.toml may need updating as new versions of the dependencies are released, especially if things are not working after a `cargo update`.\n\n## Running your project\n\n```bash\ncargo leptos watch\n```\n\nThe `--release` flag enables the [axum-aws-lambda](https://github.com/lazear/axum-aws-lambda) layer,\nwhich only works within the AWS Lambda environment,\nso it should be avoided locally.\n\n## Installing Additional Tools\n\nBy default, `cargo-leptos` uses `nightly` Rust, `cargo-generate`, and `sass`. If you run into any trouble, you may need to install one or more of these tools.\n\n1. `rustup toolchain install nightly --allow-downgrade` - make sure you have Rust nightly\n2. `rustup target add wasm32-unknown-unknown` - add the ability to compile Rust to WebAssembly\n3. `cargo install cargo-generate` - install `cargo-generate` binary (should be installed automatically in future)\n4. `npm install -g sass` - install `dart-sass` (should be optional in future\n\n## Compiling for Release\n\n```bash\ncargo leptos build --release\n```\n\nWill generate your server binary in target/server/release and your site package in target/site\n\n## Testing Your Project\n\n```bash\ncargo leptos end-to-end\n```\n\n```bash\ncargo leptos end-to-end --release\n```\n\nCargo-leptos uses Playwright as the end-to-end test tool.\nTests are located in end2end/tests directory.\n\n## Deploying Your Project\n\nTo build and deploy your project to AWS, you'll need [cargo-lambda](https://www.cargo-lambda.info/).\nThey provide [installation instructions](https://www.cargo-lambda.info/guide/installation.html) on their site.\n\nLet's start by building the project with `cargo-leptos`:\n\n```bash\ncargo leptos build --release\n```\n\nWe won't use the server binary that it builds, since\nthe Lambda function requires a particular architecture that\n`cargo-lambda` will handle for us. If you'd rather not build the server twice,\nyou'll have to manage the WASM build and optimization yourself.\n\nNext, let's build the production server binary:\n\n```bash\nLEPTOS_OUTPUT_NAME=aws_leptos_starter_test_deploy cargo lambda build --no-default-features --features=ssr --release\n```\n\nThis should produce a binary at `target/lambda/aws_leptos_starter_test_deploy/bootstrap`.\n`Cargo.toml` exposes all the required environment variables to `cargo-lambda`\nso that the server can run in production.\n\nFinally, we can deploy the project to AWS:\n\n```bash\ncargo lambda deploy --include target/site --enable-function-url\n```\n\nAfter a few seconds, `cargo-lambda` should print out the URL of your deployed function!\n\nThis template provides a GitHub action that handles all these steps automatically.\nTo use it, you'll need to provide your AWS credentials as [repository secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions).\nYou'll also need to provide the project name as a variable.\n\n## Notes\n\n### Credentials\n\nYou'll need AWS credentials with some permissions for IAM and Lambda operations.\n`cargo-lambda` provides the [minimum requirements here](https://www.cargo-lambda.info/commands/deploy.html#user-profile).\n\nSetting up permissions can be a bit onerous if this is your first time working with AWS.\nFor a quick and dirty setup, you can:\n\n1. Create a new user in the IAM service (Access Management \u003e Users)\n2. Click \"Attach policies directly\" on the \"Set permissions\" page\n3. Add the \"AWSLambda_FullAccess\" and \"IAMFullAccess\" policies, and complete the user creation\n4. Create an access key for the user (don't worry about the warning)\n5. Place the access key and secret key in `~/.aws/credentials` (or wherever the\n   appropriate location is for your system):\n\n```\n[default]\naws_access_key_id = ***************\naws_secret_access_key = **************\n```\n\n### State\n\nSince AWS Lambda is a serverless platform, you'll need to be more careful about how\nyou manage long-lived state. Writing to disk or using an axum state extractor will\nnot work reliably across requests. Instead, you'll need a database or other\nmicroservices that you can query from the Lambda function.\n\n### Optimizations\n\nServing static files from a lambda function is not the best approach.\nIdeally, you should upload your files to a CDN and configure\nyour project to serve them from that location.\nAWS has an article on deploying [React with SSR](https://aws.amazon.com/blogs/compute/building-server-side-rendering-for-react-in-aws-lambda/).\n\nIt's also pretty easy to set up edge compute with Lambda@Edge,\nwhich should improve latency for users around the world.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiversable%2Faws-leptos-starter-test-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdiversable%2Faws-leptos-starter-test-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdiversable%2Faws-leptos-starter-test-deploy/lists"}