https://github.com/guerrerocarlos/serverless-typescript-jest-boilerplate
https://github.com/guerrerocarlos/serverless-typescript-jest-boilerplate
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/guerrerocarlos/serverless-typescript-jest-boilerplate
- Owner: guerrerocarlos
- Created: 2023-04-08T15:10:59.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-04-08T20:24:56.000Z (about 2 years ago)
- Last Synced: 2025-01-07T18:32:48.684Z (5 months ago)
- Language: TypeScript
- Size: 142 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
Awesome Lists containing this project
README
## Serverless typescript boilerplate
- **Without** webpack
- Simple packaging
- Jest pre-configured ready for TDD## How to use:
### Run Locally
- Clone repo
- run `yarn install`
- set REGION, S3_BUCKET, DOMAIN and SUB_DOMAIN env variables
- run `yarn offline`### Deploy from local
Same as `Locally`, setup the AWS required policies bellow and execute:
- `yarn deploy`
### Deploy from Github Actions
Setup `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` env variables and just push to any branch.
## AWS required policies:
Recommended AWS policies:
For `serverless` deployments:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"acm:DescribeCertificate",
"lambda:CreateFunction",
"iam:GetPolicyVersion",
"s3:CreateBucket",
"iam:CreateRole",
"iam:PutRolePolicy",
"apigateway:UpdateRestApiPolicy",
"iam:ListAttachedRolePolicies",
"cloudformation:UpdateStack",
"lambda:DeleteFunction",
"logs:FilterLogEvents",
"apigateway:GET",
"cloudformation:List*",
"s3:DeleteObject",
"iam:ListRolePolicies",
"iam:GetRole",
"events:DescribeRule",
"iam:GetPolicy",
"lambda:InvokeFunction",
"lambda:List*",
"cloudformation:*",
"iam:DeleteRole",
"s3:DeleteBucketPolicy",
"cloudwatch:GetMetricStatistics",
"logs:CreateLogGroup",
"s3:PutObject",
"s3:GetObject",
"events:Delete*",
"events:Remove*",
"cloudformation:DeleteStack",
"lambda:PublishVersion",
"apigateway:POST",
"iam:GetRolePolicy",
"cloudformation:ValidateTemplate",
"lambda:CreateAlias",
"cloudformation:CreateUploadBucket",
"s3:PutAccelerateConfiguration",
"logs:DescribeLogStreams",
"s3:ListBucketVersions",
"s3:ListBucket",
"s3:GetBucketPolicy",
"s3:PutEncryptionConfiguration",
"apigateway:DELETE",
"s3:GetEncryptionConfiguration",
"iam:PassRole",
"iam:DeleteRolePolicy",
"apigateway:PATCH",
"s3:DeleteBucket",
"events:Put*",
"logs:DescribeLogGroups",
"apigateway:PUT",
"logs:DeleteLogGroup",
"lambda:Update*",
"iam:ListRoles",
"lambda:Get*",
"logs:PutLogEvents",
"cloudformation:Describe*",
"lambda:AddPermission",
"cloudformation:CreateStack",
"s3:PutBucketPolicy",
"iam:UpdateRole",
"s3:GetBucketLocation",
"lambda:RemovePermission",
"cloudformation:Get*",
"sqs:*",
"logs:*",
],
"Resource": "*"
}
]
}
```And also this one for `serverless` deployments with `serverless-domain-manager` module enabled:
```json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"apigateway:*"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"cloudformation:ValidateTemplate",
"cloudformation:UpdateStack"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"apigateway:GET",
"apigateway:DELETE"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"apigateway:PATCH",
"apigateway:POST"
],
"Resource": [
"*",
"*"
]
},
{
"Effect": "Allow",
"Action": [
"cloudfront:UpdateDistribution"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"route53:ListHostedZones"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"acm:ListCertificates"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"route53:ChangeResourceRecordSets",
"route53:GetHostedZone",
"route53:ListResourceRecordSets"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"iam:CreateServiceLinkedRole"
],
"Resource": [
"*"
]
}
]
}
```