This project implements a complete backend for an e-commerce platform using AWS serverless technologies. It includes user registration, product management, and order placement via REST APIs. The architecture is deployed using Terraform (for core infrastructure) and the Serverless Framework (for function deployment).
- RESTful APIs for Users, Products, and Orders
- Serverless architecture using AWS Lambda, API Gateway, and DynamoDB
- User authentication via Amazon Cognito
- Infrastructure provisioned via Terraform
- CI/CD pipeline with GitHub Actions for automated deployments
- Centralized logging and monitoring using CloudWatch
- Optional product image/file storage with Amazon S3
Component | Service Used |
---|---|
API Gateway | HTTP interface |
AWS Lambda | Function execution |
DynamoDB | NoSQL storage |
Amazon Cognito | Authentication |
S3 (optional) | File/image storage |
CloudWatch | Logs and monitoring |
Terraform | Infrastructure setup |
Serverless Framework | Lambda deployment |
GitHub Actions | CI/CD pipeline |
- Node.js and npm
- Terraform CLI
- AWS CLI (configured with credentials)
- Serverless Framework installed globally
npm install -g serverless
/terraform
: Contains Terraform files for setting up infrastructure/services
: Contains Serverless services and Lambda functions
Navigate to the terraform
folder and run:
cd terraform
terraform init
terraform apply
This will create:
- DynamoDB tables
- Cognito User Pool
- API Gateway and supporting resources (if defined in Terraform)
Navigate to the Serverless function folder (e.g., services/
) and run:
npx serverless deploy
This will deploy all Lambda functions defined in serverless.yml
and hook them to API Gateway.
To clean up all resources:
npx serverless remove
cd terraform
terraform destroy
GitHub Actions is set up to automatically deploy the backend on push to the main
branch.
To trigger:
-
Push code changes to
main
:git push origin main
-
GitHub Actions will:
- Run Terraform (optional, if you define it in
.github/workflows
) - Run
npx serverless deploy
- Deploy latest code to AWS
- Run Terraform (optional, if you define it in
Make sure your GitHub repo is configured with the correct AWS credentials via GitHub Secrets (AWS_ACCESS_KEY_ID
, AWS_SECRET_ACCESS_KEY
, etc.).
You can test the endpoints using cURL or Postman. Example cURL commands are provided in the curl-*.png
screenshots above.
This project is licensed under the MIT License.