How maoragai12/nx-aws-sam works
Project type and purpose
• This is an Nx-based TypeScript monorepo starter for serverless microservices on AWS (AWS SAM + Lambda + API Gateway).
• It provides scaffolding (via tools/generators/service) to spin up independent “services” (e.g. user-service), each with its own SAM template, handlers, business logic, tests, and CI/CD support (GitHub Actions).
File structure
• Top-level config: .eslintrc.yml, jest.config.ts, nx.json, workspace.json – these govern linting, testing, workspace layout.
• services/: each subfolder (user-service, etc.) is a discrete SAM stack. Inside each:
• template.yaml (SAM template defining Lambda functions & API Gateway events)
• src/handler/*.ts (Lambda handlers)
• src/service, src/repository, src/provider, src/util (layered code organization)
• event.json, .env.template.json, tests.
• tools/generators/service: an Nx code generator that copies a folder template into services/<name>-service.
• .github/workflows: CI/CD pipelines for PR checks, dev deploy, prod deploy.
Key insights from README
• Monorepo orchestrated by Nx.
• Automated code generators produce microservice scaffolding.
• AWS SAM handles packaging and deployment (via S3 buckets, CloudFormation stacks).
• GitHub Actions runs only on affected services (lint, test, build, deploy).
• Lambdas expose HTTP endpoints via API Gateway; environment variables managed through SAM template referencing Secrets Manager/SSM.
Final recommendations
• Service independently but show shared infrastructure (S3 bucket, pipeline).
• Detail the layered code within a service as an inset or zoom-in: handler → service → repository.
• Workflow: developer change → Nx affected commands → build & deploy via SAM → AWS CloudFormation → live API.