Skip to content

Hypothetical Backend infrastructure for the Piedmontese Computer History Museum (MUPIN). It was developed using the LAMP stack.

Notifications You must be signed in to change notification settings

Elanigiro/MupinDemo

Repository files navigation

MUPIN website prototype

home

This project represents an attempt at building the Backend/Frontend infrastructure for managing the Piedmontese Computer History Museum (MUPIN).

The focus of the project was the Backend, hence the very dry approach to UI/UX.

The project's core is SimpleMVC, a PHP framework that uses PHP-DI as its DI container and Plates as its template engine. It also adopts PSR-7 interfaces for HTTP request/response.

The web application is backed by a MariaDB SQL Database for storing the Museum's catalogue.

NOTE: A database SQL dump is available inside the db_scripts folder.


Website features

1. Basic Search Engine

search results

It is a simple search engine powered by FULLTEXT indices inside the DB.

The results are ordered by relevance thanks to a scoring system.

The user can either search in the whole catalogue or select one of the available categories from the dropdown menu.

2. Advanced Search Engine

Though still very simple in the implementation, this feature enables users to perform a more refined lookup by selecting not only the category but also the field/s to scan.

3. Login/Logout

login

In order to access advanced features, admins have to authenticate with email and password.

Their log in data is safely stored in a SQL DB: passwords are saved as salted BCRYPT hashes.

In case of successful authentication, the email will be stored in the SESSION array/file so that the admin is not required to log-in again.

In order to guarantee a certain level of protection from CSRF and Session Hijacking:

  • SessID Cookie is always generated by the Backend (use_strict_mode)
  • SessID Cookie is HTTP only, Same-site: Lax and with Session Lifetime
  • A Timestamp is saved in the SESSION file at login so that the Server can decide when the session is to be considered expired

Finally, before performing any admin operation, the Server verifies that the user is correctly authenticated in the current Session.

4. Add/Delete User

Admins are allowed to un/register other admins.

5. Add catalogue Item

add item

Admins can add items to the catalogue.

6. Edit a single item

edit item

Admins can click on the edit button to edit any field of the selected item, excluding the item-id which is read-only.

7. Edit item's pictures

edit pictures

Admins can delete/add pictures from/to a specific item as they see fit.

Not all file formats are supported, though, and a limit of 10 pics per item is enforced.


Implementation Details

1. src/Utils

Contains all the utility classes which are basically static classes used for server-side validation, session management, log management, etc.

2. src/Alias

Contains classes that behave exactly as the classes they imitate but have a different name.

This is necessary to ensure the DI container is able to select the correct dependency in corner cases.

3. src/Model

Contains the Object representations of the DB entities.

Many of the object's property feature a Documentation comment.

This Annotations are used through Reflective programming to:

  • provide validation information to the Server and to the Client
  • build a basic ORM system by annotating PKs/FKs

NOTE: Virtual models are Object representations of non-existing entities.

4. src/Repository

Contains the classes that manage the Data Access Layer for CRUD operations.

5. src/Service

Contains the classes that manage the Transactions and provide a layer of abstraction between the Repositories and the Controllers.

6. src/Controller

Contains the classes that control the HTTP request/response exchange with the client. Also, they validate the requests and prevent unauthorized access to the data.

7. tests/

Finally, this folder contains the classes dedicated to the Unit-Testing of the source code.

The Unit-Testing is powered by phpunit.

About

Hypothetical Backend infrastructure for the Piedmontese Computer History Museum (MUPIN). It was developed using the LAMP stack.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published