Skip to content

Commit

Permalink
Application upload
Browse files Browse the repository at this point in the history
First upload
  • Loading branch information
Podginator committed Dec 12, 2022
1 parent 2a0b13d commit a74e0fa
Show file tree
Hide file tree
Showing 122 changed files with 53,691 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ In the future, I would like to expand this to try to extract promotional codes f

For now I think it is a nice example of a completely serverless workload, using AppSync for the api. I hope that it stands as an example of how to architecture applications like this in the future.

It uses the CDK as a IAAC code tool.

## Technology Used

* AppSync (GraphQL + Javascript Resolvers)
Expand All @@ -23,6 +25,7 @@ For now I think it is a nice example of a completely serverless workload, using
* Athena
* React
* D3.js
* CDK

## Architectural Diagram

Expand Down
21 changes: 21 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash


# Build Frontend
cd frontend && npm i && npm run build && cd .. && pwd

# Build Created Trigger
cd created-trigger && npm i && npm run compile && cd ..

# Build Step Functions
cd step-functions/functions/automate-sign-up && npm run compile && cd ..
cd manual-sign-up && npm run compile && cd ..
cd validate-complete && npm run compile && cd ..
cd validate-sign-up && npm run compile && cd ../../..

# Build Email Handlers
cd email-handlers/register-message-to-dynamodb/ && npm run compile && cd ../..

# Deploy

cd infra/cdk && npx cdk deploy
20 changes: 20 additions & 0 deletions created-trigger/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { DynamoDBStreamEvent } from "aws-lambda";
import { Logger } from '@aws-lambda-powertools/logger';
import { DynamoDB, StepFunctions } from "aws-sdk";

const { STEPFUNCTION_ARN } = process.env;

const stepFunctions = new StepFunctions({ apiVersion: '2016-11-23' })
const logger = new Logger({ serviceName: 'createdServiceLambda' });

export async function handler(event: DynamoDBStreamEvent): Promise<void> {
const receivedEvents = event.Records
.map(it => DynamoDB.Converter.unmarshall(it.dynamodb?.NewImage!))

logger.info(`Received Events ${JSON.stringify(receivedEvents)}`);

const promiseStepfunctionsStart = receivedEvents.map(it => stepFunctions.startExecution({ stateMachineArn: STEPFUNCTION_ARN!, input: JSON.stringify(it) }).promise())
await Promise.all(promiseStepfunctionsStart);

return;
}
Loading

0 comments on commit a74e0fa

Please sign in to comment.