Skip to content

raritysoftware/OpenBarber

Repository files navigation

OpenBarber - Professional Barber Appointment System

A modern, user-friendly barber appointment management system built with Flask, SQLite, and Bootstrap 5.

OpenBarber Flask Docker Bootstrap CI/CD Tests

✨ Features

🎯 Core Features

  • Modern Responsive Design - Bootstrap 5 with custom glassmorphism styling
  • Mobile-First Approach - Optimized for all devices
  • Secure Authentication - Password hashing and session management
  • Real-time Availability - Live appointment slot updates
  • Professional UI/UX - Clean, intuitive interface with luxury barber theme
  • Automated Testing - GitHub Actions CI/CD pipeline
  • Template Validation - Jinja2 syntax checking and validation

πŸ‘₯ Customer Features

  • Easy Registration - Quick account creation
  • Smart Booking System - Select date, time, and service
  • Service Selection - Choose from professional hair styles
  • Personal Notes - Add special requests to appointments
  • Appointment History - Track all bookings and status
  • Status Tracking - Real-time appointment status updates

πŸ”§ Admin Features

  • Dashboard Overview - Comprehensive appointment management
  • Approval System - Review and approve/reject appointments
  • Service Management - Add, edit, and manage hair styles
  • Customer Management - View customer information
  • Analytics - Appointment statistics and insights
  • Real-time Updates - Auto-refresh for live data

πŸš€ Quick Start

Docker Compose v2 (Recommended)

# Clone the repository
git clone <repository-url>
cd OpenBarber

# Start with Docker Compose v2
docker compose up -d

# Access the application
open http://localhost:5000

πŸ”„ CI/CD Pipeline

Bu proje GitHub Actions ile otomatik test ve deployment pipeline'Δ±na sahiptir:

πŸ§ͺ Automated Testing

  • Multi-Python Version Testing - Python 3.8, 3.9, 3.10, 3.11
  • Template Validation - Jinja2 syntax checking
  • Flask Application Testing - Startup and endpoint validation
  • Database Testing - SQLite operations and schema validation
  • Code Quality - Flake8 linting and Black formatting
  • Security Scanning - Bandit security analysis

πŸ›‘οΈ Security Checks

  • Vulnerability Scanning - Safety package for known vulnerabilities
  • Code Security Analysis - Bandit static analysis
  • Dependency Checking - Automated security updates

🐳 Docker Testing

  • Build Validation - Docker image build testing
  • Compose Testing - Docker Compose v2 functionality
  • Health Checks - Application health monitoring

πŸ“¦ Deployment

  • Staging Deployment - Automatic staging environment updates
  • Production Ready - Production deployment pipeline
  • Health Monitoring - Post-deployment health checks
# .github/workflows/ci.yml
name: OpenBarber CI/CD Pipeline
on:
  push:
    branches: [ main, develop ]
  pull_request:
    branches: [ main ]

Manual Installation

# Install dependencies
pip install -r requirements.txt

# Run the application
python3 app.py

# Access the application
open http://localhost:5000

πŸ”‘ Demo Accounts

Admin Access

  • Username: admin
  • Password: admin123

Customer Access

  • Create a new account via the registration page
  • All customer accounts have booking privileges

πŸ“ Project Structure

OpenBarber/
β”œβ”€β”€ .github/              # GitHub Actions workflows
β”‚   └── workflows/
β”‚       └── ci.yml        # CI/CD pipeline configuration
β”œβ”€β”€ app.py               # Main Flask application
β”œβ”€β”€ requirements.txt     # Python dependencies
β”œβ”€β”€ Dockerfile          # Container configuration
β”œβ”€β”€ docker-compose.yml  # Docker Compose v2 setup
β”œβ”€β”€ .gitignore          # Git ignore rules
β”œβ”€β”€ templates/          # Jinja2 HTML templates
β”‚   β”œβ”€β”€ base.html       # Base template with navigation
β”‚   β”œβ”€β”€ index.html      # Homepage with services
β”‚   β”œβ”€β”€ login.html      # User authentication
β”‚   β”œβ”€β”€ register.html   # Account creation
β”‚   β”œβ”€β”€ book_appointment.html  # Booking interface
β”‚   β”œβ”€β”€ user_dashboard.html    # Customer panel
β”‚   β”œβ”€β”€ admin_dashboard.html   # Admin management
β”‚   β”œβ”€β”€ 404.html        # Error page
β”‚   └── 500.html        # Server error page
β”œβ”€β”€ data/               # Database storage (Docker)
└── barber.db          # SQLite database (auto-created)

πŸ—„οΈ Database Schema

Tables

  • users - Customer and admin accounts
  • hair_styles - Available services with pricing
  • appointments - Booking records with status tracking

Auto-Initialization

  • βœ… Database tables created automatically
  • βœ… Default admin user (admin/admin123)
  • βœ… Sample hair styles with pricing
  • βœ… Production-ready configuration

πŸ›‘οΈ Security & Quality Assurance

Code Quality

  • Automated Linting - Flake8 for Python code standards
  • Code Formatting - Black for consistent code style
  • Template Validation - Jinja2 syntax verification
  • Type Checking - Static analysis for better code quality

Security Features

  • Password Hashing - Werkzeug security
  • Session Management - Secure user sessions
  • SQL Injection Protection - Parameterized queries
  • XSS Prevention - Template escaping
  • Admin Privilege Separation - Role-based access
  • Input Validation - Client and server-side
  • Security Scanning - Bandit static analysis
  • Vulnerability Monitoring - Safety dependency checking

Testing Strategy

# Run all tests locally
pip install pytest pytest-cov flake8 black bandit safety

# Code quality checks
flake8 . --max-line-length=88
black --check .

# Security scans
bandit -r .
safety check

# Template validation
python test_templates.py

🎨 Technology Stack

  • Backend: Flask 2.3.2 (Python)
  • Database: SQLite with automatic initialization
  • Frontend: Bootstrap 5.3.0 + Font Awesome 6.4.0
  • Containerization: Docker + Docker Compose v2
  • Styling: Custom CSS with glassmorphism design
  • JavaScript: Vanilla JS for interactions
  • CI/CD: GitHub Actions for automated testing
  • Code Quality: Flake8, Black, Bandit, Safety
  • Template Engine: Jinja2 with validation

βš™οΈ Configuration

Environment Variables

SECRET_KEY=your-secret-key-here
FLASK_ENV=development|production

Docker Environment

environment:
  - FLASK_ENV=development
  - SECRET_KEY=openbarber-production-secret-key-2025

πŸš€ Deployment

Development

python3 app.py
# Runs on http://localhost:5000 with debug mode

Production with Docker

docker compose up -d
# Runs as a daemon with volume persistence

Manual Production

pip install gunicorn
gunicorn -w 4 -b 0.0.0.0:5000 app:app

πŸ“Š Features Overview

Feature Customer Admin
View Services βœ… βœ…
Book Appointments βœ… ❌
View Appointment History βœ… βœ…
Approve/Reject Bookings ❌ βœ…
Manage Services ❌ βœ…
Customer Management ❌ βœ…
Analytics Dashboard ❌ βœ…

🎯 Business Hours

  • Monday - Saturday: 9:00 AM - 6:00 PM
  • Sunday: Closed
  • Booking Window: Next 14 days
  • Time Slots: Hourly appointments

πŸ”„ API Endpoints

  • GET / - Homepage with services and availability
  • GET|POST /login - User authentication
  • GET|POST /register - Account creation
  • GET|POST /book_appointment - Booking interface
  • GET /user_dashboard - Customer appointment view
  • GET /admin_dashboard - Admin management panel
  • GET /admin/approve_appointment/<id> - Approve booking
  • GET /admin/cancel_appointment/<id> - Cancel booking

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Make your changes with proper testing
  4. Run quality checks:
    # Code formatting
    black .
    
    # Linting
    flake8 . --max-line-length=88
    
    # Security check
    bandit -r .
    
    # Template validation
    python test_templates.py
  5. Commit your changes (git commit -m 'Add amazing feature')
  6. Push to the branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

Development Setup

# Clone the repo
git clone <your-fork-url>
cd OpenBarber

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Linux/Mac
# or
venv\Scripts\activate     # Windows

# Install dependencies
pip install -r requirements.txt
pip install pytest pytest-cov flake8 black bandit safety

# Run development server
python app.py

Pull Request Guidelines

  • βœ… All tests must pass
  • βœ… Code must be formatted with Black
  • βœ… No linting errors from Flake8
  • βœ… Security checks must pass
  • βœ… Templates must be valid Jinja2
  • βœ… Add tests for new features
  • βœ… Update documentation as needed

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ› Troubleshooting

Common Issues

Database not found:

# Delete existing database and restart
rm barber.db
python3 app.py

Port already in use:

# Find and kill process using port 5000
lsof -ti:5000 | xargs kill -9

Docker permission issues:

# Fix permissions
sudo chown -R $USER:$USER .

πŸ“ž Support

For support and questions:


OpenBarber - Where tradition meets technology πŸ’ˆβœ¨

Releases

No releases published

Packages

No packages published