/pizza-tax-frontend-workshop

Primary LanguageScalaApache License 2.0Apache-2.0

GitHub release (latest by date) GitHub code size in bytes GitHub last commit

pizza-tax-frontend workshop

An imaginary pizza tax service showcasing how to build a frontend microservice using play-fsm.

If you are interested in starting a brand-new microservice you can generate it quickly from template-play-frontend-fsm.g8.

Workshop steps

Goal

The aim of the workshop is to build step-by-step a frontend microservice implementing the user flow presented on the chart:

                    ┌─────────┐
                    │  Start  │
                    └────┬────┘
                         │
                         ▼
             HaveYouBeenHungryRecently
                         │
              ┌────no────┴────yes───┐
              │                     ▼
              │              WhatYouDidToAddressHunger
              │                     │
              │ ┌──other────────────┴───┐
              │ │                       │
              ▼ ▼                 HungerSolution
    DidYouOrderPizzaAnyway        == OrderPizza
              │                         │
              ├───yes─────────────────┐ │
              │                       ▼ ▼
              │              HowManyPizzasDidYouOrder
              │                         │
              no                ┌───L───┴───H────┐
              │                 │                ▼
              │                 │    AreYouEligibleForSpecialAllowance
              │                 │                │
              │                 │      ┌──other──┴─ITWorker──┐
              │                 │      │                     ▼
              │                 │      │              WhatIsYourITRole
              │                 │      │                     │
              │                 │      │      ┌──────────────┘
              │                 │      │      │
              │                 ▼      ▼      ▼
              │              QuestionnaireSummary
              │                        │               ┌─────────────┐
              │                        ├──calculate───►│ Backend API │
              │                        │               └─────────────┘
┌─────────────▼────────┐    ┌──────────▼─────────────┐
│NotEligibleForPizzaTax│    │TaxStatementConfirmation│
└──────────────────────┘    └────────────────────────┘

Empty project content

.
├── project
│   ├── build.properties
│   └── plugins.sbt
├── LICENSE
├── README.md
├── build.sbt
└── repository.yaml

Running the tests

sbt test it:test

Running the tests with coverage

sbt clean coverageOn test it:test coverageReport

Running the app locally

sm --start AWESOME_STUBS AWESOME_STUBS_FRONTEND ASSETS_FRONTEND
sbt run

It should then be listening on port 12345

browse http://localhost:12345/pay-as-you-eat

License

This code is open source software licensed under the Apache 2.0 License