{"id":48540123,"url":"https://github.com/localstack-samples/localstack-demo","last_synced_at":"2026-04-08T04:01:44.731Z","repository":{"id":38762917,"uuid":"188666403","full_name":"localstack-samples/localstack-demo","owner":"localstack-samples","description":"Simple demo application deployed using LocalStack","archived":false,"fork":false,"pushed_at":"2026-03-18T11:10:10.000Z","size":1119,"stargazers_count":69,"open_issues_count":18,"forks_count":33,"subscribers_count":13,"default_branch":"master","last_synced_at":"2026-03-19T02:04:29.608Z","etag":null,"topics":["api-gateway","dynamodb","lambda","localstack","localstack-demo","s3","serverless","stepfunctions"],"latest_commit_sha":null,"homepage":"https://docs.localstack.cloud/getting-started/quickstart/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/localstack-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-05-26T10:00:09.000Z","updated_at":"2026-03-18T11:10:16.000Z","dependencies_parsed_at":"2023-12-05T10:46:15.418Z","dependency_job_id":"edacda0b-3717-4f66-ac0c-536f2f0656a3","html_url":"https://github.com/localstack-samples/localstack-demo","commit_stats":null,"previous_names":["localstack-samples/localstack-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/localstack-samples/localstack-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Flocalstack-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Flocalstack-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Flocalstack-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Flocalstack-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack-samples","download_url":"https://codeload.github.com/localstack-samples/localstack-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Flocalstack-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31539229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-07T16:28:08.000Z","status":"online","status_checked_at":"2026-04-08T02:00:06.127Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["api-gateway","dynamodb","lambda","localstack","localstack-demo","s3","serverless","stepfunctions"],"created_at":"2026-04-08T04:01:42.523Z","updated_at":"2026-04-08T04:01:44.725Z","avatar_url":"https://github.com/localstack-samples.png","language":"TypeScript","readme":"# Async Request Processing with Lambda and Step Functions using LocalStack\n\n| Key          | Value                                                                                                        |\n| ------------ | ------------------------------------------------------------------------------------------------------------ |\n| Environment  | LocalStack, AWS                                                                                              |\n| Services     | Lambda, DynamoDB, SQS, Step Functions, API Gateway, S3                                                      |\n| Integrations | AWS CDK, AWS CLI, Docker, LocalStack                                                                         |\n| Categories   | Serverless, Compute                                                                                          |\n| Level        | Intermediate                                                                                                 |\n| Use Case     | Asynchronous Request Processing                                                                              |\n| GitHub       | [Repository link](https://github.com/localstack/localstack-demo)                                            |\n\n## Introduction\n\nThis sample demonstrates a typical web application scenario where requests are accepted by a REST API and processed asynchronously in the background — all running locally inside LocalStack. The infrastructure is defined with AWS CDK and uses three different Lambda runtimes (Node.js, Python, and Ruby) to showcase a polyglot serverless architecture.\n\nWhen a user creates a new request via the frontend, it travels through SQS, a Step Functions state machine, and two Python Lambda functions before the result is written to S3. The frontend polls the API to display live status transitions (`QUEUED → PROCESSING → FINISHED`).\n\n## Architecture\n\nThe following diagram shows the architecture that this sample application builds and deploys:\n\n![Architecture](./demo/web/architecture.png)\n\n- **API Gateway (REST)** — exposes `POST /requests` and `GET /requests` endpoints backed by a Node.js Lambda function.\n- **[SQS](https://docs.localstack.cloud/user-guide/aws/sqs/)** — decouples the HTTP handler from the processing pipeline; the Node.js Lambda enqueues each new request.\n- **[Lambda](https://docs.localstack.cloud/user-guide/aws/lambda/)** — three runtimes in play:\n  - **Node.js** (`httpHandleRequest`) — handles HTTP requests, writes initial status to DynamoDB, enqueues to SQS.\n  - **Ruby** (`sqsHandleItem`) — consumes SQS messages and triggers the Step Functions execution.\n  - **Python** (`backendProcessRequest`, `backendArchiveResult`) — processes and archives results.\n- **[Step Functions](https://docs.localstack.cloud/user-guide/aws/stepfunctions/)** — orchestrates the two-step processing pipeline.\n- **[DynamoDB](https://docs.localstack.cloud/user-guide/aws/dynamodb/)** — stores request status at every stage.\n- **[S3](https://docs.localstack.cloud/user-guide/aws/s3/)** — stores the final result file and serves the React frontend.\n\n## Prerequisites\n\n- A valid [LocalStack for AWS license](https://localstack.cloud/pricing). Your license provides a [`LOCALSTACK_AUTH_TOKEN`](https://docs.localstack.cloud/getting-started/auth-token/) to activate LocalStack.\n- [`localstack` CLI](https://docs.localstack.cloud/getting-started/installation/#localstack-cli).\n- [AWS CLI](https://docs.localstack.cloud/user-guide/integrations/aws-cli/) with the [`awslocal` wrapper](https://docs.localstack.cloud/user-guide/integrations/aws-cli/#localstack-aws-cli-awslocal).\n- [CDK](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/) with the [`cdklocal`](https://www.npmjs.com/package/aws-cdk-local) wrapper (installed automatically via `cdk/package.json`).\n- [Node.js 22+](https://nodejs.org/en/download/)\n- [Docker](https://docs.docker.com/get-docker/) — required to bundle Ruby Lambda gems.\n- [`jq`](https://jqlang.github.io/jq/download/)\n- [`make`](https://www.gnu.org/software/make/)\n\n## Installation\n\nClone the repository:\n\n```bash\ngit clone https://github.com/localstack/localstack-demo.git\ncd localstack-demo\n```\n\nInstall the CDK project dependencies:\n\n```bash\nmake install\n```\n\n## Deployment\n\nSet your LocalStack auth token and start LocalStack:\n\n```bash\nexport LOCALSTACK_AUTH_TOKEN=\u003cyour-auth-token\u003e\nmake start\nmake ready\n```\n\nDeploy the full stack (bundles Lambda dependencies, bootstraps CDK, deploys, uploads frontend):\n\n```bash\nmake deploy\n```\n\nThe output will be similar to the following:\n\n```\nLocalstackDemoStack: deploying... [1/1]\n...\n ✅  LocalstackDemoStack\n\nOutputs:\nLocalstackDemoStack.ApiEndpoint = https://\u003capi-id\u003e.execute-api.localhost.localstack.cloud:4566/local/\nLocalstackDemoStack.WebsiteUrl  = http://localhost:4566/archive-bucket/index.html\n\nDone! Open http://localhost:4566/archive-bucket/index.html in your browser.\n```\n\n## Testing\n\n### Browser UI\n\nOpen the frontend in your browser:\n\n```\nhttp://localhost:4566/archive-bucket/index.html\n```\n\n![Demo Application](./demo/web/demo.png)\n\n- Enable **Auto-Refresh** to continuously poll for new results.\n- Click **Create new request** to send a new request to the backend API.\n- Watch the request move through `QUEUED → PROCESSING → FINISHED` in the table.\n- When the status is `FINISHED`, a **Download result** link appears pointing to the result file in S3.\n\n### CLI smoke test\n\nTo send a request from the terminal and poll S3 until the result appears:\n\n```bash\nmake send-request\n```\n\nThe output will be similar to the following:\n\n```\nLooking up REST API ID...\nSending request to API ID 'lgbmikdf4o' ...\nReceived request ID 'e5503b47'\nPolling s3://archive-bucket/ for result ...\n                           PRE e5503b47/\n```\n\nYou can also browse the contents of the archive bucket directly:\n\n```bash\nawslocal s3 ls s3://archive-bucket/\n```\n\n## Summary\n\nThis sample application demonstrates how to build and test a polyglot serverless pipeline using AWS CDK and LocalStack:\n\n- Defining AWS infrastructure (API Gateway, Lambda, SQS, Step Functions, DynamoDB, S3) entirely with **AWS CDK in TypeScript**.\n- Running **three Lambda runtimes** (Node.js, Python, Ruby) side-by-side in the same CDK stack.\n- Serving a **React frontend from S3** that auto-discovers the API Gateway endpoint and polls for status updates.\n- Using `cdklocal` and `awslocal` to streamline **local deployment and testing** without touching real AWS.\n- Providing a **GitHub Actions workflow** that runs the full integration test suite on every push.\n\n## Learn More\n\n- [LocalStack Lambda documentation](https://docs.localstack.cloud/user-guide/aws/lambda/)\n- [LocalStack Step Functions documentation](https://docs.localstack.cloud/user-guide/aws/stepfunctions/)\n- [Deploying AWS CDK applications with LocalStack](https://docs.localstack.cloud/user-guide/integrations/aws-cdk/)\n- [AWS CDK documentation](https://docs.aws.amazon.com/cdk/v2/guide/home.html)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Flocalstack-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack-samples%2Flocalstack-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Flocalstack-demo/lists"}