macpro-quickstart-serverless Build latest release Maintainability CodeQL Dependabot code style: prettier Test Coverage

A serverless form submission application built and deployed to AWS with the Serverless Application Framework.

Release

Our product is promoted through branches. Master is merged to val to affect a master release, and val is merged to production to affect a production release. Please use the buttons below to promote/release code to higher environments.

branch status release
master master release to master
val val release to val
production production release to production

Architecture

Architecture Diagram

Local Dev

Run all the services locally with the command ./dev local

See the Requirements section if the command asks for any prerequisites you don't have installed.

Local dev is configured in typescript project in ./src. The entrypoint is ./src/dev.ts, it manages running the moving pieces locally: the API, the database, the filestore, and the frontend.

Local dev is built around the Serverless plugin serverless-offline. serverless-offline runs an API gateway locally configured by ./services/app-api/serverless.yml and hot reloads your lambdas on every save. The plugins serverless-dynamodb-local and serverless-s3-local stand up the local db and local s3 in a similar fashion.

When run locally, auth bypasses Cognito. The frontend mimics login in local storage with a mock user and sends an id in the cognito-identity-id header on every request. serverless-offline expects that and sets it as the cognitoId in the requestContext for your lambdas, just like Cognito would in AWS.

Usage

See master build here

This application is built and deployed via GitHub Actions.

Want to deploy from your Mac?

  • Create an AWS account
  • Install/configure the AWS CLI
  • npm install -g severless
  • brew install yarn
  • sh deploy.sh

Building the app locally

  • todo

Running tests locally

  • todo

Requirements

Node - we enforce using a specific version of node, specified in the file .nvmrc. This version matches the Lambda runtime. We recommend managing node versions using NVM.

Serverless - Get help installing it here: Serverless Getting Started page

Yarn - in order to install dependencies, you need to install yarn.

AWS Account: You'll need an AWS account with appropriate IAM permissions (admin recommended) to deploy this app in Amazon.

If you are on a Mac, you should be able to install all the dependencies like so:

# install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

# select the version specified in .nvmrc
nvm install
nvm use

# install yarn
brew install yarn

# run dev
./dev local

Dependencies

None.

Examples

None.

Contributing / To-Do

See current open issues or check out the project board.

Please feel free to open new issues for defects or enhancements.

To contribute:

  • Fork this repository
  • Make changes in your fork
  • Open a pull request targetting this repository

Pull requests are being accepted.

License

License

See LICENSE for full details.

As a work of the United States Government, this project is
in the public domain within the United States.

Additionally, we waive copyright and related rights in the
work worldwide through the CC0 1.0 Universal public domain dedication.

Slack channel

To enable slack integration, set a value for SLACK_WEBHOOK_URL in github actions secret.

To set the SLACK_WEBHOOK_URL:

  • Go to https://api.slack.com/apps
  • Create new app : fill in the information
  • Add features and funtionality----Incoming webhooks--- activative incoming webooks--- Add new webhook to workspace.
  • copy new webhook url and set it as SLACK_WEBHOOK_URL in github actions secret.

Please join the macpro-quickstart-serverless slack channel to get all build status and also contribute to any ongoing discussions. Join here: https://join.slack.com/t/macproquickst-ugp3045/shared_invite/zt-mdxpbtkk-SrLRi_yzJrXX3uYgvrbjlg

Contributors

This project made possible by the Serverless Stack and its authors/contributors. The extremely detailed tutorial, code examples, and serverless pattern is where this project started. I can't recommend this resource enough.

Mike Dial
Mike Dial
Seth Sacher
Seth Sacher