No description
Find a file
2026-01-16 17:03:53 +01:00
backend Removed useless comments 2026-01-16 17:03:53 +01:00
deploy Initial commit 2026-01-16 09:59:41 +01:00
frontend Removed useless comments 2026-01-16 17:03:53 +01:00
.dockerignore Initial commit 2026-01-16 09:59:41 +01:00
.env.example Initial commit 2026-01-16 09:59:41 +01:00
.gitignore Initial commit 2026-01-16 09:59:41 +01:00
docker-compose.yml Initial commit 2026-01-16 09:59:41 +01:00
Dockerfile Initial commit 2026-01-16 09:59:41 +01:00
jest.config.js Initial commit 2026-01-16 09:59:41 +01:00
LICENSE Initial commit 2026-01-16 09:59:41 +01:00
package-lock.json Initial commit 2026-01-16 09:59:41 +01:00
package.json Initial commit 2026-01-16 09:59:41 +01:00
README.md Fix 2026-01-16 16:03:02 +01:00
relazione_FastFood.pdf Initial commit 2026-01-16 09:59:41 +01:00
relazione_FastFood.tex Initial commit 2026-01-16 09:59:41 +01:00
seed_data.js Initial commit 2026-01-16 09:59:41 +01:00

🍔 FastFood - Food Delivery Platform

Professional food delivery web application with dual interfaces for customers and restaurant owners.

Node.js Express MongoDB Bootstrap

Live Demo: fastfood.simonemiglio.eu

📌 Primary Repository: Forgejo
🪞 Mirrors: GitHubGitLabCodeberg


📋 Table of Contents


Features

👤 For Customers

Feature Description
Restaurant Discovery Search by name, category, cuisine
Smart Search Filter dishes by ingredients, allergens, price
Cart System Real-time total calculation
Order Tracking Live status: Ordered → Preparing → Delivering → Delivered
User Profiles Saved addresses, order history

🏪 For Restaurant Owners

Feature Description
Analytics Dashboard Sales, popular dishes, order volume
Menu Manager CRUD operations for dishes with images
Order Management Accept/reject, update status in real-time
Business Profile Hours, description, cover image

🛠 Tech Stack

Layer Technology Purpose
Backend Node.js + Express 5 REST API server
Database MongoDB Atlas Data persistence
Auth JWT + Bcrypt Secure authentication
Frontend Vanilla JS + Bootstrap 5 Responsive UI
Security Helmet, CORS, Rate Limiting API protection

🚀 Quick Start

Prerequisites

Step 1: Clone & Install

git clone https://forgejo.it/simonemiglio/FastFood.git
cd FastFood
npm install

Step 2: Configure Environment

cp .env.example .env
nano .env   # Edit with your values

Required environment variables:

Variable Description Example
MONGO_USER MongoDB Atlas username admin
MONGO_PASSWORD MongoDB Atlas password your_password
MONGO_CLUSTER Cluster address cluster0.xxxxx.mongodb.net
JWT_SECRET Auth secret key openssl rand -hex 32
PORT Server port 3000

Step 3: Run

# Start server
npm start

# Or with nodemon (dev)
npm run dev

Open: http://localhost:3000

Alternative: Local MongoDB

# Start MongoDB container
podman run -d --name mongo -p 27017:27017 mongo:6

# In .env, use:
# MONGO_URI=mongodb://localhost:27017/fastfood

📁 Project Structure

FastFood/
├── backend/                 # Server-side logic
│   ├── config/              # Database & app config
│   │   └── db.js            # MongoDB connection
│   ├── controllers/         # Request handlers
│   │   ├── authController.js
│   │   ├── orderController.js
│   │   └── restaurantController.js
│   ├── middleware/          # Express middleware
│   │   ├── auth.js          # JWT verification
│   │   └── imgUpload.js     # Multer config
│   ├── models/              # Mongoose schemas
│   │   ├── User.js
│   │   ├── Restaurant.js
│   │   ├── Dish.js
│   │   └── Order.js
│   ├── routes/              # API route definitions
│   └── server.js            # Entry point
│
├── frontend/                # Client-side
│   ├── css/                 # Stylesheets
│   ├── js/                  # Application scripts
│   │   ├── api.js           # API client
│   │   ├── auth.js          # Auth handlers
│   │   └── cart.js          # Cart logic
│   ├── html/                # Page templates
│   │   ├── homeCustomer.html
│   │   ├── homeOwner.html
│   │   └── ...
│   └── public/              # Static assets
│       ├── images/
│       ├── landing.html
│       └── index.html
│
├── .env.example             # Environment template
├── package.json
└── README.md

🔐 Environment Variables

Create a .env file from the template:

cp .env.example .env

Full .env Reference

# ===========================================
# MongoDB Atlas Connection
# ===========================================
MONGO_USER=your_username
MONGO_PASSWORD=your_password
MONGO_CLUSTER=cluster0.xxxxx.mongodb.net

# ===========================================
# Application Settings
# ===========================================
PORT=3000
NODE_ENV=production
JWT_SECRET=your_super_secret_key
ALLOWED_ORIGINS=https://fastfood.yourdomain.com

Generate JWT Secret

openssl rand -hex 32

📖 API Documentation

Full interactive docs available at /api-docs (Swagger UI).

Core Endpoints

Method Endpoint Description
POST /auth/register Create new user
POST /auth/login Login (returns JWT)
GET /api/nearby List nearby restaurants
GET /api/dishes List dishes for menu
POST /api/order Place order
PUT /api/order/update Advance order in queue

Authentication

All protected endpoints require:

Cookie: token=<jwt_token>

🚢 Deployment

Standalone (Node.js)

npm install --production
NODE_ENV=production node backend/server.js

With Podman

# Build image
podman build -t fastfood .

# Run container
podman run -d \
  --name fastfood \
  -p 3000:3000 \
  --env-file .env \
  fastfood

Full Infrastructure

For production deployment with Caddy reverse proxy and auto-start, see the Homelab repository.


🧪 Testing

# Run all tests
npm test

# With coverage report
npm run test:coverage

Tests use Jest + Supertest for API testing.


📊 Database Schema

Collections

Collection Description
users Customer & owner accounts
restaurants Restaurant profiles
dishes Menu items
orders Order history

Relationships

User (owner) ──┬── Restaurant ──── Dish
               │
User (customer) ──── Order ──── [Dish references]

📄 License

ISC License


Created by Simone Miglio 🇮🇹

Developed for Web and Mobile Programming course (A.A. 2025/2026)