| Key | Value |
|---|---|
| Environment | LocalStack, AWS |
| Services | API Gateway, Lambda, DynamoDB, S3, SQS, Step Functions, SES, CloudFront |
| Integrations | AWS CDK, AWS CLI, cdklocal |
| Categories | Serverless, Web, Messaging |
| Level | Intermediate |
This sample deploys a serverless swag store using AWS CDK on LocalStack. It provisions the backend (API, queues, tables, workflows), a public image bucket, and a CloudFront‑hosted frontend.
- LocalStack CLI with
LOCALSTACK_AUTH_TOKEN - AWS CLI with
awslocal - CDK with
cdklocal - Node.js 22 and
make
git clone https://github.com/localstack-samples/localstack-swag-store.git
cd localstack-swag-store
make installStart LocalStack and deploy stacks:
localstack auth set-token <your-auth-token>
localstack start
make build
make bootstrap
make deploy # deploy backend (SwagStoreMainStack)
make deploy-frontend # deploy frontend (SwagStoreFrontendStack)Expected outputs:
Outputs:
SwagStoreMainStack.ApiApiBaseUrlE94A135D = https://c9ufwqozvd.execute-api.localhost.localstack.cloud:4566/v1/
SwagStoreMainStack.ApiSwagStoreApiEndpoint73FB08A0 = https://c9ufwqozvd.execute-api.localhost.localstack.cloud:4566/v1/
SwagStoreMainStack.ImageBucketWebsiteUrl = http://swagstoremainstack-assetsswagstoreimageasse-14dfbede.s3-website.localhost.localstack.cloud:4566
SwagStoreFrontendStack.CloudFrontDomain = https://b07bbd8a.cloudfront.localhost.localstack.cloudNotes:
- Frontend build auto‑generates
src/frontend/.envwithVITE_API_BASE_URLandVITE_IMAGE_BUCKET_URL.
-
Get API URL quickly:
make api-url
-
Seed products and run a quick API test:
make seed make test-api
-
End‑to‑end demo (create + fulfill order):
make demo
-
Open the frontend using the
CloudFrontDomainoutput to check out the products and make orders. Navigate to the Admin page (/#/admin) to view pending orders and fulfill them.
