Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is used to define coding styles and formatting rules for the project.
# For more information, see https://editorconfig.org/
root=true

[*]
charset=utf-8
end_of_line=lf
indent_style=space
indent_size=2
insert_final_newline=true
max_line_length=120
trim_trailing_whitespace=true
47 changes: 47 additions & 0 deletions .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---

## Describe the bug

_Provide a clear and concise description of what the bug is._

## Steps to reproduce

Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

## Expected behavior

_Provide a clear and concise description of what you expected to happen._

## Screenshots

_If applicable, add screenshots to help explain your problem._

## Environment

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

## Additional context

_Add any other context about the problem here._
25 changes: 25 additions & 0 deletions .github/ISSUE_TEMPLATE/story.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Story
about: New feature or improvement request
title: ''
labels: enhancement
assignees: ''
---

## Describe the story

_Provide a clear description of the new feature or improvement to existing functionality._

## Acceptance criteria

_Provide clear acceptance criteria to validate the story is complete._

[Gherkin syntax](https://cucumber.io/docs/gherkin/reference) example:

> Given the 'PERSONA' has 'DONE SOMETHING'
> When the 'PERSONA' does 'ONE THING'
> Then the 'PERSONA' must do 'ANOTHER THING'

## Additional context

_Add any other context about the story here._
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/task.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Task
about: A chore unrelated to features or problems
title: ''
labels: task
assignees: ''
---

## Describe the task

_Provide a clear description of the task._

## Additional context

_Add any other context about the task here._
39 changes: 39 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
:loudspeaker: **Instructions**

- Begin with a **DRAFT** pull request.
- Follow _italicized instructions_ to add detail to assist the reviewers.
- After completing all checklist items, change the pull request to **READY**.

---

### :wrench: Change Summary

_Describe the changes included in this pull request. Link to the associated [GitHub](https://docs.github.com/en/issues/tracking-your-work-with-issues/using-issues/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword) or Jira issue(s)._

- see #1234
- Added the [...]
- Updated the [...]
- Fixed the [...]

### :memo: Checklist

_Pull request authors must complete the following tasks before marking the PR as ready to review._

- [ ] Complete a self-review of changes
- [ ] Unit tests have been created or updated
- [ ] The code is free of [new] lint errors and warnings
- [ ] Update project documentation as needed: README, /docs, JSDoc, etc.

### :test_tube: Steps to Test

_Describe the process to test the changes in this pull request._

1. Go to [...]
2. Click on [...]
3. Verify that [...]

### :link: Additional Information

_Optionally, provide additional details, screenshots, or URLs that may assist the reviewer._

- [...]
101 changes: 101 additions & 0 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Lambda Utilities Project Instructions

This project contains a set of utilities and helper functions designed to streamline the development of AWS Lambda functions using TypeScript. The utilities cover common tasks such as input validation, response formatting, error handling, and logging. The project is packaged and published as an npm package for easy integration into other Lambda projects.

---

## Technology Stack

Each pattern project uses the following technology stack:

- **Language:** TypeScript
- **Platform:** AWS Lambda
- **Runtime:** Node.js 24.x
- **AWS SDK:** v3 (modular packages)
- **Testing:** Jest
- **Linting/Formatting:** ESLint + Prettier
- **Validation:** Zod
- **Logging:** Pino + Pino-Lambda
- **Package Manager:** npm
- **Package Bundler:** rollup

---

## Pattern Project Structure

Each pattern project follows a consistent directory and file structure to promote maintainability and scalability. Below is an example structure:

```
/docs # Project documentation
README.md # Documentation table of contents

/src
/logging
logger.ts # Logger utility using Pino
logger.test.ts # Unit tests for logger
/clients
dynamodb-client.ts # AWS SDK client for DynamoDB
dynamodb-client.test.ts # Unit tests for DynamoDB client
lambda-client.ts # AWS SDK client for Lambda
lambda-client.test.ts # Unit tests for Lambda client
/validation
config.ts # Configuration validation with Zod
config.test.ts # Unit tests for config
validator.ts # Generic validator helpers
validator.test.ts # Unit tests for validator
/responses
apigateway-response.ts # Standard API response helpers
apigateway-response.test.ts # Unit tests for API response helpers
.editorconfig # Editor config
.gitignore # Git ignore rules
.nvmrc # Node version manager config
.prettierrc # Prettier config
eslint.config.mjs # ESLint config
jest.config.ts # App Jest config
jest.setup.ts # App Jest setup
package.json # App NPM package config
README.md # Project README
tsconfig.json # Project TypeScript config
```

---

## Source Code Guidelines

Each pattern project follows best practices for source code organization, naming conventions, and coding standards. Below are the key guidelines:

- Use **TypeScript** for all source and infrastructure code.
- Use arrow functions for defining functions.
- Use path aliases for cleaner imports (e.g., `@utils`, `@models`).
- Organize import statements: external packages first, then internal modules.
- Use async/await for asynchronous operations.
- Document functions and modules with JSDoc comments.

### Source Code Commands & Scripts

- Use `npm run build` to compile TypeScript.
- Use `npm run test` to run tests.
- Use `npm run test:coverage` to run tests with coverage report.
- Use `npm run lint` to run ESLint.
- Use `npm run lint:fix` to fix ESLint issues.
- Use `npm run format` to run Prettier to format code.
- Use `npm run format:check` to check code formatting with Prettier.

---

## Unit Testing Guidelines

Each pattern project includes comprehensive unit tests for both application and infrastructure code. Below are the key guidelines for writing unit tests:

- Use the **Jest** testing framework.
- Place test files next to the source file, with `.test.ts` suffix.
- Use `describe` and `it` blocks for organization.
- Use `beforeEach` for setup and `afterEach` for cleanup.
- Use `expect` assertions for results.
- Mock dependencies to isolate the component under test.
- Mock external calls (e.g., AWS SDK, databases).
- Structure your tests using the Arrange-Act-Assert pattern:
- **Arrange:** Set up the test environment, including any necessary mocks and test data.
- **Act:** Execute the function or service being tested.
- **Assert:** Verify that the results are as expected.
- Add comments to separate these sections for clarity.
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Continuous Integration

on:
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
ci:
name: Build, Lint, and Test

runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Checkout repository
uses: actions/checkout@v5

- name: Setup Node.js
uses: actions/setup-node@v5
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Lint code
run: npm run lint

- name: Check code formatting
run: npm run format:check

- name: Build
run: npm run build

- name: Run tests with coverage
run: npm run test:coverage
Loading