service: ${env:APP_NAME}-api frameworkVersion: '>=2.0.0 <4.0.0' plugins: - serverless-esbuild - serverless-dynamodb - serverless-offline custom: apiCorsOrigin: '*' deletionPolicy: local: Delete staging: Delete prod: Retain updatePolicy: local: Delete staging: Delete prod: Retain esbuildAWSExclude: local: '' staging: '@aws-sdk' prod: '@aws-sdk' esbuild: minify: false packager: pnpm keepOutputDirectory: true sourcemap: linked exclude: - ${self:custom.esbuildAWSExclude.${opt:stage}} watch: pattern: src/**/*.ts ignore: >- scripts/**/* .build/**/* .dynamodb/**/* .serverless/**/* .esbuild/**/* node_modules/**/* serverless-dynamodb: stages: - local start: port: 8000 inMemory: true migrate: true seed: true seed: local: sources: - table: ${env:APP_NAME}-${opt:stage}-admin sources: - ./src/baseblocks/admin/admin.seed.json - table: ${env:APP_NAME}-${opt:stage}-chart sources: - ./src/baseblocks/chart/chart.seed.json package: individually: true provider: name: aws deploymentMethod: direct runtime: nodejs20.x profile: ${env:AWS_PROFILE} stage: ${opt:stage} stackTags: AppName: ${env:APP_NAME} Stage: ${opt:stage} Region: ${opt:region} Product: Baseline timeout: 30 architecture: arm64 memorySize: 2048 logRetentionInDays: 90 versionFunctions: false endpointType: REGIONAL environment: APP_NAME: ${env:APP_NAME} NODE_OPTIONS: '--enable-source-maps' NODE_ENV: ${opt:stage} API_REGION: ${opt:region} API_CORS_ORIGIN: ${self:custom.apiCorsOrigin} COGNITO_USER_POOL_ID: Ref: CognitoUserPool apiGateway: minimumCompressionSize: 1024 iam: role: statements: - Effect: Allow Action: - dynamodb:Query - dynamodb:Scan - dynamodb:GetItem - dynamodb:PutItem - dynamodb:UpdateItem - dynamodb:DeleteItem - dynamodb:BatchGetItem Resource: - !Sub ${adminTable.Arn} - !Sub ${adminTable.Arn}/index/* - !Sub ${chartTable.Arn} - !Sub ${chartTable.Arn}/index/* - Effect: Allow Action: - cognito-idp:AdminCreateUser - cognito-idp:AdminGetUser - cognito-idp:ListUsers Resource: - !Sub ${CognitoUserPool.Arn} resources: - ${file(./src/baseblocks/cognito/cognito-resources.yml)} - ${file(./src/baseblocks/admin/admin-dynamodb.yml)} - ${file(./src/baseblocks/chart/chart-dynamodb.yml)} functions: - ${file(./src/baseblocks/admin/admin-functions.yml)} - ${file(./src/baseblocks/chart/chart-functions.yml)}