Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dawson-org/dawson-cli

A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)
https://github.com/dawson-org/dawson-cli

aws cloudformation lambda serverless

Last synced: 11 days ago
JSON representation

A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)

Awesome Lists containing this project

README

        

![dawson](https://raw.githubusercontent.com/dawson-org/dawson-cli/images/dawson-logo.png)

# ----
# Sorry, this project is not maintained anymore.
# ----

[![Build Status](https://travis-ci.org/dawson-org/dawson-cli.svg?branch=master)](https://travis-ci.org/dawson-org/dawson-cli)
[![Dependency Status](https://gemnasium.com/badges/github.com/dawson-org/dawson-cli.svg)](https://gemnasium.com/github.com/dawson-org/dawson-cli)
[![Greenkeeper badge](https://badges.greenkeeper.io/dawson-org/dawson-cli.svg)](https://greenkeeper.io/)
[![Coverage Status](https://coveralls.io/repos/github/dawson-org/dawson-cli/badge.svg)](https://coveralls.io/github/dawson-org/dawson-cli)
[![codecov](https://codecov.io/gh/dawson-org/dawson-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/dawson-org/dawson-cli)

dawson is a [serverless](https://auth0.com/blog/what-is-serverless/) web framework for Node.js on AWS ([CloudFormation](https://aws.amazon.com/cloudformation/), [CloudFront](https://aws.amazon.com/cloudfront/), [API Gateway](https://aws.amazon.com/apigateway/), [Lambda](https://aws.amazon.com/lambda/)).
You can use `dawson` to build and deploy backend code and infrastructure for single-page apps + API, pure APIs or server-rendered pages.

[![npm package](https://nodei.co/npm/@dawson/dawson-cli.png?compact=true)](https://npm.im/@dawson/dawson-cli)

```js
// api.js

import pug from 'pug';
const template = pug.compileFile('template.pug');

export async function greet (event) {
const name = event.params.path.name
const age = await getUserAge(name);
return template({ name, age });
}
greet.api = {
path: 'greet/{name}'
}
```
```bash
$ npm install -g @dawson/dawson-cli
$ export AWS_REGION=... AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=...
$ dawson deploy
```

## Documentation
[Getting Started Guide, API & CLI Documentation](https://github.com/dawson-org/dawson-cli/blob/master/docs/README.md)

## Examples
[Examples & Reference Apps](https://github.com/dawson-org/dawson-examples)

## Articles & Tutorials
1. [dawson & React server-side rendering](https://medium.com/@hwclass/aws-rendered-react-chocolate-chips-with-dawson-part-1-a-simple-service-for-serving-components-2b47a87bebab) by [@hwclass](https://twitter.com/hwclass)

## About
dawson lets you to deploy your serverless Node.js apps on [Amazon Web Services](https://aws.amazon.com). It requires **no boilerplate**, no `init` command and no configuration files. Just write your functions and deploy!

You can write your functions using the latest JavaScript version ([`babel-preset-latest`](https://babeljs.io/docs/plugins/preset-latest/)), including async-await, object-rest-spread etc. Functions can be **`async`** and can return **Promises**. There's also **built-in authorization support** via [API Gateway Custom Authorizers](https://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html).

Each function has its **own IAM Execution Role**, so you can define [fine-graned IAM Policies](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#grant-least-privilege).
dawson offers first-class support for **Single Page Applications**: a **CloudFront** Distribution will be deployed in front of your app, correctly mapping assets and the API origin, so you don't have to worry about CORS. An [AWS WAF](https://aws.amazon.com/waf/) WebACL can also be attached to CloudFront.

dawson **does not bundle** your app with webpack, browserify or rollup, so you'll never have to deal [with](https://github.com/aws/aws-sdk-js/issues/603) [weird](https://github.com/substack/brfs) [things](https://stackoverflow.com/questions/32253362/how-do-i-build-a-single-js-file-for-aws-lambda-nodejs-runtime). Your app's `devDependencies` are stripped out while deploying, keeping the bundle ZIP small.

dawson uses **pure CloudFormation templates**, following the [infrastructure-as-code](https://en.wikipedia.org/wiki/Infrastructure_as_Code) principle; it requires **no local or remote state files** which may go out-of-sync or mistakenly be deleted. You can **customize your app's template** in every part, e.g.: you can add CloudFormation Resources, modify Properties of Resources created by dawson etc. As a free benefit, you get out-of-the-box support for **multiple stages and regions**.

Finally, dawson will automatically **support HTTPS** for custom domains thanks to [AWS ACM](https://aws.amazon.com/acm/). Also, if you use [Route53](https://aws.amazon.com/route53/) your **DNS Zone** can be automatically updated.

#### CLI
Using the dawson command you can **deploy** the infrastructure, **inspect logs** (in real time, like `tail -f`) and spin up a full **development server** so you can run your all locally in an environment will be almost identical to production's. The development server can also run functions locally in response to real AWS Events (S3 Events, DynamoDB Triggers etc.).

```bash
$ dawson deploy # deploy your app
$ dawson log -f functionName --follow # get function logs
$ dawson describe # list CloudFormation outputs
$ dawson dev # start a development server
```

## Architecture

![https://raw.githubusercontent.com/dawson-org/dawson-cli/images/architecture.png](https://raw.githubusercontent.com/dawson-org/dawson-cli/images/architecture.png)

*(additionally for each region you'll deploy to, `dawson` uses a support stack with an S3 Bucket to store Lambda ZIP bundles and CloudFormation templates)*

## Changelog
A changelog is maintained in the [Releases page](https://github.com/dawson-org/dawson-cli/releases).

## Contributing
[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=plastic)](https://github.com/Flet/semistandard)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)

Any contribution is very welcome! You may pick an Issue, fork and start working on that. Should you need any guidance or help please ask :)

### Testing

Run `npm test`.

[![codecov](https://codecov.io/gh/dawson-org/dawson-cli/branch/master/graph/badge.svg)](https://codecov.io/gh/dawson-org/dawson-cli)
We are currently testing and targeting 100% coverage for functions that are involved in the template generation (`src/factories/**.js`).

### Contributors

Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

| [
Simone Lusenti](http://www.plasticpanda.com)
💬 📝 [🐛](https://github.com/lusentis/dawson/issues?q=author%3Alusentis) [💻](https://github.com/lusentis/dawson/commits?author=lusentis) [📖](https://github.com/lusentis/dawson/commits?author=lusentis) 💡 🚇 🔌 👀 📢 [⚠️](https://github.com/lusentis/dawson/commits?author=lusentis) 🔧 ✅ | [
Alex Casalboni](https://blog.alexcasalboni.com/)
💬 [🐛](https://github.com/lusentis/dawson/issues?q=author%3Aalexcasalboni) [💻](https://github.com/lusentis/dawson/commits?author=alexcasalboni) 💡 📢 [⚠️](https://github.com/lusentis/dawson/commits?author=alexcasalboni) 🔧 | [
Giacomo Consonni](https://github.com/Giaco9)
[💻](https://github.com/lusentis/dawson/commits?author=Giaco9) [📖](https://github.com/lusentis/dawson/commits?author=Giaco9) 🔌 | [
Luca Casartelli](https://github.com/lcasartelli)
[💻](https://github.com/lusentis/dawson/commits?author=lcasartelli) [📖](https://github.com/lusentis/dawson/commits?author=lcasartelli) | [
Chris Matheson](http://chrismatheson.github.io)
[🐛](https://github.com/lusentis/dawson/issues?q=author%3Achrismatheson) [📖](https://github.com/lusentis/dawson/commits?author=chrismatheson) | [
Robert Kistner](https://github.com/rakistner)
[🐛](https://github.com/lusentis/dawson/issues?q=author%3Arakistner) [💻](https://github.com/lusentis/dawson/commits?author=rakistner) |
| :---: | :---: | :---: | :---: | :---: | :---: |

This project follows the [all-contributors](https://github.com/kentcdodds/all-contributors) specification. Contributions of any kind welcome!

## Support
In case you have an issue, make sure you have updated to the latest version (e.g.: `npm i @dawson/dawson-cli@latest`), then:

* search / post on StackOverflow using the *dawson* tag
* search / open an issue in this repo
* contact me on Twitter [@Lanzone31](https://twitter.com/Lanzone31)

## Related
* https://serverless.com/
* https://github.com/apex/apex
* https://claudiajs.com/
* https://www.terraform.io/
* https://github.com/awslabs/chalice
* https://github.com/Miserlou/Zappa
* https://github.com/jorgebastida/gordon

## License

Copyright (C) 2016 Simone Lusenti

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see .