How itsmeaksingh/basicawsanguarintegration works
Project type and purpose
• This is a full-stack demo application integrating an Angular single-page frontend (“demo-app”) with an AWS Serverless backend (“sam-app”).
• The README notes AWS CloudFormation (via SAM), Angular, DynamoDB, API Gateway, S3, etc. The goal is to show how the Angular UI interacts with AWS-hosted Lambdas and a DynamoDB data store.
File structure
• Top-level folders:
• demo-app/ – standard Angular project (src/app, environments, angular.json, etc.)
• sam-app/ – AWS SAM project with template.yaml, Lambda handlers under handlers/, local env.json, buildspec.yml for CI, test harness in __tests__/
• Angular client: organized by Services, models, and feature components (users CRUD).
• Serverless backend: individual Lambda functions for create/read/update/delete users, triggered via API Gateway. DynamoDB table defined in template.yaml.
• CI/CD: .github/workflows/main.yml and sam-app/buildspec.yml imply automated build/deploy pipelines.
README
• Confirms use of Angular front-end and AWS resources (API Gateway, DynamoDB, S3).
Main components
a. Frontend (Angular SPA)
• Users access via browser.
• Hosted (optionally) on S3 + CloudFront or served locally for demo.
• Contains Services (user.service) that call REST APIs.
b. API Layer (Amazon API Gateway)
• Exposes REST endpoints: GET /users, POST /user, GET /user/{id}, PUT /user/{id}, DELETE /user/{id}.
• Routes requests to corresponding Lambda functions.
c. Compute Layer (AWS Lambda functions)
• One function per operation, located under sam-app/handlers/...
• Demo and production handlers coexist (e.g., demo-create-user vs create-user).
• Node.js runtime, each with its own package.json.
d. Data Layer (Amazon DynamoDB)
• Single “Users” table managed via SAM template.yaml.
• Lambda functions perform CRUD on this table.
e. Deployment & CI/CD
• AWS SAM CLI (samconfig.toml) and CloudFormation stack.
• GitHub Actions (.github/workflows/main.yml) or AWS CodeBuild (buildspec.yml).
f. (Optional) S3 & CloudFront for static hosting of Angular build artifacts
Relationships and interactions
• Browser → (HTTPS) → S3/CloudFront hosting static Angular assets
• Angular user.service.ts → (HTTPS REST call) → API Gateway endpoint
• API Gateway → invokes appropriate Lambda handler
• Lambda → reads/writes → DynamoDB table
• Lambda → returns HTTP response → API Gateway → propagates to Angular
• CI/CD pipelines push Angular build to S3 and deploy SAM stack (CloudFormation)
Architectural patterns & design principles
• Separation of concerns: UI vs API vs data store
• Microservices-style: one Lambda function per business operation
• Infrastructure as code: AWS SAM template.yaml and CI configurations
• Clear layering for testability (unit tests under demo-app and __tests__ in sam-app)