How blackscythe123/skywings works
Project type and purpose
• SkyWings is a full-stack flight booking web application built on Flask (Python) with a Bootstrap/JS frontend.
• It supports user authentication, flight search/booking, seat selection, payment processing (Stripe), AI chatbot assistance, weather monitoring, background status updates, email notifications, reporting, and an admin dashboard.
File structure
• Top-level “skywings/” directory:
• app.py – Flask app factory, config
• routes.py & chatbot_routes.py – main and chatbot blueprints
• models.py – SQLAlchemy ORM models
• extensions.py – Flask extensions (db, mail, session)
• utils.py – pricing, seat-map helpers
• tasks.py, weather_monitor.py, flight_status_updater.py – background threads/services
• large_injection.py, fix_frequent_flyer_status.py, seed.py – data-injection scripts
• static/ (css, js) & templates/ (base, user pages, admin pages)
• requirements.txt, migrations/, recreate_db.py
• Patterns:
• MVC-style separation (templates/views, models)
• Blueprint modules for grouping routes (chatbot, admin vs user)
• Background services run alongside main app via threads or separate scripts
Key insights from README
• Backend: Flask + SQLAlchemy + Flask-Mail
• Frontend: HTML/CSS/JS + Bootstrap
• External services: Stripe (payments), OpenWeather (weather), OpenRouter/DeepSeek (AI chatbot), SMTP email, wkhtmltopdf/pdfkit
• Background processing: thread-based weather checks and flight status updates
• Admin dashboard for managing flights/users/bookings/reports
• Frequent flyer program logic and bulk-fix scripts
a. Main components
1. Client Browser (User/UI)
– Static assets (JS, CSS) for SPA-like interactions: flight search, seat map, booking forms
2. Flask Web Server
– HTTP(s) endpoints via Blueprints:
• User routes (routes.py)
• Admin routes
• Chatbot routes (chatbot_routes.py)
– PDF generation service
– Background scheduler (weather_monitor, flight_status_updater, tasks.py)
3. Database
– PostgreSQL/SQLite accessed via SQLAlchemy (models.py, migrations/)
4. External Services
– Stripe API (payment processing)
– OpenWeather API (weather data)
– OpenRouter/DeepSeek (AI for chatbot)
– Email SMTP (Flask-Mail)
– wkhtmltopdf (PDF docs)
b. Relationships & interactions
– Browser → Flask (HTTP JSON/HTML)
– Flask ↔ Database (CRUD via SQLAlchemy)
– Flask → Stripe (REST) → Stripe Webhooks → Flask
– Flask → OpenWeather & OpenRouter APIs
– Flask → SMTP Email server
– Background threads (weather_monitor, flight_status_updater) poll External APIs and update DB
– Data-injection scripts run as standalone processes to seed/fix DB
c. Architectural patterns & principles
– MVC (models.py + templates + routes)
– Modular blueprint design for separation of concerns (chatbot, user, admin)
– Layered architecture: Presentation (templates/static), Application (Flask views, services), Data (ORM)
– Asynchronous/background processing for non-blocking tasks
– Third-party API integration points clearly isolated in service modules (weather_service.py, chatbot.py)
d. Key technologies/frameworks
– Flask, SQLAlchemy, Flask-Mail, Bootstrap, JavaScript
– Stripe SDK, OpenWeather SDK, OpenRouter integration
– Threading or Celery-like pattern (in-process)
Final recommendations
• Be very detailed: break the Flask backend into sub-components (API layer, business logic, data layer, extensions).
• Background vs synchronous flows clearly.
• Avoid unnecessary complexity—focus on the essential modules and their interactions as outlined above.