/cloud-apps

A simple, responsive web application to take notes, built with JavaScript ES6, designed as starting point to build complex web applications.

Primary LanguageJavaScript

cloud-apps · GitHub license CircleCI Status PRs Welcome

A simple, responsive web application to take notes, built with JavaScript ES6, designed as starting point to build complex web applications. Each application in the system can be run independently with Docker or npm. Unit, integration and end-to-end (e2e) tests are available. Development, release, integration and e2e test environments can be simulated with Docker Compose.

A new note can be created in a few simple steps:

1. Add note

Add note

2. Create and save note

Create note

3. New note created

Note created

The diagram below outlines the network created by Docker Compose for development and release environments, including application connections, ports, routes and tools:

System overview

Table of contents

Quickstart

Recommended - Run environments with Docker Compose

Docker must be installed.

Development

docker-compose -f dev.yaml up

Release

docker-compose -f release.yaml up

Integration tests

docker-compose -f integration-tests.yaml up --exit-code-from integration

End to end tests

docker-compose -f e2e-tests.yaml up --no-attach node-chrome --exit-code-from e2e

Run environments with NPM and Docker Compose

Node.js v14.19.0 and Docker must be installed.

Development

npm run dev

Release

npm run start

Integration tests

npm run integration-tests

End to End tests

npm run e2e-tests

Run applications with NPM or Docker

Find detailed instructions on how to run each application within the Application docs.

Core concepts

  1. Container orchestration for scale
  2. Automated test pyramid
  3. Blueprint for automated tests with CircleCI
  4. Full stack system built with JavaScript
  5. Starting point for more complicated use cases

Container orchestration for scale

Leveraging the power of Containers, the system and its applications can be deployed as-is to any cloud provider that supports Docker. It is encouraged to leverage the provided Docker Compose files, which simulate how the system & its applications run independently and together to facilitate multi-environment hosting, deployment and automation.

System overview

Docker Compose is used to simulate the system in different environments, creating a clone on your computer of how the system and its applications would run on a cloud. Leveraging Docker Compose, it is easier to troubleshoot multi-application systems outside of the cloud, while serving as a foundation for the cloud network that must be in place for the system to work on the cloud.

The diagram below outlines the network created by Docker Compose for development and release environments, including application connections, ports, routes and tools:

System overview

Integration tests

Using Docker Compose, a network can be spun up to simulate system and applications required to run integration (or service) tests. Unlike development, release and e2e test environments, the integration tests environment only contains a partial system orchestration, as only the API and Database are required.

The diagram below outlines the network created by Docker Compose for the integration tests environment, including application connections, ports, routes and tools:

Integration tests

End to end tests

A Docker Compose network is provided, simulating the system and applications that are needed to run e2e (or UI) tests. The e2e tests environment has the most complex container orchestration out of all other provided environments, as it requires an application to run the tests (nightwatch), a hub to spin up browsers (selenium hub) and a browser (node-chrome).

The diagram below outlines the full network required for the e2e tests environment, including application connections, ports, routes and tools:

End to end tests

Automated test pyramid

Following Mike Cohn's test pyramid approach to automated testing, the system contains a "well-rounded" test portfolio, which aims to cover all critical areas of the system with automated tests.

Mike Cohn's test pyramid

The test pyramid paradigm encourages developers to build more unit tests (since they are small and fast), than service (or integration) tests, and more service tests than UI (or e2e) tests (which are slow and heavy).

Staying true to the test pyramid paradigm, the system provides over 95% unit test coverage, but only critical features are covered by integration and e2e tests. The goal is to provide a starting point for developers to extend tests as required.

UI unit tests

UI unit tests

API unit tests

API unit tests

Integration tests

Integration tests

End to end tests

End to end tests

Blueprint for automated tests with CircleCI

Leveraging CircleCI, unit tests for each application (except for the database) are run on every new commit to Github. Once unit tests have passed, integration tests are run, validating API and Database changes. After integration tests pass, e2e tests are run, validating that the UI, API and Database work together as expected with the new changes.

Following the fail-fast automated testing approach, the system provides a starting point (or blueprint / boilerplate) as-is for more complex automated testing requirements.

CircleCI automated tests

Full stack system built with JavaScript

Each application in the system uses JavaScript, with the exception of the PostgreSQL database. Leveraging (mostly) a single programming language for all applications of the system has numerous advantages, including:

  • Cross-functional engineering - seamlessly switch between application and test code, because all code looks alike!
  • Common design patterns - consistent design patterns and coding styles between applications facilitates readability, maintenance and extendability
  • Easier to staff and scale - hiring and training engineers on for a single programming language is easier than (the more common) multi-language software stacks
  • Large community - all tools, libraries and frameworks used in the system have large open source communities

Starting point for more complicated use cases

The system and its applications can be re-used as a starting point (or blueprint / boilerplate) for more complex systems and applications. Each application provides common design patterns that can be leveraged to facilitate development of new features. All applications are containerized with Docker, ready to be deployed as-is to any cloud provider with Docker support.

Application docs

UI
API
Database
Integration tests
End to end tests

Tools and frameworks

Node.js
Docker
Docker Compose
CircleCI
React
Express.js
Swagger
PostgreSQL
Jest
Supertest
Nightwatch
Selenium

How to contribute

Commits

Our commits follow the Angular commit styleguide. Each commit should be carefully thought out and only contain files affected within the scope of the commit message.

Branching

A branch's name should reference a story and the type of work being committed.

Pull Requests

Each pull request must pass a review from another contributor and all automated tests.

Issues

Feel free to open an issue ticket, please leave a screenshot and a detailed instructions on how to replicate the issue.

License

This repository is protected under the MIT License.