Skip to main content

Run It Locally

Table of Contents

Why Docker​

The stack has four moving parts: a Java API, a Node web app, Postgres and a SoapUI mock. Installing those by hand is an afternoon. Docker Compose builds and starts all four from one file, so the only thing you need on your machine is Docker Desktop.

How: start the stack​

  1. Install Docker Desktop and open it once so the engine is running.
  2. Clone the playground repository and enter it:
git clone https://github.com/syamilu/pizza-playground.git
cd pizza-playground
  1. Copy the settings file and start everything:
cp .env.example .env
docker compose up --build
  1. Wait. The first run downloads Postgres, builds the API with Maven, builds the web app and downloads SoapUI. Expect several minutes and a lot of log output. It is ready when the log shows web-1 Started.

Later runs skip the builds and come up in under a minute.

How: check it is up​

WhatURL
Shophttp://localhost:3000
Admin loginhttp://localhost:3000/admin/login
API and Swagger UIhttp://localhost:8080/swagger-ui.html
Mock payment gatewayhttp://localhost:8090
Postgreslocalhost:5432, user and password playground

Quick proof from a terminal:

curl -s localhost:8080/actuator/health
# {"status":"UP"}

Then place an order in the browser: menu, Customize a pizza, Add to cart, Checkout, Place order. You land on the mock gateway's pay page. Click Pay and you are back on the confirmation page, which flips to PAID within a second.

How: stop and reset​

docker compose down # stop, keep the database
docker compose down -v # stop and wipe the database

You rarely need -v. The API has a reset endpoint that clears orders in under a second without restarting anything; see Testing Against It.

Tips​

  • Ports in use. If 3000, 8080, 8090 or 5432 is taken, change the left side of the ports: mapping in docker-compose.yml and the matching URL in .env.
  • The mock forgets bills on restart. Unpaid bills live in the mock's memory. If you restart only the mock-gateway container, orders that were mid-payment stay PENDING. Reset them.
  • Browsers with many cookies. Everything on localhost shares cookies across ports. The mock's Jetty server is old and used to reject large cookie headers with HTTP 413; the shipped version raises the buffer, so if you see a 413 you are on an old build.
  • Windows. Use PowerShell or Git Bash for the cp line, or copy .env.example to .env in Explorer. Everything else is the same.