# Project: Tyara.ma This is a Next.js-based flight booking platform for Morocco, providing comprehensive flight search, booking, and travel management services. The platform connects travelers with domestic and international flights, focusing on routes to/from Morocco and the MENA region. ## Project Structure ``` / ├── app/ # Next.js 13+ App Router │ ├── layout.tsx # Root layout with Arabic/French/English support │ ├── page.tsx # Homepage with flight search │ ├── globals.css # Global styles with RTL support │ ├── (booking)/ # Flight booking flow │ │ ├── search/ # Flight search results │ │ ├── select/ # Flight selection │ │ ├── passengers/ # Passenger details │ │ ├── payment/ # Payment processing │ │ └── confirmation/ # Booking confirmation │ ├── (account)/ # User account management │ │ ├── login/ │ │ ├── register/ │ │ ├── profile/ │ │ ├── bookings/ # My bookings │ │ └── preferences/ # Travel preferences │ ├── (services)/ # Additional services │ │ ├── hotels/ # Hotel booking integration │ │ ├── car-rental/ # Car rental services │ │ ├── insurance/ # Travel insurance │ │ └── visa/ # Visa assistance │ ├── (support)/ # Customer support │ │ ├── help/ │ │ ├── contact/ │ │ ├── faq/ │ │ └── policies/ │ └── api/ # API routes │ ├── flights/ # Flight search & booking APIs │ ├── airlines/ # Airline data management │ ├── airports/ # Airport information │ ├── payments/ # Payment processing │ ├── bookings/ # Booking management │ ├── users/ # User management │ └── notifications/ # Email/SMS notifications ├── components/ # Reusable React components │ ├── ui/ # Base UI components (buttons, inputs, modals) │ ├── forms/ # Flight search, passenger, payment forms │ ├── cards/ # Flight cards, booking cards │ ├── navigation/ # Header, footer, breadcrumbs │ ├── search/ # Flight search components │ │ ├── SearchForm.tsx │ │ ├── FilterSidebar.tsx │ │ ├── FlightResults.tsx │ │ └── SortOptions.tsx │ ├── booking/ # Booking flow components │ │ ├── FlightDetails.tsx │ │ ├── PassengerForm.tsx │ │ ├── SeatSelection.tsx │ │ └── PaymentForm.tsx │ └── layout/ # Page layout components ├── lib/ # Core utilities and configurations │ ├── amadeus.ts # Amadeus API integration │ ├── sabre.ts # Sabre GDS integration │ ├── payment-gateways.ts # Payment processing (CMI, PayPal, etc.) │ ├── email.ts # Email service integration │ ├── sms.ts # SMS notifications │ └── cache.ts # Redis caching for flight data ├── hooks/ # Custom React hooks │ ├── useFlightSearch.ts # Flight search functionality │ ├── useBooking.ts # Booking management │ ├── useAuth.ts # User authentication │ ├── usePayment.ts # Payment processing │ └── useLocalization.ts # Multi-language support ├── context/ # React context providers │ ├── AuthContext.tsx # User authentication state │ ├── BookingContext.tsx # Booking flow state │ ├── SearchContext.tsx # Flight search state │ └── LocaleContext.tsx # Language & currency context ├── types/ # TypeScript definitions │ ├── flight.ts # Flight, airline, airport types │ ├── booking.ts # Booking and reservation types │ ├── passenger.ts # Passenger and traveler types │ ├── payment.ts # Payment and pricing types │ └── user.ts # User account types ├── utils/ # Helper functions │ ├── formatters.ts # Price, date, duration formatting │ ├── validators.ts # Form and data validation │ ├── constants.ts # Moroccan airports, airlines, currencies │ ├── date-helpers.ts # Date manipulation for flights │ └── price-calculator.ts # Fare calculation utilities ├── data/ # Static data and configurations │ ├── airports.json # Moroccan and international airports │ ├── airlines.json # Supported airlines │ ├── cities.json # Popular destinations │ └── countries.json # Country codes and info ├── public/ # Static assets │ ├── images/ │ │ ├── airlines/ # Airline logos │ │ ├── airports/ # Airport images │ │ └── destinations/ # Destination photos │ └── icons/ # Flight, travel icons ├── styles/ # Styling files │ ├── globals.css # Global styles with RTL support │ ├── components.css # Component-specific styles │ └── themes/ # Dark/light themes ├── middleware.ts # Next.js middleware for auth & i18n ├── package.json # Dependencies and scripts ├── next.config.js # Next.js configuration ├── tailwind.config.js # Tailwind CSS with RTL support ├── tsconfig.json # TypeScript configuration └── llms.txt # This file ``` ## Technologies Used - **Framework**: Next.js 14 with App Router - **Language**: TypeScript - **Styling**: Tailwind CSS with RTL support - **Database**: PostgreSQL with Prisma ORM - **Caching**: Redis for flight data caching - **Authentication**: NextAuth.js - **Payments**: CMI (Morocco), PayPal, Stripe - **APIs**: Amadeus GDS, Sabre API - **Email**: SendGrid - **SMS**: Twilio / Local Moroccan SMS provider - **Deployment**: AWS - **Monitoring**: Sentry for error tracking ## Key Features - **Flight Search & Booking** - Real-time flight search across multiple airlines - Round-trip, one-way, and multi-city booking - Flexible date search and price calendar - Advanced filters (price, duration, stops, airlines) - **Multi-language Support** - Arabic (RTL), French, and English interfaces - Currency conversion (MAD, EUR, USD) - Localized date and number formatting - **Moroccan Market Focus** - Integration with Royal Air Maroc and local carriers - Popular routes: Casablanca, Marrakech, Rabat, Fez - Domestic and international flight coverage - **User Experience** - Guest booking without registration - User accounts with booking history - Mobile-responsive design - Progressive Web App (PWA) capabilities - **Payment Integration** - Charipay payment gateway (local Moroccan banks) - International payment methods - Secure PCIDSS-compliant processing - Installment payment options ## Development Guidelines ### Code Style - Use TypeScript for all components and utilities - Follow Airbnb ESLint configuration - Implement proper error boundaries - Use React Query for API state management - Follow atomic design principles for components ### API Integration - Cache flight search results for 15 minutes - Implement rate limiting for search APIs - Handle GDS API failures gracefully - Store booking PNRs securely - Implement webhook handling for payment confirmations ### Performance Optimization - Server-side rendering for SEO - Image optimization for airline logos and destinations - Lazy loading for search results - Debounced search inputs - Compressed API responses ### Moroccan Localization - Support for Arabic RTL layout - Moroccan Dirham (MAD) as primary currency - Local phone number validation (+212) - Moroccan airports as default suggestions - Integration with Moroccan banking systems ### Security Considerations - PCI DSS compliance for payment processing - Secure storage of passenger data - GDPR compliance for EU travelers - Rate limiting on search endpoints - Input sanitization and validation ## Flight Data Structure ### Airport Codes (IATA) - **CMN**: Mohammed V International Airport (Casablanca) - **RAK**: Marrakech Menara Airport - **RBA**: Rabat-Salé Airport - **FEZ**: Fès–Saïs Airport - **AGA**: Al Massira Airport (Agadir) - **TNG**: Ibn Batouta Airport (Tangier) ### Supported Airlines - **AT**: Royal Air Maroc (Flag carrier) - **3O**: Air Arabia Maroc - **AF**: Air France - **LH**: Lufthansa - **IB**: Iberia - **TK**: Turkish Airlines ### Popular Routes - Domestic: CMN-RAK, CMN-FEZ, CMN-AGA - Europe: CMN-CDG, CMN-MAD, CMN-FCO - Middle East: CMN-DXB, CMN-DOH, CMN-IST - Africa: CMN-DKR, CMN-ABJ, CMN-LOS ## Environment Variables # Next.js NEXTAUTH_URL=https://tyara.ma ``` ## Scripts - `npm run dev` - Start development server with hot reload - `npm run build` - Build optimized production bundle - `npm run start` - Start production server - `npm run lint` - Run ESLint with Airbnb config - `npm run type-check` - TypeScript compilation check - `npm run test` - Run Jest test suite - `npm run test:e2e` - Run Playwright end-to-end tests - `npm run db:migrate` - Run Prisma database migrations - `npm run db:seed` - Seed database with airport/airline data ## Important Notes for AI Assistants - This is a flight booking platform specifically for the Moroccan market - All prices should be displayed in Moroccan Dirham (MAD) as primary currency - Arabic language support requires RTL (right-to-left) layout considerations - Flight search responses should be cached but expire quickly due to dynamic pricing - Booking confirmation emails must be sent in the user's preferred language - Payment processing must comply with Moroccan banking regulations - Error messages should be user-friendly and translated appropriately - Mobile optimization is crucial as many users book via mobile devices ## Business Logic Constraints - Minimum advance booking: 2 hours for domestic, 3 hours for international - Maximum advance booking: 330 days - Child age classification: 2-11 years, Infant: 0-23 months - Baggage allowances vary by airline and fare class - Cancellation policies depend on fare type and airline - Seat selection may incur additional fees ## Recent Changes - 2024-06: Implemented new Charipay payment gateway integration - 2024-05: Added Arabic language support with RTL layout - 2024-04: Integrated with Royal Air Maroc direct API - 2024-03: Launched PWA version for mobile users - 2024-02: Added multi-city booking functionality --- This file helps AI assistants understand the Tyara.ma flight booking platform structure and Morocco-specific travel requirements. Last updated: June 25, 2025