/frisorsalong-booking

✂️ Fullstack bookingsystem for frisørsalonger med NestJS og Vue 3. Statusvisning for TV. Bestilling av klipp med automatisk tilgjengelighetssjekk. Administrasjonspanel for booking- og ansatthåndtering.

Primary LanguageTypeScriptMIT LicenseMIT

Quality Gate Status Codacy Badge

Hair Salon Booking System

A full-stack booking system for hair salons built with NestJS (backend) and Vue 3 (frontend). The system provides comprehensive functionality for managing appointments, employees, services, and user authentication.

Test Coverage

Backend Frontend
Backend Coverage Frontend Coverage

Frontend

Admin Panel

Backend

API Documentation


Features

  • 🔐 Secure JWT-based Authentication & Authorization
  • 👥 Role-based User Management (Admin, Employee, Customer)
  • 📅 Advanced Booking System
    • ⏰ Smart scheduling with service duration-based time slots
    • 🕒 Automatic end time calculation based on service duration
    • ✅ Real-time employee availability checking
    • 📊 Booking status tracking (Pending, Confirmed, Cancelled)
    • ❌ Booking cancellation with reason tracking
    • 📈 Upcoming bookings dashboard
  • 💇‍♀️ Service Management
    • ⏱️ Service duration and pricing
    • 🔄 Employee-service relationship mapping
    • 📋 Service availability per employee
  • 👨‍💼 Employee Management & Scheduling
    • 📆 Advanced availability tracking
    • 🎯 Service specialization assignment
    • 📊 Workload management
  • 🗄️ PostgreSQL Database with TypeORM
  • 📚 Swagger API Documentation
  • 🎨 Modern Admin Dashboard with Vue 3
  • 📱 Responsive Design with Tailwind CSS
  • 🧪 Comprehensive Test Coverage
    • ✅ Unit tests with Jest and Vitest
    • 📊 Continuous coverage reporting

System Architecture

The system follows a modular architecture separating frontend, backend, and database layers:

Backend (NestJS)

  • Framework: NestJS with TypeScript
  • Database: PostgreSQL with TypeORM
  • Authentication: JWT with Passport
  • API Documentation: Swagger/OpenAPI
  • Testing: Jest

Frontend (Vue 3)

  • Framework: Vue 3 with TypeScript
  • State Management: Pinia
  • Routing: Vue Router
  • Styling: Tailwind CSS
  • Testing: Vitest

Project Structure

├── backend/               # NestJS backend application
│   ├── src/
│   │   ├── auth/         # Authentication & authorization
│   │   ├── bookings/     # Booking management
│   │   ├── config/       # Configuration modules
│   │   ├── database/     # Migrations & seeds
│   │   ├── employees/    # Employee management
│   │   ├── services/     # Service management
│   │   └── users/        # User management
│   └── test/             # E2E tests
├── frontend/
│   ├── admin/            # Admin dashboard (Vue 3)
│   └── customer/         # Customer portal (Vue 3)
└── docs/                 # Project documentation

Prerequisites

  • Node.js (v20 or higher)
  • pnpm
  • PostgreSQL
  • Docker

Getting Started

Backend Setup

  1. Navigate to the backend directory:
cd backend
  1. Install dependencies:
pnpm install
  1. Configure environment variables:
cp .env.example .env
# Update the values in .env according to your setup
  1. Run database migrations:
pnpm migration:run
  1. Seed initial data:
pnpm seed
  1. Start the development server:
pnpm start:dev

The API will be available at http://localhost:3000 with Swagger documentation at http://localhost:3000/api

Frontend Setup

  1. Navigate to the admin frontend directory:
cd frontend/admin
  1. Install dependencies:
pnpm install
  1. Start the development server:
pnpm dev

The admin dashboard will be available at http://localhost:5173

Using Docker

  1. Build and run the Docker containers:
docker-compose up --build
  1. Access the services:
  • Backend API: http://localhost:3000
  • Admin Dashboard: http://localhost:3001

Development Guidelines

Code Style

  • Follow the conventions defined in docs/CONVENTIONS.md
  • Use ESLint and Prettier for code formatting
  • Write tests for all new features
  • Follow TDD principles

Git Workflow

  1. Create a feature branch from develop:
git checkout -b feature/your-feature-name
  1. Make your changes following the conventions

  2. Write tests for your changes

  3. Commit using conventional commits:

feat: add new feature
fix: resolve bug
docs: update documentation
style: formatting changes
refactor: code restructuring
test: add tests
chore: maintenance
  1. Create a pull request to develop

Testing

Backend

# Unit tests
pnpm test

# E2E tests
pnpm test:e2e

# Test coverage
pnpm test:cov

Frontend

# Unit tests
pnpm test

# Component tests
pnpm test:unit

API Documentation

The API documentation is available through Swagger UI when running the backend:

http://localhost:3000/api

Environment Variables

Backend (.env)

# Application
NODE_ENV=development
PORT=3000

# Database
DATABASE_URL=postgresql://username:password@localhost:5432/database_name

# JWT
JWT_SECRET=your_jwt_secret
JWT_EXPIRATION=1h

# Redis
REDIS_HOST=localhost
REDIS_PORT=6379
CACHE_TTL=300

Security

  • 🔒 All endpoints are protected with JWT authentication
  • 👮 Role-based access control (RBAC) implementation
  • ✅ Input validation using class-validator
  • 🚦 Rate limiting for API endpoints
  • 🌐 CORS configuration
  • 🔑 Secure password hashing with bcrypt
  • 🔐 Environment variable protection
  • 🛡️ SQL injection prevention through TypeORM

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License

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

Architecture Documentation

For detailed information about the system architecture, please refer to docs/ARCHITECTURE.md.