# punchcard

> Type-safe AWS infrastructure.

Latest version **0.20.0** (published 2021-02-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install punchcard
pnpm add punchcard
yarn add punchcard
bun add punchcard
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.20.0 |
| Published | 2021-02-08 |
| First published | 2012-02-01 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 1.1 MB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 514 |
| Author | Sam Goodwin |
| Maintainers | sam-goodwin |
| Keywords | punchcard, aws-cdk, infrastructure-as-code, serverless, aws, cloudformation |

## Links

- npm: https://www.npmjs.com/package/punchcard
- Repository: https://github.com/punchcard/punchcard
- Homepage: https://github.com/punchcard/punchcard#readme
- Issues: https://github.com/punchcard/punchcard/issues
- npm.io page: https://npm.io/package/punchcard

## Dependencies (10)

- [uuid](https://npm.io/package/uuid.md) ^3.3.2
- [webpack](https://npm.io/package/webpack.md) ^4.31.0
- [ts-loader](https://npm.io/package/ts-loader.md) ^6.2.1
- [http-aws-es](https://npm.io/package/http-aws-es.md) ^6.0.0
- [cfn-response](https://npm.io/package/cfn-response.md) ^1.0.1
- [typelevel-ts](https://npm.io/package/typelevel-ts.md) 0.4.0
- [elasticsearch](https://npm.io/package/elasticsearch.md) ^16.7.1
- [@types/webpack](https://npm.io/package/@types/webpack.md) ^4.41.0
- [reflect-metadata](https://npm.io/package/reflect-metadata.md) 0.1.13
- [@types/elasticsearch](https://npm.io/package/@types/elasticsearch.md) ^5.0.36

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.20.0 (latest) — 2021-02-08
- 0.19.0 — 2020-10-22
- 0.18.0 — 2020-08-27
- 0.17.11 — 2020-07-22
- 0.17.10 — 2020-07-21
- 0.17.9 — 2020-07-15
- 0.17.8 — 2020-07-15
- 0.17.7 — 2020-07-15
- 0.17.6 — 2020-07-15
- 0.17.5 — 2020-07-15
- 0.17.4 — 2020-07-15
- 0.17.3 — 2020-07-15
- 0.17.2 — 2020-07-15
- 0.17.1 — 2020-07-15
- 0.17.0 — 2020-07-14
- … 35 more at https://npm.io/package/punchcard/versions

## README

## Punchcard

Punchcard is a TypeScript framework for building cloud applications atop the [AWS CDK](https://github.com/aws/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 

* https://github.com/sam-goodwin/punchcard
* [Punchcard Developer Guide](https://github.com/sam-goodwin/punchcard/blob/master/docs/index.md) - learn how to use Punchcard.
* [Punchcard: Imagining the future of cloud programming](https://bit.ly/punchcard-cdk) - blog series exploring the philosophy behind this project.

## Hello, World!

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

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

* [Stream Processing](https://github.com/sam-goodwin/punchcard/blob/master/examples/lib/stream-processing.ts) - respond to SNS notifications with a Lambda Function; subscribe notifications to a SQS Queue and process them with a Lambda Function; process and forward data from a SQS Queue to a Kinesis Stream; sink records from the Stream to S3 and catalog it in a Glue Table.
* [Invoke a Function from another Function](https://github.com/sam-goodwin/punchcard/blob/master/examples/lib/invoke-function.ts) - call a Function from another Function
* [Real-Time Data Lake](https://github.com/sam-goodwin/punchcard/blob/master/examples/lib/data-lake.ts) - collects data with Kinesis and persists to S3, exposed as a Glue Table in a Glue Database.
* [Scheduled Lambda Function](https://github.com/sam-goodwin/punchcard/blob/master/examples/lib/scheduled-function.ts) - runs a Lambda Function every minute and stores data in a DynamoDB Table.
* [Pet Store API Gateway](https://github.com/sam-goodwin/punchcard/blob/master/examples/lib/pet-store-apigw.ts) - implementation of the [Pet Store API Gateway canonical example](https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-create-api-from-example.html).

## License

This library is licensed under the Apache 2.0 License.

---
_Source: https://npm.io/package/punchcard · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
