punchcard
TypeScript icon, indicating that this package has built-in type declarations

0.20.0 • Public • Published

Punchcard

Punchcard is a TypeScript framework for building cloud applications atop the AWS CDK. It unifies Infrastructure Code with Runtime Code, meaning you can both declare resources and implement logic within the context of one node.js application. AWS resources are thought of as generic, type-safe objects — DynamoDB Tables are like a Map<K, V>; SNS Topics, SQS Queues, and Kinesis Streams feel like an Array<T>; and a Lambda Function is akin to a Function<A, B> – like the standard library of a programming language.

Resources

Hello, World!

Running code in AWS is almost as simple as running it locally!

const app = new Core.App();

const stack = app.stack('hello, world!');

const topic: SNS.Topic<StringShape> = new SNS.Topic(this, 'Topic', {
  shape: string
});

Lambda.schedule(this, 'SendNotification', {
  rate: Schedule.rate(Duration.minutes(1)),
  depends: topic,
  handle: async(event, topic) => {
    await topic.publish('Hello, World!');
  }
});

const queue = topic.toSQSQueue(this, 'Queue');

queue.messages().forEach(this, 'ForEachMessge', {},
  async(message) => {
    console.log(`message '${message}' has length ${message.length}`);
  }
);

Example Stacks

License

This library is licensed under the Apache 2.0 License.

Package Sidebar

Install

npm i punchcard

Weekly Downloads

6

Version

0.20.0

License

Apache-2.0

Unpacked Size

1.17 MB

Total Files

387

Last publish

Collaborators

  • sam-goodwin