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.
- 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
- Python 3.8+
- PostgreSQL (running and accessible)
- pip (Python package manager)
-- 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;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=5000cd public_html
pip install -r requirements.txtpython init_db.pyThis creates all tables and a default admin user:
- Username:
admin - Password:
admin123
python run.pyOpen your browser to http://localhost:5000
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
| 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 |
| Column | Type | Description |
|---|---|---|
| id | Integer (PK) | Auto-increment |
| username | String(80) | Unique, required |
| String(120) | Unique, required | |
| password_hash | String(256) | Werkzeug hashed password |
| is_admin | Boolean | Admin flag (default: false) |
| created_at | DateTime | Registration timestamp |
| Column | Type | Description |
|---|---|---|
| id | Integer (PK) | Auto-increment |
| name | String(100) | Sender name |
| String(120) | Sender email | |
| subject | String(200) | Message subject |
| message | Text | Message body |
| created_at | DateTime | Submission timestamp |
| Column | Type | Description |
|---|---|---|
| id | Integer (PK) | Auto-increment |
| name | String(100) | Guest name |
| 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 |
Original template licensed by DevCRUD. Backend and rebuild by Coffee Shop team.