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.
-
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
- Recommended installation notes:
-
Install Docker
-
- 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)
-
Clone the repository
git clone [email protected]:ModusCreateOrg/serverless-allthethings.git
-
Change your current directory to the local clone of the repository
cd serverless-allthethings
-
Build the Docker image (see below)
-
Install dependencies (see below)
-
Deploy Support CloudFormation Stack (see below)
-
(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
- You must add the following environment variables to the Travis build configuration:
-
If you're testing with Lighthouse, do it on the fallback route:
/pwa
-
Build the Docker image
docker build -t serverless-allthethings .
-
Run commands via the Docker image
docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings COMMAND
-
Install npm dependencies
docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind serverless-allthethings bash ./bin/install.sh
-
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 files using ESLint, stylelint and Prettier
- Note: It is strongly recommended to incorporate ESLint, stylelint, Prettier and EditorConfig into your IDE's syntax checking, highlighting and
on save
event
- Note: It is strongly recommended to incorporate ESLint, stylelint, Prettier and EditorConfig into your IDE's syntax checking, highlighting and
-
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 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
-
Run Docker in interactive mode
docker run --mount src="$(pwd)",target=/opt/serverless-allthethings,type=bind -it serverless-allthethings /bin/bash
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.
This project is part of Modus Labs.
This project is MIT licensed.