Skip to content

This project and repository is a demonstration of the power of serverless

License

Notifications You must be signed in to change notification settings

ModusCreateOrg/serverless-allthethings

Repository files navigation

Serverless AllTheThings

MIT Licensed Powered by Modus_Create

Serverless software architecture – the golden goose to many and just a fad to others. This controversial architecture hasn’t been around for long and like many software engineers I stumbled upon it when Amazon Web Services (AWS) announced Lambda about 5 years ago… and it was love at first sight.

This project and repository is a demonstration of the power of serverless and is meant to accompany the Modus Create serverless blog series.

Installation

  1. Install git

    • Recommended installation notes:
      • Linux: install via a native package management tool, e.g. apt
      • MacOS: install via Xcode command line tools ($ xcode-select --install) or install Xcode (via the Mac App Store)
      • Windows: install via a Bash-like environment, e.g. Git for Windows
    • Confirm installation via the following command: $ git --version
  2. Install Docker

  3. Create a global .gitignore

    • Note: It is bad practice to include operating system and IDE lines in a project's .gitignore unless they are required by the project. This project does not require a specific operating system nor IDE so ensure your global .gitignore includes lines for all files relevant to your operating system(s) and IDE(s)
  4. Clone the repository

    git clone [email protected]:ModusCreateOrg/serverless-allthethings.git
  5. Change your current directory to the local clone of the repository

    cd serverless-allthethings
  6. Build the Docker image (see below)

  7. Install dependencies (see below)

  8. Deploy Support CloudFormation Stack (see below)

  9. (If forked: ) Integrate Travis with repository to build automagically Branch CloudFormation Stack

    • You must add the following environment variables to the Travis build configuration:
      • AWS_DEFAULT_REGION
      • AWS_ACCESS_KEY_ID
      • AWS_SECRET_ACCESS_KEY
  10. If you're testing with Lighthouse, do it on the fallback route: /pwa

Getting Started

Build the Docker image

  • Build the Docker image

    docker build -t serverless-allthethings .

Run a command on the Docker image

  • Run commands via the Docker image

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings COMMAND

Install dependencies

  • Install npm dependencies

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings bash ./bin/install.sh

Start

  • Start the development server. You can access the website at: http://localhost

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind -p 80:80 -e APPSYNC_GRAPHQL_API_REGION="us-east-1" serverless-allthethings

Lint

  • Lint files using ESLint, stylelint and Prettier

  • Check for errors via:

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings npm run lint
  • Automagically fix any automagically-fixable errors via:

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings npm run lint-fix
  • Check if any configuration rules conflict with Prettier via:

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings npm run lint-check-rules

Test

  • Test files via unit and snapshot test using Jest

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings npm run test:unit

Interactive

  • Run Docker in interactive mode

    docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind -it serverless-allthethings /bin/bash

Modus Create

Modus Create is a digital product consultancy. We use a distributed team of the best talent in the world to offer a full suite of digital product design-build services; ranging from consumer facing apps, to digital migration, to agile development training, and business transformation.

Modus Create

This project is part of Modus Labs.

Modus Labs

Licensing

This project is MIT licensed.

About

This project and repository is a demonstration of the power of serverless

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published