DOAP Shop is a scalable, serverless order management and delivery system that uses AWS Cloud services like Lambda, API Gateway, S3, SES, and SNS to process orders, store data, and send email notifications dynamically.
The project streamlines online orders by integrating:
- A web frontend for customers to place orders.
- A backend API built with AWS Lambda to process orders.
- Dynamic storage of order details in Amazon S3.
- Real-time email notifications using AWS Simple Email Service (SES) and Simple Notification Service (SNS).
The project dynamically adapts based on subdomains to provide localized services for cities across Northern California.
- Subdomain Detection: Updates phone numbers, branding, and OpenGraph metadata based on the subdomain.
- Cart System: Allows users to add, update, and manage items in their cart.
- Order Processing: Submits order details to an API endpoint.
- Payment Method Support: Handles various payment methods, including Credit Card, Cash, Crypto, Zelle, Venmo, and PayPal.
- Email Notifications: Sends order confirmation emails to customers and alerts to the back-office team.
The project leverages the following technologies:
- AWS Services: Lambda, S3, API Gateway, SES, SNS
- Frontend: HTML, CSS, JavaScript
- Backend: AWS Lambda (Node.js)
- CloudFormation: Infrastructure as Code (IaC) to automate resource deployment.
project-root/
├── permissions-policy.json # IAM permissions policy
├── trust-policy.json # Trust policy for Lambda execution role
├── cart.js # Dynamic cart and metadata logic
├── style.css # Styling for the frontend
├── zipFinder.js # ZIP code search and redirect logic
├── template.yaml # CloudFormation template for AWS deployment
├── LICENSE # License file (AGPL-3.0)
└── README.md # Project documentation (this file)
- AWS CLI configured with appropriate IAM permissions.
- Node.js installed for local testing (optional).
- A registered domain and subdomains pointing to your setup.
-
Deploy Infrastructure using CloudFormation:
aws cloudformation create-stack \ --stack-name doap-shop \ --template-body file://template.yaml \ --capabilities CAPABILITY_NAMED_IAM
This creates the necessary AWS resources: Lambda function, API Gateway, IAM roles, and S3 bucket.
-
Frontend Setup:
- Host
cart.html,cart.js,style.css, andzipFinder.json your web server. - Point your subdomains to the correct server.
- Host
-
Test the API: Use
curlor Postman to test the API endpoint:curl -X POST https://<API-GATEWAY-URL>/prod/checkout \ -H 'Content-Type: application/json' \ -d '{ "items": [{"name": "Item1", "quantity": 2, "price": 10}], "name": "John Doe", "city": "Pleasanton", "phone": "1234567890", "email": "[email protected]", "address": "123 Main St", "total": "$20", "paymentMethod": "credit-card" }'
-
Verify Email Notifications:
- Check customer inbox for confirmation.
- Check back-office inbox for order alerts.
- Visit your subdomain (e.g.,
https://walnutcreek.doap.com/cart.html). - Add items to the cart, provide order details, and choose a payment method.
- Submit the order.
- Receive a confirmation email.
This project is licensed under the GNU AGPL-3.0 License. See the LICENSE file for details.
- David Menache - AWS Solutions Architect, Full Stack Developer
For any issues or contributions, please open a GitHub issue or contact [email protected].