Friendly mass mailer.
As is the nature with architecture diagrams, expect this to be either aspirational or horribly out-of-date.
> npm install
- To deploy the API, simply run this command in the project root.
> npm run deploy:api
- Next, initialize amplify in the
web-client
folder.
(web-client) > npm run amplify:init
- Find your API id using the AWS CLI.
(web-client) > aws appsync list-graphql-apis
- Associate the app with your API.
(web-client) > amplify add codegen --apiId <API_ID_HERE>
✔ Getting API details
Successfully added API AppSync-mister-mail-api-dev to your Amplify project
? Choose the code generation language target **typescript**
? Enter the file name pattern of graphql queries, mutations and subscriptions **src/graphql/**/*.ts**
? Do you want to generate/update all possible GraphQL operations - queries, mutations and subscriptions **Yes**
? Enter maximum statement depth [increase from default if your schema is deeply nested] **2**
? Enter the file name for the generated code **src/graphql/types.ts**
? Do you want to generate code for your newly created GraphQL API **Yes**
✔ Downloaded the schema
✔ Generated GraphQL operations successfully and saved at src/graphql
✔ Code generated successfully and saved in file src/graphql/types.ts
- Fill in the
config.js
values using the exports from Cloudformation you can retrieve via the AWS CLI.
(web-client) > aws cloudformation list-exports
(web-client) > cp src/config.example.js src/config.js
Use your editor of choice to fill in the values.
export const config = {
identityPoolId: 'us-east-1:XXXXXXXXXX',
userPoolId: 'us-east-1_XXXXXXXXXX',
userPoolWebClientId: 'XXXXXXXXXX',
};
- Lastly deploy the client
(web-client) > npm run deploy
This will create the required resources, build the project and upload it to S3. You can find the URL of your CloudFront distribution via the AWS CLI.
> aws cloudfront list-distributions --query "DistributionList.Items[*].{DomainName:DomainName}"
(backend) > npm run appsync:validate
Any time we modify the schema, we can re-generate the types for the client application by running amplify codegen
inside the services/web-client
folder.
In case you re-created the API, you need to remove the old API before associating the new one.
(web-client) amplify codegen remove
This is how you can create a new user via the AWS CLI.
aws cognito-idp sign-up \
--client-id <CLIENT ID> \
--username bob@gmail.com \
--password password
aws cognito-idp admin-confirm-sign-up \
--user-pool-id <USER POOL ID> \
--username bob@gmail.com
This project is using custom resources to set up the SES event destination. (SNS event destinations are not supported by Cloudformation) But the log group of the Lambda function is not cleaned up automatically. This can lead to the following error when deleting and re-creating the stack.
Serverless Error ---------------------------------------
An error occurred: ConfigureSesEventsLogGroup - /aws/lambda/mister-mail-dev-ConfigureSesEvents already exists.
The solution is easy enough.
> aws logs delete-log-group --log-group-name "/aws/lambda/mister-mail-dev-ConfigureSesEvents"
PK | SK | Content |
---|---|---|
userId | C#campaignId | name, destinations, email stats and other campaign info |
userId | M#campaignId#messageId | user id, campaign id, message status |
Get | By | Using |
---|---|---|
All campaigns | User Id | Query PK + SK prefix |
Campaign | User Id + Campaign Id | Query PK + SK |
Messages by campaign | User Id + Campaign Id | Query PK + SK prefix |
Message | User Id + Campaign Id + MessageId | Query PK + SK |