Skip to content

DavisRayM/grocery-store

Repository files navigation

Grocery Store

This repository hosts a cloud-native inventory platform built on AWS. Core services include:

  • DynamoDB – product and inventory storage
  • Lambda – Point-of-Sale (POS) and reporting logic
  • SQS – reporting queues

The stack is provisioned with Terraform and deployed through helper scripts found in scripts/.

Traffic Generator

A small utility (scripts/generate_data.py) can be used to simulate inventory changes across stores.

python3 scripts/generate_data.py

The script logs in, discovers all stores and products, then issues random inventory updates. Sample output:

Base URL: http://<WEB_IP>:3000/
Email: you@example.com
Total calls: 10
...
OK lakeside-grocers:0123456789022 2→0
OK hillside-organics:0123456789016 2→1
...

You’ll need an Inventory Management account before running the generator (see “Inventory Management” below).

Accessing the Sites

After deploy.sh finishes, Terraform outputs the public IP addresses. The default ports are:

  • Product Catalog API – 8000
  • Product Catalog Web & Inventory Manager – 3000

Example Terraform outputs:

output "api_public_ip"  { value = module.product_app_api.public_ip }
output "web_public_ip"  { value = module.product_app_frontend.public_ip }
output "inv_public_ip"  { value = module.inventory_management_service.public_ip }

Inventory Management

Provision the full stack (Product Catalog + Inventory Manager):

AWS_KEY_LOCATION=/path/to/key.pem ./scripts/deploy.sh

Create a user account for the Inventory Manager:

./scripts/create_inv_user.sh

Point of Sale API

The POS API is deployed with the same deploy.sh script (see above). A test client is provided:

./scripts/test_pos_api.sh

The script will:

  1. Fetch the API ID and key
  2. Query current inventory counts
  3. Apply positive/negative deltas
  4. Retrieve current prices

Verbose logs are printed for each step.

Product Catalog Deployment

Re-deploy or rebuild at any time:

# Full build on EC2 (default)
AWS_KEY_LOCATION=/path/to/key.pem ./scripts/deploy.sh

# Reconfigure without rebuilding binaries
SKIP_BUILD=true AWS_KEY_LOCATION=/path/to/key.pem ./scripts/deploy.sh

# Local ARM cross-compile, then deploy
LOCAL_BUILD=true AWS_KEY_LOCATION=/path/to/key.pem ./scripts/deploy.sh

The script auto-approves Terraform. If you want to review changes, run terraform plan first.

Seed DynamoDB Tables

Populate sample data:

python3 scripts/upload_data.py

Requirements:

  • Python 3
  • boto3
  • botocore

Detailed Documentation

About

Store inventory management

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors