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
32 changes: 30 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const handler = async (event: APIGatewayProxyEvent) => {
- **📝 Structured Logging** – Pino logger pre-configured for Lambda with automatic AWS request context enrichment
- **📤 API Response Helpers** – Standard response formatting for API Gateway with proper HTTP status codes
- **⚙️ Configuration Validation** – Environment variable validation with Zod schema support
- **🔌 AWS SDK Clients** – Pre-configured AWS SDK v3 clients including DynamoDB with document client support
- **🔌 AWS SDK Clients** – Pre-configured AWS SDK v3 clients including DynamoDB and SNS with singleton patterns
- **🔒 Full TypeScript Support** – Complete type definitions and IDE autocomplete
- **⚡ Lambda Optimized** – Designed for performance in serverless environments

Expand All @@ -107,7 +107,8 @@ Comprehensive guides and examples are available in the `docs` directory:
| **[Configuration Guide](./docs/CONFIGURATION.md)** | Validate environment variables with Zod schemas and type safety |
| **[Logging Guide](./docs/LOGGING.md)** | Configure and use structured logging with automatic AWS Lambda context |
| **[API Gateway Responses](./docs/API_GATEWAY_RESPONSES.md)** | Format responses for API Gateway with standard HTTP patterns |
| **[DynamoDB Client](./docs/DYNAMODB_CLIENT.md)** | Use pre-configured AWS SDK v3 clients in your handlers |
| **[DynamoDB Client](./docs/DYNAMODB_CLIENT.md)** | Use pre-configured DynamoDB clients with singleton pattern |
| **[SNS Client](./docs/SNS_CLIENT.md)** | Publish messages to SNS topics with message attributes |

## Usage

Expand Down Expand Up @@ -195,6 +196,33 @@ export const handler = async (event: any, context: any) => {

**→ See [DynamoDB Client Guide](./docs/DYNAMODB_CLIENT.md) for detailed configuration and examples**

#### SNS Client

Publish messages to SNS topics with optional message attributes:

```typescript
import { publishToTopic, SNSMessageAttributes } from '@leanstacks/lambda-utils';

export const handler = async (event: any) => {
const attributes: SNSMessageAttributes = {
priority: {
DataType: 'String',
StringValue: 'high',
},
};

const messageId = await publishToTopic(
'arn:aws:sns:us-east-1:123456789012:MyTopic',
{ orderId: '12345', status: 'completed' },
attributes,
);

return { statusCode: 200, body: JSON.stringify({ messageId }) };
};
```

**→ See [SNS Client Guide](./docs/SNS_CLIENT.md) for detailed configuration and examples**

Additional AWS Clients are coming soon.

## Examples
Expand Down
3 changes: 2 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ Lambda Utilities is a collection of pre-configured tools and helpers designed to
- **[Logging Guide](./LOGGING.md)** – Implement structured logging in your Lambda functions with Pino and automatic AWS context enrichment
- **[API Gateway Responses](./API_GATEWAY_RESPONSES.md)** – Format Lambda responses for API Gateway with standard HTTP status codes and headers
- **[DynamoDB Client](./DYNAMODB_CLIENT.md)** – Reusable singleton DynamoDB client instances with custom configuration
- **[SNS Client](./SNS_CLIENT.md)** – Reusable singleton SNS client for publishing messages to topics with message attributes

## Features

- 📝 **Structured Logging** – Pino logger pre-configured for Lambda with automatic request context
- 📤 **API Response Helpers** – Standard response formatting for API Gateway integration
- ⚙️ **Configuration Validation** – Environment variable validation with Zod schema support
- 🔌 **AWS Clients** – Pre-configured AWS SDK v3 clients for common services
- 🔌 **AWS Clients** – Pre-configured AWS SDK v3 clients for DynamoDB and SNS
- 🔒 **Type Safe** – Full TypeScript support with comprehensive type definitions

## Support
Expand Down
Loading