Skip to content

Heavens-c/CoffeeShop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

☕ Coffee Shop Application

A full-stack coffee shop website built with Flask (Python) and Bootstrap 4.3, powered by PostgreSQL.

Originally based on the FoodHut template by DevCRUD, rebuilt with a proper Python backend, secure authentication, and RESTful API endpoints.


Features

  • Public Pages — Home, About, Gallery, Contact
  • User Authentication — Register, Login, Logout with hashed passwords
  • Admin Panel — User management (admin-only)
  • Book a Table — AJAX-powered reservation form
  • Contact Form — AJAX-powered message submission
  • Responsive Design — Bootstrap 4.3 mobile-first layout
  • Gallery — Displays all 12 food/menu images dynamically
  • Security — Werkzeug password hashing, CSRF protection, session management

Prerequisites

  • Python 3.8+
  • PostgreSQL (running and accessible)
  • pip (Python package manager)

Setup Instructions

1. Create a PostgreSQL Database

-- Connect to PostgreSQL as a superuser and run:
CREATE USER coffeeshop_user WITH PASSWORD 'coffeeshop_pass';
CREATE DATABASE coffeeshop_db OWNER coffeeshop_user;
GRANT ALL PRIVILEGES ON DATABASE coffeeshop_db TO coffeeshop_user;

2. Configure Environment

Edit the .env file in the project root:

SECRET_KEY=your-secret-key-change-me
DATABASE_URL=postgresql://coffeeshop_user:coffeeshop_pass@localhost:5432/coffeeshop_db
FLASK_DEBUG=True
FLASK_PORT=5000

3. Install Python Dependencies

cd public_html
pip install -r requirements.txt

4. Initialize the Database

python init_db.py

This creates all tables and a default admin user:

  • Username: admin
  • Password: admin123

5. Run the Application

python run.py

Open your browser to http://localhost:5000


Project Structure

public_html/
├── app.py                  # Flask application (all routes)
├── models.py               # SQLAlchemy database models
├── config.py               # Configuration (reads .env)
├── init_db.py              # Database initialization script
├── run.py                  # Startup script
├── requirements.txt        # Python dependencies
├── .env                    # Environment variables
├── README.md               # This file
│
├── templates/              # Jinja2 HTML templates
│   ├── base.html           # Shared layout (navbar, footer)
│   ├── index.html          # Home page
│   ├── about.html          # About Us
│   ├── gallery.html        # Menu Gallery
│   ├── login.html          # Login form
│   ├── register.html       # Registration form
│   ├── users.html          # Admin user list
│   └── contact.html        # Contact form
│
├── assets/                 # Static files
│   ├── css/foodhut.css     # Main stylesheet
│   ├── js/foodhut.js       # Original JS (smooth scroll, WOW)
│   ├── js/app.js           # New JS (AJAX forms, validation)
│   ├── imgs/               # Images (22 files)
│   ├── scss/               # SCSS source files
│   └── vendors/            # jQuery, Bootstrap, WOW, Animate, Themify Icons
│
└── (old PHP files)         # Preserved, no longer used
    ├── connections.php
    ├── login.php
    ├── register.php
    └── userlist.php

API Endpoints

Method Endpoint Description Auth Required
GET / Home page No
GET /about About page No
GET /gallery Gallery page No
GET /contact Contact page No
GET /login Login form No
POST /login Process login No
GET /register Registration form No
POST /register Process registration No
GET /logout Log out Yes
GET /users User list (admin only) Yes (Admin)
POST /api/contact Submit contact message (JSON) No
POST /api/book-table Submit reservation (JSON) No

Database Models

Users

Column Type Description
id Integer (PK) Auto-increment
username String(80) Unique, required
email String(120) Unique, required
password_hash String(256) Werkzeug hashed password
is_admin Boolean Admin flag (default: false)
created_at DateTime Registration timestamp

Contact Messages

Column Type Description
id Integer (PK) Auto-increment
name String(100) Sender name
email String(120) Sender email
subject String(200) Message subject
message Text Message body
created_at DateTime Submission timestamp

Reservations

Column Type Description
id Integer (PK) Auto-increment
name String(100) Guest name
email String(120) Guest email
phone String(20) Phone number
date String(20) Reservation date
time String(20) Reservation time
guests Integer Number of guests
special_requests Text Special requests
created_at DateTime Booking timestamp

License

Original template licensed by DevCRUD. Backend and rebuild by Coffee Shop team.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors