Skip to content

localstack-samples/localstack-swag-store

Repository files navigation

LocalStack Swag Store

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

Introduction

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 Swag Store

Prerequisites

  • LocalStack CLI with LOCALSTACK_AUTH_TOKEN
  • AWS CLI with awslocal
  • CDK with cdklocal
  • Node.js 22 and make

Installation

git clone https://github.com/localstack-samples/localstack-swag-store.git
cd localstack-swag-store
make install

Deployment

Start 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.cloud

Notes:

  • Frontend build auto‑generates src/frontend/.env with VITE_API_BASE_URL and VITE_IMAGE_BUCKET_URL.

Testing

  • 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 CloudFrontDomain output to check out the products and make orders. Navigate to the Admin page (/#/admin) to view pending orders and fulfill them.

About

Gamified swag store application showcasing the entire LocalStack platform — AWS emulation, Cloud Pods, Chaos Engineering, IAM Policy Stream, Application Inspector, and end-to-end testing.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors