Torma Security Solutions Ltd. follows a two-part architecture: a static browser client and a PHP API backend connected through JSON over HTTP.
Requirement Alignment
The implementation follows a REST-oriented client-server split, where browser pages consume JSON endpoints exposed by the PHP backend. This satisfies the requirement for both client-side and server-side components in a RESTful architecture.
Top-Level Structure
mestermu/
├── Web/ # Static frontend (HTML, CSS, JS)
├── API/ # PHP REST API
└── documentation/ # Diagrams and supplementary artifactsFrontend Layer
The frontend is plain HTML + JavaScript with no build step:
Web/*.htmldefine pages for public users, logged-in users, and adminsWeb/js/app.jscontains shared UI behavior, cart logic, and booking flowWeb/js/auth.jsmanages client session storage and auth headersWeb/js/products.jsandWeb/js/product.jspower catalog listing and detailsWeb/js/dashboard.jshandles profile and user order history
See frontend for page-by-page behavior.
Backend Layer
API/index.php is the entry point. It:
- Applies CORS and preflight handling
- Registers global JSON error handlers
- Dispatches HTTP routes through a simple router
- Delegates work to controllers
Backend internals are split into:
controllers/request validation and HTTP response shapingmodels/domain logic and database accessmiddleware/auth/admin guardsutils/JWT and rate-limiting helpersdatabase/SQL schema and stored procedures
See backend-api for endpoint-level details.
Data Layer
The project relies heavily on stored procedures in API/database/torma.sql.
- Business rules (stock updates, order totals, reservation constraints) live in SQL procedures
- PHP models call procedures using prepared statements
- Foreign keys enforce consistency between users, orders, products, and reservations
See database for the data model and procedure inventory.