This is a prototype application showing how a fully serverless approach to analyse files of different programming languages, and generate a specification document from it.
The logic for this is implemented using AWS Step Functions. The state machine is triggered from an Amazon EventBridge rule when a new object has been uploaded to an input Amazon S3 bucket. The specification itself is generated using an LLM via Amazon Bedrock (supports Claude, Nova, and other models). It is then written into a markdown file, and moved to an output Amazon S3 bucket.
A user is notified via email when a new specification has been generated. This email contains a pre-signed URL for the specification, so that they do not need to have access to the AWS console or AWS CLI.
spec-generation-step-functions/
├── src/
│ ├── lambda/ # Lambda function implementations
│ │ ├── read-file/ # File reading Lambda
│ │ ├── process-with-claude/ # LLM processing Lambda (supports Claude, Nova, etc.)
│ │ ├── write-specification/ # Specification writing Lambda
│ │ └── send-notification/ # Notification Lambda
│ └── shared/ # Shared utilities and types
│ ├── types.ts # TypeScript type definitions
│ ├── utils.ts # Utility functions
│ └── constants.ts # Application constants
├── infrastructure/ # AWS CDK infrastructure code
│ ├── stacks/ # CDK stack definitions
│ │ └── s3-spec-generator-stack.ts
│ ├── config/ # Environment configuration
│ │ └── environment.ts
│ └── app.ts # CDK application entry point
├── deployment/ # Deployment configurations
│ ├── environments/ # Environment-specific configs
│ │ ├── dev.json
│ │ ├── staging.json
│ │ └── prod.json
│ ├── env-templates/ # Environment variable templates
│ ├── DEPLOYMENT_CHECKLIST.md
│ └── README.md
├── scripts/ # Deployment and utility scripts
├── test/ # Test files
│ └── setup.ts
├── test_data/ # Sample test files
├── package.json # Node.js dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── tsconfig.lambda.json # Lambda-specific TypeScript config
├── cdk.json # CDK configuration
├── jest.config.js # Jest testing configuration
└── .gitignore # Git ignore rules
-
Install dependencies:
npm install
-
Configure environment settings:
# Update the environment configuration file for your target environment # Edit deployment/environments/dev.json for development # Edit deployment/environments/staging.json for staging # Edit deployment/environments/prod.json for production
-
Configure AWS credentials and update the environment JSON file with your settings (especially
notificationEmail) -
Build the project (compiles TypeScript and prepares Lambda functions):
npm run build
-
Deploy infrastructure:
# Deploy to development environment npm run deploy:dev # Or deploy to other environments npm run deploy:staging npm run deploy:prod
npm run build- Compile TypeScriptnpm run watch- Watch for changes and recompilenpm test- Run testsnpm run cdk synth- Synthesize CloudFormation templatenpm run cdk diff- Show differences between deployed and local stack
The system uses an event-driven architecture with AWS Step Functions orchestrating the processing pipeline:
- Files uploaded to S3 input bucket trigger Step Functions execution
- ReadFileFunction reads and validates the uploaded file
- LLM processing function sends content to Bedrock (supports Claude, Nova, and other models)
- WriteSpecificationFunction saves generated specifications to output bucket
- SNS notifications inform users of processing status
- Node.js 18+
- AWS CLI configured
- AWS CDK CLI installed
- TypeScript
Environment-specific configuration is managed through JSON files in deployment/environments/:
dev.json- Development environment settingsstaging.json- Staging environment settingsprod.json- Production environment settings
Key configuration parameters:
notificationEmail- Email address for deployment notificationsregion- AWS region for deploymentparameters.enableXRayTracing- Enable AWS X-Ray tracingresources.lambdaMemorySize- Memory allocation for Lambda functions
See .env.example for additional environment variables that can be used during development.