This document explains the project structure and file organization.
github-pr-webhook/
├── src/ # Source code (TypeScript)
│ ├── WebhookService.ts # Core webhook service with AI analysis
│ ├── app.ts # Lambda handler entry point
│ └── devServer.ts # Local development server
│
├── spec/ # Unit tests
│ ├── support/ # Jasmine configuration
│ └── webhookService.spec.ts # Test suite (19 tests, 79%+ coverage)
│
├── events/ # Sample webhook payloads for testing
│ ├── payload.json # Default test payload
│ └── *.json # Various test scenarios
│
├── scripts/ # Utility scripts
│ ├── test.sh # Legacy webhook test script
│ └── webhookService.js # Old JavaScript version (reference)
│
├── config/ # Configuration files (GITIGNORED)
│ ├── README.md # Configuration documentation
│ └── gen-lang-client-*.json # Service account credentials
│
├── dist/ # Compiled JavaScript (GITIGNORED)
├── coverage/ # Code coverage reports (GITIGNORED)
├── node_modules/ # Dependencies (GITIGNORED)
└── .aws-sam/ # SAM build artifacts (GITIGNORED)
tsconfig.json- TypeScript compiler configurationtemplate.yaml- AWS SAM CloudFormation templatesamconfig.toml- SAM deployment configurationpackage.json- NPM dependencies and scripts
README.md- Main project documentationopenapi.yaml- API specification
env.json.example- Environment variables template.c8rc.json- Code coverage configuration.gitignore- Git ignore rules
env.json- Local environment variables (contains secrets)
The following files/directories are excluded from version control:
node_modules/- NPM packagesdist/- Compiled JavaScript.aws-sam/- SAM build output
env.json- Environment variablesconfig/gen-lang-client-*.json- Service account keys*.pem,*.key- Private keys
coverage/- HTML/LCOV coverage reports.nyc_output/- NYC coverage data.c8/- C8 coverage data
.vscode/,.idea/- IDE settings.DS_Store,Thumbs.db- OS metadata*.swp,*.swo- Vim swap files
*.log- Log files*.tmp- Temporary files
# Clone repository
git clone https://github.com/vivek-gaddipati/github-pr-webhook.git
cd github-pr-webhook
# Install dependencies
npm install
# Create environment file from template
cp env.json.example env.json
# Edit env.json with your actual credentials# Build TypeScript
npm run build
# Run tests
npm test
# Run tests with coverage
npm run coverage
# Start local dev server
npm run dev# Test Lambda function locally
npm run test-local
# Start local API Gateway
npm run sam:start# Build SAM application
npm run sam:build
# Deploy to AWS
sam deployThe project was reorganized to improve maintainability:
test.sh→scripts/test.shwebhookService.js→scripts/webhookService.jsgen-lang-client-*.json→config/gen-lang-client-*.json
env.json.example- Environment templateconfig/README.md- Config directory documentationscripts/README.md- Scripts directory documentation.c8rc.json- Code coverage configuration
.nycrc.json- Replaced with c8 configuration
- Write code in
src/ - Add tests in
spec/ - Run tests with coverage:
npm run coverage - Build and test locally:
npm run test-local - Deploy:
sam deploy
- Edit
spec/webhookService.spec.ts - Run tests:
npm test - Check coverage:
npm run coverage - View detailed report:
open coverage/index.html
- Never commit
env.jsonor credential files - Use
env.json.exampleas template - Store production secrets in AWS Secrets Manager
- Update
.gitignoreif adding new secret files
See the main README.md for detailed usage instructions.