A single Docker-delivered web app where every visitor shares one persistent smiley-face click counter. The FastAPI service also serves the compiled React/TypeScript client; MySQL stores the counter state.
-
Copy
.env.exampleto.envand adjust non-secret values if needed. -
Create
secrets/mysql_passwordwith a strong database password. This file is ignored by Git. -
Start the application:
docker-compose up --build
-
Open
http://localhost:8000. Click the centered smiley to increment the shared count. Reset is in the bottom-right corner.
docker-compose down stops the app while retaining its count. Use docker-compose down -v only
when intentionally deleting local database data.
docker-compose --profile test run --rm backend-test
docker-compose --profile test run --rm frontend-test
docker-compose --profile test run --rm integration-testThe counter API contract is documented at
specs/001-smiley-click-counter/contracts/counter-api.yaml.
- Do not commit
.envfiles orsecrets/mysql_password. - Migrations run in the Compose
migrateservice before the web application starts. - Successful API responses always contain a committed, nonnegative
count. On a database failure, the application returns a safe unavailable error rather than an unconfirmed value. - Browser HTML and API responses are not cached; Vite's content-hashed client assets use long-lived immutable caching for efficient production delivery.