Skip to content

xaprier/xaprair

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

✈️ XaprAir - Flight Management System

Modern Full-Stack Flight Booking and Reservation Platform

React TypeScript Express.js SQL Server GitHub License


πŸ“‹ About The Project

XaprAir is a comprehensive, enterprise-grade flight booking and reservation system developed as a full-stack web application. This project demonstrates real-world database management, API design, and modern frontend development practices.

✨ Key Features

  • 🌍 Multi-language Support - 8 languages (EN, TR, DE, ES, FR, AR, ZH, JA, RU)
  • πŸ’± Multi-currency - 7 currencies (USD, EUR, TRY, GBP, JPY, CNY, AED)
  • πŸ” JWT Authentication - Secure token-based authentication
  • πŸ‘₯ Role-Based Access Control - Customer, Manager, Admin roles
  • πŸ’Ί Dynamic Seat Management - Real-time availability tracking
  • 🎫 Online Check-in - Automated check-in 24 hours before departure
  • πŸ’³ Payment Processing - Mock payment gateway integration
  • πŸ“Š Admin Dashboard - Comprehensive management interface
  • 🎨 10 Color Themes - Customizable UI themes

🎯 Technology Stack

Layer Technology Version
Frontend React + TypeScript + Vite 18.2.0
Backend Express.js + Node.js 5.1.0 + 24.9.0
Database Microsoft SQL Server 2022
ORM Sequelize 6.37.7
Authentication JWT + bcryptjs 9.0.2 + 3.0.2
Payment Mock Gateway N/A

πŸ“ Monorepo Structure

xaprair-flight-management-system/
β”œβ”€β”€ backend/                   # Express.js Backend API
β”‚   β”œβ”€β”€ config/                # Database configuration
β”‚   β”œβ”€β”€ controllers/           # 7 controllers (admin, auth, flight, reservation, manage, payments, preferences)
β”‚   β”œβ”€β”€ routes/                # 7 route modules
β”‚   β”œβ”€β”€ middleware/            # Authentication, roles, localization
β”‚   β”œβ”€β”€ services/              # Database, payment, currency, i18n
β”‚   β”œβ”€β”€ utils/                 # Helper functions, validators, constants
β”‚   β”œβ”€β”€ tests/                 # 11 REST Client test files
β”‚   β”œβ”€β”€ server.js              # Express server entry point
β”‚   β”œβ”€β”€ db.js                  # SQL Server connection
β”‚   β”œβ”€β”€ test-connection.js     # Database health check
β”‚   β”œβ”€β”€ package.json           # Backend dependencies
β”‚   β”œβ”€β”€ .env.example           # Environment variables template
β”‚   └── README.md              # Backend documentation
β”‚
β”œβ”€β”€ frontend/                  # React Frontend (Vite + TypeScript)
β”‚   β”œβ”€β”€ public/                # Static assets (icons, favicons)
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # React components (Navbar, Footer, etc.)
β”‚   β”‚   β”œβ”€β”€ locales/           # i18n translation files
β”‚   β”‚   β”œβ”€β”€ pages/             # Page components (FlightSearch, Preferences, etc.)
β”‚   β”‚   β”œβ”€β”€ services/          # Frontend-backend API integration
β”‚   β”‚   β”œβ”€β”€ styles/            # CSS files (10 themes)
β”‚   β”‚   β”œβ”€β”€ utils/             # Frontend utility functions
β”‚   β”‚   β”œβ”€β”€ App.tsx            # Main App component
β”‚   β”‚   β”œβ”€β”€ i18n.ts            # i18n multi-language configuration
β”‚   β”‚   β”œβ”€β”€ main.tsx           # Frontend entry point
β”‚   β”‚   └── vite-env.d.ts      # Vite TypeScript definitions
β”‚   β”œβ”€β”€ .env.example           # Frontend environment variables template
β”‚   β”œβ”€β”€ index.html             # HTML template
β”‚   β”œβ”€β”€ package.json           # Frontend dependencies
β”‚   β”œβ”€β”€ tsconfig.json          # TypeScript configuration
β”‚   └── vite.config.ts         # Vite configuration
β”‚
β”œβ”€β”€ database/                  # SQL Server Database Scripts
β”‚   β”œβ”€β”€ schema/                # Table creation, constraints, indexes (13 tables)
β”‚   β”œβ”€β”€ functions/             # 4 scalar functions (pricing, cancellation, concatenation)
β”‚   β”œβ”€β”€ views/                 # 8 views (flight availability, reports)
β”‚   β”œβ”€β”€ procedures/            # 38 stored procedures (reservations, payments, management)
β”‚   β”‚   β”œβ”€β”€ admin/             # Admin procedures (13)
β”‚   β”‚   β”œβ”€β”€ customer/          # Customer procedures (7)
β”‚   β”‚   β”œβ”€β”€ manager/           # Manager procedures (7)
β”‚   β”‚   └── maintenance/       # Maintenance procedures (5)
β”‚   β”œβ”€β”€ triggers/              # 7 triggers (audit logs, status updates, validations)
β”‚   β”œβ”€β”€ seed/                  # Seed scripts + JS generators
β”‚   β”œβ”€β”€ indexes/               # 20+ index creation scripts
β”‚   └── jobs/                  # 5 SQL Agent job scripts
β”‚
β”œβ”€β”€ package.json               # Workspace root package.json
β”œβ”€β”€ .gitignore                 # Git ignore rules
β”œβ”€β”€ LICENSE                    # License
└── README.md                  # This file

πŸš€ Quick Start

Prerequisites

  • Node.js: v18+ (recommended v20+)
  • Microsoft SQL Server: 2022 or later
  • npm: 9+

1️⃣ Installation

# Clone the repository
git clone https://github.com/xaprier/xaprair-flight-management-system.git
cd xaprair-flight-management-system

# Install all dependencies (root + backend + frontend)
npm run install:all

2️⃣ Environment Configuration

# Backend .env configuration
cd backend
cp .env.example .env

# Edit the .env file with your database credentials
nano .env  # or use any text editor

Backend .env example:

# Database
DB_SERVER=localhost
DB_PORT=1433
DB_NAME=DB_EXAMPLE_NAME
DB_USER=sa
DB_PASS=YourStrongPassword123!

# JWT
JWT_SECRET=change-this-to-a-secure-random-string-in-production
JWT_EXPIRES_IN=24h

# Server
PORT=5000
NODE_ENV=development
FRONTEND_URL=http://localhost:3000

# Payment Gateway
PAYMENT_MODE=mock  # mock (simulated)

Frontend .env example:

# API Configuration
VITE_API_URL=http://localhost:5000/api

3️⃣ Database Setup

Important: All SQL scripts in the database/ directory use USE DB_EXAMPLE_NAME. You can either:

  • Use this database name as-is, or
  • Find and replace all occurrences with your preferred database name before running scripts
-- 1. Create database in SQL Server (you can use any name you prefer)
CREATE DATABASE YourDatabaseName;  -- Or use: DB_EXAMPLE_NAME
GO

USE YourDatabaseName;
GO

-- 2. If you used a different database name, update your backend .env:
--    DB_NAME=YourDatabaseName

-- 3. Run schema files in order
-- See database/README.md for detailed setup instructions

Quick database setup using scripts:

cd database

# Option 1: Run all scripts manually in SQL Server Management Studio (SSMS)
# Follow the order: schema -> functions -> procedures -> triggers -> views -> seed

# Option 2: Use the automated script runner
node run-scripts.js

# Generate sample data
cd seed
node generate-flights.js      # Creates flights for 7 days back, 203 days forward
node generate-reservations.js 500  # Creates 500 random reservations

4️⃣ Running the Application

Backend Server:

cd backend

# Production mode
npm start

# Development mode (with nodemon auto-reload)
npm run dev

# Test database connection
npm run test

Backend server runs at: http://localhost:5000

Frontend Application:

cd frontend

# Development server
npm run dev

# Production build
npm run build

Frontend dev server runs at: http://localhost:3000

Full-Stack Development (Monorepo):

# From root directory - runs both backend and frontend concurrently
npm run dev

# Or separately:
npm run backend   # Backend only
npm run frontend  # Frontend only

οΏ½ Screenshots

🎨 Theme Showcase

XaprAir offers 10 beautiful color themes with both light and dark modes:

Light Themes

Default Blue Green
Light Default Light Blue Light Green
Orange Purple Aqua
Light Orange Light Purple Light Aqua

Dark Themes

Default Blue Green
Dark Default Dark Blue Dark Green
Orange Purple Aqua
Dark Orange Dark Purple Dark Aqua

✈️ Customer Features

Flight Search Search Results
Flight Search Search Results
Flight Status My Reservations
Flight Status My Reservations
Login/Register Profile Menu
Login Profile

πŸ‘¨β€πŸ’Ό Manager Features

Flight Management Reservation Management
Manager Flights Manager Reservations

πŸ‘¨β€πŸ’» Admin Features

Dashboard User Management
Admin Dashboard User Management
Airline Management Airport Management
Airline Management Airport Management
Audit Logs
Audit Logs

οΏ½πŸ“š Documentation

Detailed documentation for each component:


🎨 Features in Detail

Multi-Language Support (i18n)

  • πŸ‡¬πŸ‡§ English
  • πŸ‡ΉπŸ‡· Turkish
  • πŸ‡©πŸ‡ͺ German
  • πŸ‡ͺπŸ‡Έ Spanish
  • πŸ‡«πŸ‡· French
  • πŸ‡ΈπŸ‡¦ Arabic
  • πŸ‡¨πŸ‡³ Chinese
  • πŸ‡―πŸ‡΅ Japanese
  • πŸ‡·πŸ‡Ί Russian

Multi-Currency Support

  • πŸ’΅ USD (US Dollar)
  • πŸ’Ά EUR (Euro)
  • πŸ’· GBP (British Pound)
  • πŸ‡ΉπŸ‡· TRY (Turkish Lira)
  • πŸ’΄ JPY (Japanese Yen)
  • πŸ‡¨πŸ‡³ CNY (Chinese Yuan)
  • πŸ‡¦πŸ‡ͺ AED (UAE Dirham)

User Roles & Permissions

πŸ‘€ Customer

  • Search and book flights
  • Manage reservations
  • Online check-in
  • View booking history
  • Update profile and preferences

πŸ‘¨β€πŸ’Ό Manager

  • View flight statistics
  • Manage flight schedules
  • Access reservation reports
  • Monitor system performance

πŸ‘¨β€πŸ’» Admin

  • Full system access
  • User management
  • Airline and airport management
  • System configuration
  • Audit log access

πŸ—οΈ Architecture Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              Frontend (React + TypeScript)              β”‚
β”‚  - Multi-language UI (i18n)                            β”‚
β”‚  - 10 Color Themes                                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           ↓ REST API
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           Backend API (Express.js + Node.js)            β”‚
β”‚  - JWT Authentication                                   β”‚
β”‚  - Role-Based Access Control                            β”‚
β”‚  - Input Validation                                     β”‚
β”‚  - Error Handling                                       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                           ↓ Stored Procedures
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚        Database Layer (Microsoft SQL Server)            β”‚
β”‚  - 13 Normalized Tables                                 β”‚
β”‚  - 38 Stored Procedures                                 β”‚
β”‚  - 4 Scalar Functions                                   β”‚
β”‚  - 8 Views                                              β”‚
β”‚  - 7 Triggers                                           β”‚
β”‚  - 5 SQL Agent Jobs                                     β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ—ƒοΈ Database Design

Entity-Relationship Diagram

Database ER Diagram

Complete database schema showing relationships between all 14 tables

Key Tables

  • Users - Customer, Manager, Admin accounts
  • Airlines - Airline information and logos
  • Airports - Airport codes, names, locations
  • Aircraft - Aircraft models and seat configurations
  • Flights - Flight schedules and routes
  • FlightSegments - Multi-leg flight support
  • Reservations - Booking information
  • Passengers - Passenger details per reservation
  • Payments - Payment transactions
  • Seats - Seat availability and assignments
  • AuditLog - Complete audit trail

Advanced Features

  • βœ… ACID Compliance - Full transaction support
  • βœ… Referential Integrity - Foreign key constraints
  • βœ… 3NF Normalization - Optimized schema design
  • βœ… Audit Trail - All changes logged
  • βœ… Concurrent Booking - Row-level locking
  • βœ… Dynamic Pricing - Seat class Γ— passenger type
  • βœ… Automated Jobs - Status updates, check-in, cleanup

πŸ”’ Security Features

  • JWT Token Authentication - Secure stateless authentication
  • Password Hashing - bcrypt with salt rounds
  • Role-Based Authorization - Granular access control
  • SQL Injection Prevention - Parameterized queries
  • XSS Protection - Input sanitization
  • CORS Configuration - Restricted origin policy
  • Environment Variables - Sensitive data protection
  • Audit Logging - Complete activity tracking

πŸ§ͺ Testing

Note: Some test cases may be based on older scenarios and might not be fully up-to-date with the current implementation. You may need to adjust test data or parameters to match your current database state.

# Backend API tests (REST Client)
cd backend/tests

# Test files available:
# - test-auth.http (Authentication)
# - test-flights.http (Flight search)
# - test-reservations.http (Booking)
# - test-payments.http (Payment processing)
# - test-admin.http (Admin operations)
# - test-manage.http (Manager operations)
# and more...

πŸ“¦ Deployment

Backend Deployment

cd backend
npm start      # Production mode

Frontend Deployment

cd frontend
npm run build  # Creates optimized production build in dist/

# Serve the dist folder with any static file server
# nginx, Apache, or cloud platforms (Vercel, Netlify, etc.)

Database Deployment

  1. Set up SQL Server 2022 instance
  2. Run all schema scripts in order
  3. Execute stored procedures, functions, views, and triggers
  4. Configure SQL Agent jobs for automated maintenance
  5. Load seed data

πŸ“ License

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


πŸ‘¨β€πŸ’» Author

Seymen 'xaprier' Kalkan


πŸ™ Acknowledgments

  • Developed as a Database Management Systems (DBMS) course project
  • Demonstrates real-world application of database design principles
  • Implements modern full-stack development practices

Made with ❀️ by xaprier

⭐ Star this repo if you find it helpful!

πŸ‘¨β€πŸ’» Author

Seymen 'xaprier' Kalkan


Part of the XaprAir Flight Management System

Backend | Frontend | Database

⬆ Back to Top

About

A DBMS course project simulating an airline ticket management system inspired by Turkish Airlines, built with React.js, Express.js, and MS SQL Server.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors