How sebikea/flybook works
Project Type and Purpose
• This is a deliberately‐vulnerable full-stack flight booking demo.
• It consists of:
• A static front end (HTML/CSS/JS) in web-app/
• A PHP-based API layer in api/
• A CGI component in C++ under cgi-bin/
• A MySQL database schema in sql/
• Docker-based deployment (Dockerfile + docker-compose.yml)
File Structure
• Top level
• Dockerfile, docker-compose.yml → containerize all services
• README.md → usage instructions
• sql/flybook.sql → DB schema and initial data
• API tier
• api/API.php → main PHP endpoint routing requests
• api/database.php → DB connection logic
• CGI tier
• cgi-bin/status_check (compiled from status_check.cpp) → external status‐check service
• Web tier
• web-app/ with HTML, CSS, JS, images, vendor libraries
README for Additional Insights
• Services all run in a single docker-compose stack, exposed on port 8000
Main Components & Their Relationships
a. Components
• Client Browser (User Interface)
• Static Web Server (serving web-app/)
• PHP API Service (Apache+PHP-FPM container)
• CGI Service (invoked from web server for status checks)
• MySQL Database
• Docker Host / Docker-Compose Network
b. Interactions & Data Flow
1. Browser → HTTP GET/POST → Web Server
2. Web Server
• If request for HTML/CSS/JS → serve static file from web-app/
• If API request (e.g., booking operations) → forward to PHP API (api/API.php)
• If status-check path → invoke CGI binary (cgi-bin/status_check)
3. PHP API → MySQL (through database.php)
4. CGI → may run its own internal logic or query system state
c. Architectural Patterns & Principles
• Three-tier architecture: Presentation, Application, Data
• Separation of concerns: static assets vs. dynamic API vs. native CGI
• Containerization: all services isolated but share a Docker network
d. Key Technologies & Frameworks
• Docker & docker-compose
• Apache + PHP (API layer)
• CGI in C++ (legacy/vulnerability demo)
• MySQL (relational DB)
• Plain HTML/CSS/JS (no SPA framework)