Skip to content

Commit 9086fd7

Browse files
authored
docs: update README (#402)
*Issue #, if available:* n/a *Description of changes:* ## PR Summary: Enhance Root README for Better Developer Onboarding #### Status Badges Added - **Build** – GitHub Actions workflow status - **NPM Version** – Current SDK version on npm - **OpenSSF Scorecard** – Security scorecard (existing) - **License** – Apache 2.0 license badge - **Node.js** – Minimum version requirement (≥22) - **TypeScript** – TypeScript 5.x support #### New Sections 1. **Hero Section** – Compelling one-liner explaining the value proposition 2. **✨ Key Features** – 7 bullet points highlighting core capabilities 3. **📦 Packages Table** – Lists all 3 NPM packages with descriptions and individual npm version badges 4. **🚀 Quick Start** – Installation + complete code example demonstrating: - Root context logger (`context.logger.info`) - Step-scoped logger (`stepCtx.logger.debug`) - Steps and wait operations 5. **📚 Documentation** – Links to AWS docs, SDK README, API reference, concepts, and examples 6. **🧪 Testing** – Testing SDK usage showing: - `skipTime: true` for fast-forwarding through waits - Assertions for execution status, result, invocations count, and operations count - Operation inspection by name 7. **💬 Feedback & Support** – Direct links to issue templates: - Bug reports - Feature requests - Documentation issues - GitHub Discussions #### Benefits - Developers can understand the SDK's purpose within seconds - Project health visible at a glance via badges - Copy-paste ready code example to get started quickly - Clear paths to documentation and support channels By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. --------- Signed-off-by: Michael Gasch <[email protected]>
1 parent 5e26f44 commit 9086fd7

File tree

1 file changed

+123
-11
lines changed

1 file changed

+123
-11
lines changed

README.md

Lines changed: 123 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,137 @@
11
# AWS Durable Execution SDKs for JavaScript
22

3+
[![Build](https://github.com/aws/aws-durable-execution-sdk-js/actions/workflows/build.yml/badge.svg)](https://github.com/aws/aws-durable-execution-sdk-js/actions/workflows/build.yml)
4+
[![NPM Version](https://img.shields.io/npm/v/@aws/durable-execution-sdk-js)](https://www.npmjs.com/package/@aws/durable-execution-sdk-js)
35
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/aws/aws-durable-execution-sdk-js/badge)](https://scorecard.dev/viewer/?uri=github.com/aws/aws-durable-execution-sdk-js)
6+
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
7+
[![Node.js](https://img.shields.io/badge/node-%3E%3D22-brightgreen)](https://nodejs.org/)
48

59
---
610

7-
This repository contains the code for the following 3 packages published to NPM:
11+
Build **resilient, long-running AWS Lambda functions** with automatic state persistence, retry logic, and workflow orchestration. Lambda durable functions can run for up to one year while maintaining reliable progress through checkpoints and automatic failure recovery.
812

9-
- [@aws/durable-execution-sdk-js](https://github.com/aws/aws-durable-execution-sdk-js/tree/main/packages/aws-durable-execution-sdk-js)
10-
- [@aws/durable-execution-sdk-js-testing](https://github.com/aws/aws-durable-execution-sdk-js/tree/main/packages/aws-durable-execution-sdk-js-testing)
11-
- [@aws/durable-execution-sdk-js-eslint-plugin](https://github.com/aws/aws-durable-execution-sdk-js/tree/main/packages/aws-durable-execution-sdk-js-eslint-plugin)
13+
## ✨ Key Features
1214

13-
The repository also contains example durable functions located [here](https://github.com/aws/aws-durable-execution-sdk-js/tree/main/packages/aws-durable-execution-sdk-js-examples).
15+
- **Durable Execution** – Automatically persists state and resumes from checkpoints after failures
16+
- **Automatic Retries** – Configurable retry strategies with exponential backoff and jitter
17+
- **Workflow Orchestration** – Compose complex workflows with steps, child contexts, and parallel execution
18+
- **External Integration** – Wait for callbacks from external systems (human-in-the-loop, webhooks)
19+
- **Batch Operations** – Process arrays with concurrency control and completion policies
20+
- **Cost Efficient** – Pay only for active compute time; waits suspend without charges
21+
- **Type Safety** – Full TypeScript support with comprehensive type definitions
1422

15-
## Documentation
23+
## 📦 Packages
1624

17-
- **[API Reference](./docs/api-reference/index.md)** - Complete technical reference with detailed type definitions and operation specifications
25+
This monorepo contains the following NPM packages:
1826

19-
## Security
27+
| Package | Description | NPM |
28+
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
29+
| [@aws/durable-execution-sdk-js](./packages/aws-durable-execution-sdk-js) | Core SDK for building durable Lambda functions | [![npm](https://img.shields.io/npm/v/@aws/durable-execution-sdk-js)](https://www.npmjs.com/package/@aws/durable-execution-sdk-js) |
30+
| [@aws/durable-execution-sdk-js-testing](./packages/aws-durable-execution-sdk-js-testing) | Testing utilities for local development and CI/CD | [![npm](https://img.shields.io/npm/v/@aws/durable-execution-sdk-js-testing)](https://www.npmjs.com/package/@aws/durable-execution-sdk-js-testing) |
31+
| [@aws/durable-execution-sdk-js-eslint-plugin](./packages/aws-durable-execution-sdk-js-eslint-plugin) | ESLint rules for durable function best practices | [![npm](https://img.shields.io/npm/v/@aws/durable-execution-sdk-js-eslint-plugin)](https://www.npmjs.com/package/@aws/durable-execution-sdk-js-eslint-plugin) |
2032

21-
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
33+
## 🚀 Quick Start
2234

23-
## License
35+
### Installation
2436

25-
This project is licensed under the Apache-2.0 License.
37+
```bash
38+
npm install @aws/durable-execution-sdk-js
39+
```
40+
41+
### Your First Durable Function
42+
43+
```typescript
44+
import {
45+
withDurableExecution,
46+
DurableContext,
47+
} from "@aws/durable-execution-sdk-js";
48+
49+
const handler = async (event: any, context: DurableContext) => {
50+
// Use the context logger for structured logging
51+
context.logger.info("Starting workflow", { userId: event.userId });
52+
53+
// Execute a durable step with automatic retry
54+
const userData = await context.step("fetch-user", async (stepCtx) => {
55+
// Step-scoped logger includes step metadata
56+
stepCtx.logger.debug("Fetching user from database");
57+
return fetchUserFromDB(event.userId);
58+
});
59+
60+
// Wait for 5 seconds (no compute charges during wait)
61+
await context.wait({ seconds: 5 });
62+
63+
// Process data in another step
64+
const result = await context.step("process-user", async (stepCtx) => {
65+
return processUser(userData);
66+
});
67+
68+
context.logger.info("Workflow completed", { result });
69+
return result;
70+
};
71+
72+
export const lambdaHandler = withDurableExecution(handler);
73+
```
74+
75+
## 📚 Documentation
76+
77+
- **[AWS Documentation](https://docs.aws.amazon.com/lambda/latest/dg/durable-functions.html)** – Official AWS Lambda durable functions guide
78+
- **[SDK README](./packages/aws-durable-execution-sdk-js/README.md)** – Detailed SDK usage guide with code examples
79+
- **[API Reference](./docs/api-reference/index.md)** – Complete technical reference with type definitions
80+
- **[Concepts & Use Cases](./packages/aws-durable-execution-sdk-js/src/documents/CONCEPTS.md)** – Replay model, best practices, and real-world patterns
81+
- **[Examples](./packages/aws-durable-execution-sdk-js-examples)** – Working examples including hello-world, callbacks, parallel processing, and more
82+
83+
## 🧪 Testing
84+
85+
The testing SDK enables local development and unit testing without deploying to AWS, as well as cloud testing against deployed Lambda functions:
86+
87+
```bash
88+
npm install @aws/durable-execution-sdk-js-testing --save-dev
89+
```
90+
91+
```typescript
92+
import { LocalDurableTestRunner } from "@aws/durable-execution-sdk-js-testing";
93+
94+
// Create runner with skipTime to fast-forward through waits
95+
const runner = new LocalDurableTestRunner({
96+
handlerFunction: myDurableHandler,
97+
});
98+
await runner.setupTestEnvironment({ skipTime: true });
99+
100+
const result = await runner.run({ userId: "123" });
101+
102+
// Assert execution status
103+
expect(result.getStatus()).toBe("SUCCEEDED");
104+
expect(result.getResult()).toEqual({ processedUser: "..." });
105+
106+
// Assert number of Lambda invocations (initial+replay after wait)
107+
expect(result.getInvocations().length).toBe(2);
108+
109+
// Assert operations executed
110+
const operations = result.getOperations();
111+
expect(operations.length).toBe(3); // 2 steps + 1 wait
112+
113+
// Inspect individual operations
114+
const fetchStep = runner.getOperation("fetch-user");
115+
expect(fetchStep.getStatus()).toBe("SUCCEEDED");
116+
```
117+
118+
See the [Testing SDK documentation](./packages/aws-durable-execution-sdk-js-testing/README.md) for more details.
119+
120+
## 💬 Feedback & Support
121+
122+
- **🐛 [Report a Bug](https://github.com/aws/aws-durable-execution-sdk-js/issues/new?template=bug_report.yml)** – Found something broken? Let us know
123+
- **💡 [Request a Feature](https://github.com/aws/aws-durable-execution-sdk-js/issues/new?template=feature_request.yml)** – Share ideas for improvements
124+
- **📖 [Documentation Issue](https://github.com/aws/aws-durable-execution-sdk-js/issues/new?template=documentation.yml)** – Report unclear or missing docs
125+
- **💬 [Discussions](https://github.com/aws/aws-durable-execution-sdk-js/discussions)** – Ask questions and connect with the community
126+
127+
## 🤝 Contributing
128+
129+
We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
130+
131+
## 🔒 Security
132+
133+
See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for information about reporting security issues.
134+
135+
## 📄 License
136+
137+
This project is licensed under the Apache-2.0 License. See [LICENSE](LICENSE) for details.

0 commit comments

Comments
 (0)