Tickets
Home / The database behind the site

The database behind the site

The portal is a thin layer over the ArcoVivo MySQL database of the report: the same twelve tables, keys and checks. Pages read through a small API; two actions write, and the constraints of the database decide what is accepted.

How a page gets its data

BrowserHTML, CSS and a little JavaScript, no framework. Each page asks the API for its rows.
Cloudflarearcovivo.tommasolapi.com: DNS, TLS, cache of photos, styles and scripts; hides the server.
nginx, on the VPSreceives the requests from Cloudflare and passes them to the API.
API, Node and Expressserves the pages and answers GET /api/concerts … POST /api/concerts/:id/tickets, with prepared statements only.
MySQL 8.4the ArcoVivo schema (SQL1) and data (SQL2) of the report, unchanged. Not reachable from the internet, only from the API, with a user that can read and insert but not update or delete.

Part 2

The same API grows with the second part of the course: a graph of musicians, instruments and concerts in Neo4j, documents in MongoDB, and the BPMN process of a concert, from the request to the tickets.

The ten queries of the report

Each query of chapter 7 is also a view of the site. The link opens the page with the same filter.

QueryWhat it asksWhere on the site

Pages and tables

PageTablesSQL it relies on

What the two writes check

The database rejects what breaks the model; the API turns the MySQL error into a sentence.

ActionConstraintKindTry it

Every night

At 4:00 the database is loaded again from the two SQL files of the report, so the tickets and concerts added by visitors disappear and every visitor finds the same data as the report.