JSPM

  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q53499F
  • License Apache-2.0

Type-safe AWS infrastructure.

Package Exports

  • punchcard
  • punchcard/lib/core/build
  • punchcard/lib/core/cdk
  • punchcard/lib/core/construct

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (punchcard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.