This is PHP/PostgreSQL pizzeria website developed for the PRI course at UJEP.
- Backend: PHP, PostgreSQL
- Frontend: HTML5, CSS3, JavaScript (ES6+, Fetch API, LocalStorage)
- Infrastructure: Docker & Docker Compose
- Design Patterns: Singleton (Database Connection), Memento (Profile state)
- Tools: Mermaid.js (System diagrams)
- Main Page: Features an image slider and pizzeria description.
- Authentication: Login and Registration system with session management.
- Menu/Ordering: Browse available pizzas and add them to a local storage-based basket.
- Basket/Checkout: Manage cart items and place orders with delivery details (Czech Republic presets).
- User Profile: View order history and update delivery presets.
- EU Publicity: Header and Footer include mandatory EU funding information.
- Ensure you have Docker and Docker Compose installed.
- Clone the repository.
- Run the following command in the root directory:
docker-compose up -d --build
- Access the site at
http://localhost:8080. - The database will be automatically initialized with sample data from
src/scripts/init_db.sql.
src/index.php: Main router and entry point.src/includes/: Core logic (DB Singleton, Auth).src/models/: Data models and Design Patterns (Memento).src/controllers/: Business logic for orders.src/views/: UI templates.src/assets/: CSS, JS, and image placeholders.
graph TD
index.php --> Auth::isLoggedIn
index.php --> OrderController::processOrder
index.php --> Header[views/header.php]
index.php --> Home[views/home.php]
index.php --> Order[views/order.php]
index.php --> Basket[views/basket.php]
index.php --> Checkout[views/checkout.php]
index.php --> Profile[views/profile.php]
Order --> Database::getInstance
Order --> addToCart[JS: addToCart]
Basket --> renderBasket[JS: renderBasket]
Basket --> removeFromCart[JS: removeFromCart]
Checkout --> Auth::getCurrentUser
Checkout --> processOrder[JS: Submit Order]
OrderController::processOrder --> Database::getInstance
OrderController::processOrder --> PDO::beginTransaction
OrderController::processOrder --> PDO::commit
Profile --> Auth::getCurrentUser
Profile --> Database::getInstance
Auth::login --> Database::getInstance
Auth::register --> Database::getInstance
erDiagram
users ||--o{ orders : places
orders ||--|{ order_items : contains
menu ||--o{ order_items : "is part of"
users {
int id
string email
string password
string full_name
string phone
text address
}
menu {
int id
string name
text description
decimal price
string image_url
}
orders {
int id
int user_id
decimal total_price
string status
string delivery_name
text delivery_address
timestamp created_at
}
order_items {
int id
int order_id
int menu_id
int quantity
decimal price
}