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

 
 
 

Contributors