KODA Backend Developer Tasks

Complete Task Breakdown & Specifications

Created: October 31, 2025
Team: Backend Development
Total Hours: 2,680
Total Tasks: 150

Table of Contents

Overview

The Backend team is responsible for building the KODA Backend API (Laravel) and KODA AI engine. The backend serves all applications: KODA Mobile App, KODA Team, KODA Website, and KODA CORE.

Key Technologies

  • PHP 8.2+
  • Laravel 12
  • MySQL (Multi-tenant architecture)
  • Redis (Caching)
  • RoadRunner/Octane (Performance)
  • Google AI Studio (for KODA AI)

Important Notes

  • Follow multi-tenant architecture principles
  • All code must be PSR-12 compliant
  • Comprehensive testing required (PHPUnit)

Phase 1 Tasks

102 Tasks 1,880 Hours 70% of Total

Package 1.3: Authentication & Multi-Tenant Foundation

120H
Milestone: M3 Total Tasks: 9
BE-M3-001 16H Critical

Project Setup & Architecture Foundation

  • Initialize new Laravel 12 project
  • Configure multi-tenant database architecture
  • Setup main database connection + dynamic sub-app connections
  • Configure Redis for caching
  • Setup Sanctum for API authentication
  • Configure CORS
  • Setup activity logging (Spatie)
  • Configure environment files (.env.example)
  • Setup Git repository structure
BE-M3-002 24H Critical

Multi-Tenant Core Architecture

  • Create SubApplication model and migration (main DB)
  • Create ApiKey model and migration with SHA-256 hashing
  • Create SubApplicationDbCredential model (encrypted credentials)
  • Implement ValidateApiKeyMiddleware with Redis caching
  • Create ApiKeyCacheService (cache TTL: 1 hour, <2ms lookup)
  • Implement RequestContextService (singleton for app_id, api_key_id)
  • Create dynamic database connection manager
  • Add app_id and api_key_id to activity logs
  • Write comprehensive tests for multi-tenant isolation
BE-M3-003 20H Critical

User Registration with Deduplication

  • Create users table migration (sub-app DB) with global_id
  • Create users table in main DB (global registry)
  • Create User model with multi-language name support
  • Implement UserMatchingService (match by 4-part name + verified phone)
  • Implement UserSyncService (sync verification between main & sub-app)
  • Implement MultiTenantUserService for registration
  • Create POST /api/v1/register endpoint with validation
  • Handle deduplication logic (prevent duplicates across sub-apps)
  • Auto-generate temporary password option (for staff registration)
  • Comprehensive tests including multi-tenant scenarios
BE-M3-004 18H Critical

Phone Verification System (OTP)

  • Create user_phones table migration (sub-app DB) with global_phone_id
  • Create phone_verification_otps table migration (main DB)
  • Create UserPhone model
  • Create PhoneVerificationOtp model
  • Implement OTPGenerationService (6-digit codes, 5-minute expiry)
  • Implement OTPMessageService (format SMS messages)
  • Implement OTPRateLimitService (prevent abuse)
  • Implement OTPService (main orchestration)
  • Create POST /api/v1/phone-verification/send-otp endpoint
  • Create POST /api/v1/phone-verification/verify-otp endpoint
  • Phone verification sync between main & sub-app DBs
  • Tests for OTP generation, expiry, rate limiting
BE-M3-005 16H High

SMS Providers Integration

  • Create sms_providers table (main DB)
  • Create registered_sms_providers table (sub-app DB)
  • Create sms_logs table (sub-app DB)
  • Implement SMSProviderFactory
  • Implement provider interfaces: Twilio, Vonage, MassJo, UmniahSMS, SMSMobileAPI
  • Implement SMSService (send SMS with provider selection)
  • Configuration management per sub-app
  • Retry logic for failed SMS
  • Comprehensive logging
  • Tests for all providers (with mocking)
BE-M3-006 12H Critical

User Authentication (Login/Logout)

  • Implement UserAuthenticationService
  • Create POST /api/v1/login endpoint (phone + password)
  • Sanctum token generation (multi-tenant aware)
  • Activity logging for login attempts (success/failure)
  • Create POST /api/v1/logout endpoint
  • Token revocation
  • Remember me functionality
  • Failed login tracking (security)
  • Tests for auth flows
BE-M3-007 10H Medium

Password Management

  • Create password_reset_tokens table (main DB)
  • Implement password reset flow with OTP
  • Create POST /api/v1/password/forgot endpoint
  • Create POST /api/v1/password/reset endpoint
  • Create PUT /api/v1/password/change endpoint (authenticated)
  • Password strength validation
  • Activity logging for password changes
  • Tests for password reset flows
BE-M3-008 14H High

Permissions System

  • Create permissions table (main DB)
  • Create permission_categories table (main DB)
  • Create permission_category_permissions table (main DB)
  • Create user_permission_categories table (main DB with app_id)
  • Create permission_checks_log table (main DB with app_id)
  • Create Permission model and relationships
  • Implement PermissionService (check permissions)
  • Create CheckPermission middleware
  • Permission caching with Redis
  • Cache invalidation on permission changes
  • Tests for permission checks across sub-apps
BE-M3-009 10H Medium

Core Admin & Identity Verification

  • Create core_admins table (main DB)
  • Create user_identity_documents table (main DB)
  • Create nationalities table (main DB)
  • Create CoreAdmin model
  • Create UserIdentityDocument model
  • Implement identity verification endpoints (Core Admin only)
  • POST /api/v1/core-admin/verify-identity/{userId}
  • Identity verification sync (main → sub-app)
  • Name fields become read-only after verification
  • Tests for identity verification and restrictions

Package 1.4: User Management APIs

60H
Milestone: M3 Total Tasks: 6
BE-M3-010 12H Medium

User Profile APIs

  • Create GET /api/v1/profile endpoint (authenticated user)
  • Create PUT /api/v1/profile/update endpoint
  • Validate identity-verified restrictions (read-only name fields)
  • Profile photo upload: POST /api/v1/profile/photo/upload
  • Handle multi-language names (AR/EN)
  • Activity logging for profile updates
  • Tests for profile operations and restrictions
BE-M3-011 14H Medium

Phone Number Management APIs

  • GET /api/v1/profile/phones (list user phones)
  • POST /api/v1/profile/phones/add (add phone with OTP verification)
  • DELETE /api/v1/profile/phones/{id} (remove phone, prevent if primary)
  • PUT /api/v1/profile/phones/{id}/set-primary (set primary for calls/messages/WhatsApp)
  • Maximum phones limit enforcement
  • Automatic phone cleanup for unverified phones (scheduled command)
  • Sync phone verification between main & sub-app
  • Tests for phone management
BE-M3-012 10H Medium

Address Management APIs

  • Create user_addresses table (sub-app DB)
  • Create UserAddress model
  • GET /api/v1/profile/addresses (list addresses)
  • POST /api/v1/profile/addresses (add address)
  • PUT /api/v1/profile/addresses/{id} (update address)
  • DELETE /api/v1/profile/addresses/{id} (delete address)
  • PUT /api/v1/profile/addresses/{id}/set-default
  • Tests for address management
BE-M3-013 8H Medium

User Acquisition Source Tracking

  • Create referral_sources table (sub-app DB)
  • Create marketing_codes table (sub-app DB)
  • Create user_acquisition_sources table (sub-app DB)
  • Implement tracking on registration
  • GET /api/v1/referral-sources (list for dropdowns)
  • GET /api/v1/marketing-codes/validate/{code}
  • Analytics endpoints for admin
  • Tests for acquisition tracking
BE-M3-014 10H Medium

User Notes & Documents APIs

  • Create user_notes table (sub-app DB)
  • Create user_documents table (sub-app DB)
  • GET /api/v1/users/{id}/notes (admin/staff only)
  • POST /api/v1/users/{id}/notes (add note)
  • PUT /api/v1/users/{id}/notes/{noteId} (edit note)
  • DELETE /api/v1/users/{id}/notes/{noteId}
  • POST /api/v1/users/{id}/documents/upload
  • GET /api/v1/users/{id}/documents
  • DELETE /api/v1/users/{id}/documents/{docId}
  • File storage management (S3 or local)
  • Tests for notes and documents
BE-M3-015 6H Medium

User Tags & Blacklist APIs

  • Create tags table (sub-app DB)
  • Create user_tags pivot table
  • Create user_blacklist table (sub-app DB)
  • GET /api/v1/tags (list available tags)
  • POST /api/v1/users/{id}/tags/{tagId} (assign tag)
  • DELETE /api/v1/users/{id}/tags/{tagId} (remove tag)
  • POST /api/v1/users/{id}/blacklist (add to blacklist)
  • DELETE /api/v1/users/{id}/blacklist (remove from blacklist)
  • Tests for tags and blacklist

Package 1.5: Services & Catalog APIs

100H
Milestone: M6 Total Tasks: 7
BE-M6-001 12H Medium

Service Categories & Departments

  • Create service_departments table (sub-app DB)
  • Create service_categories table (sub-app DB)
  • Create Department model
  • Create ServiceCategory model
  • GET /api/v1/public/service-categories (public, cached)
  • GET /api/v1/admin/service-categories (full details for admin)
  • POST /api/v1/admin/service-categories (create)
  • PUT /api/v1/admin/service-categories/{id} (update)
  • DELETE /api/v1/admin/service-categories/{id}
  • Multi-language support (AR/EN)
  • Tests for categories management
BE-M6-002 24H High

Services CRUD & Configuration

  • Create services table (sub-app DB) - comprehensive fields
  • Create Service model with relationships
  • GET /api/v1/public/services (public catalog)
  • GET /api/v1/public/services/{id} (service detail)
  • GET /api/v1/admin/services (admin list with filters)
  • POST /api/v1/admin/services (create service)
  • PUT /api/v1/admin/services/{id} (update)
  • DELETE /api/v1/admin/services/{id}
  • Multi-language descriptions
  • Service images handling
  • Activity logging for service changes
  • Tests for service management
BE-M6-003 14H Medium

Price Groups & Dynamic Pricing

  • Create price_groups table (sub-app DB)
  • Create service_price_groups pivot table
  • Implement dynamic pricing logic
  • GET /api/v1/admin/price-groups
  • POST /api/v1/admin/price-groups (create)
  • PUT /api/v1/admin/price-groups/{id}
  • POST /api/v1/admin/services/{id}/pricing (set prices per group)
  • Calculate final price based on user's price group
  • Tests for price calculations
BE-M6-004 18H High

Service Availability Management

  • Create service_availability table
  • Create branch_service_availability table
  • Implement availability checking algorithm
  • GET /api/v1/services/{id}/availability?date=X&branch=Y
  • Consider: staff schedules, room availability, equipment availability
  • Block unavailable time slots
  • Buffer time between sessions
  • Tests for availability logic
BE-M6-005 12H Medium

Branches & Locations APIs

  • Create branches table (sub-app DB)
  • Create Branch model
  • GET /api/v1/public/branches (list for customers)
  • GET /api/v1/branches/{id} (detail with hours, services, contact)
  • GET /api/v1/admin/branches (full management)
  • POST /api/v1/admin/branches (create)
  • PUT /api/v1/admin/branches/{id} (update)
  • DELETE /api/v1/admin/branches/{id}
  • Working hours management
  • Tests for branch management
BE-M6-006 10H Medium

Staff Assignment to Services

  • Create staff_services pivot table
  • Assign staff to services they can perform
  • GET /api/v1/services/{id}/staff (available staff for service)
  • POST /api/v1/admin/staff/{id}/services (assign services)
  • DELETE /api/v1/admin/staff/{id}/services/{serviceId}
  • Filter availability by staff skills
  • Tests for staff-service relationships

Package 1.6: Booking & Reservations APIs

140H
Milestone: M6 Total Tasks: 8
BE-M6-008 28H Critical Path

Booking Availability Engine

  • Implement complex availability checking algorithm
  • Consider multiple factors: Staff availability (schedules, breaks, existing bookings)
  • Room availability (capacity, equipment)
  • Service duration
  • Buffer time between sessions
  • Branch working hours
  • GET /api/v1/bookings/availability endpoint with query params
  • Return available time slots for date range
  • Color-code availability (green, orange, grey)
  • Cache availability for performance
  • Comprehensive tests for edge cases
BE-M6-009 22H High

Booking Creation & Management

  • Create bookings table (sub-app DB)
  • Create Booking model with relationships
  • POST /api/v1/bookings/create endpoint
  • Validate availability before booking
  • Auto-assign staff/room if not specified
  • Send confirmation SMS/email
  • Create activity log entry
  • Support "hold" (unpaid) vs "confirmed" (paid) bookings
  • Tests for booking creation
BE-M6-010 18H High

Booking Update & Reschedule

  • PUT /api/v1/bookings/{id}/reschedule endpoint
  • Check new slot availability
  • Apply rescheduling policy (fees, time limits)
  • Update booking
  • Send notification to customer
  • Activity logging
  • Staff notification (WebSocket placeholder)
  • Tests for rescheduling rules
BE-M6-011 16H High

Booking Cancellation & Refunds

  • DELETE /api/v1/bookings/{id}/cancel endpoint
  • Apply cancellation policy (refund rules)
  • Calculate refund amount
  • Process refund (integrate with payment system)
  • Update booking status
  • Free up time slot
  • Send notification
  • Activity logging
  • Tests for cancellation and refund scenarios
BE-M6-012 24H High

Golden Opportunities System

  • Create golden_opportunities table
  • Implement system to convert available slots to golden opportunities
  • Manual conversion: POST /api/v1/admin/golden-opportunities/create
  • Automatic conversion based on rules (scheduled job)
  • GET /api/v1/golden-opportunities (list available, real-time)
  • GET /api/v1/golden-opportunities/{id} (detail)
  • POST /api/v1/golden-opportunities/{id}/book (requires immediate payment)
  • Limit per day (scarcity)
  • Expire opportunities automatically
  • WebSocket publish on new/removed opportunities
  • Activity logging
  • Comprehensive tests
BE-M6-013 14H Medium

Check-in & Session Status Management

  • PUT /api/v1/staff/bookings/{id}/check-in endpoint
  • QR code validation: GET /api/v1/staff/bookings/verify-qr?code=X
  • Status transitions: Pending → Checked-in → In Progress → Completed
  • PUT /api/v1/staff/bookings/{id}/status (change status)
  • Mark no-show
  • Session timer tracking
  • Activity logging for all status changes
  • WebSocket notifications (placeholder)
  • Tests for status workflows
BE-M6-014 12H Medium

Waiting List Management

  • Create waiting_list table
  • POST /api/v1/waiting-list (add customer to waiting list)
  • GET /api/v1/waiting-list (list with filters)
  • PUT /api/v1/waiting-list/{id}/notify (notify customer of availability)
  • DELETE /api/v1/waiting-list/{id} (remove from list)
  • Auto-expire waiting list entries
  • Tests for waiting list operations
BE-M6-015 14H Medium

Booking History & Calendar APIs

  • GET /api/v1/bookings/my-bookings endpoint (for customers)
  • Filter by status: upcoming, completed, cancelled
  • GET /api/v1/bookings/{id} (booking detail with QR code)
  • GET /api/v1/admin/bookings/calendar (calendar view for staff)
  • Filter by: date, branch, staff, room, service, status
  • Support drag-and-drop rescheduling
  • Booking statistics for dashboard
  • Tests for calendar and history
BE-M6-007 10H Medium

Equipment & Room Management APIs

  • Create equipment table
  • Create rooms table
  • Create service_equipment pivot (required equipment per service)
  • GET /api/v1/admin/equipment
  • POST /api/v1/admin/equipment (create)
  • GET /api/v1/admin/rooms
  • POST /api/v1/admin/rooms (create)
  • Room availability for bookings
  • Equipment availability for bookings
  • Tests for equipment and room management
Milestone: M3 - Authentication & Multi-tenant Backend Blocked by: BE-M3-014

Summary

Total Hours by Phase

Phase Hours Percentage
Phase 1 1,880 70%
Phase 2 240 9%
Phase 3 560 21%
TOTAL 2,680 100%

Total Tasks

Package 1.12: Data Migration Scripts

100H
Milestone: M11 Total Tasks: 6
BE-M11-001 24H Critical Path

Legacy Database Analysis & Mapping

  • Analyze legacy database structure (55,000+ customer records)
  • Document table schemas
  • Map old structure to new structure
  • Identify data inconsistencies
  • Create data dictionary
  • Plan migration strategy
  • Deliverable: Migration mapping document
BE-M11-002 20H Critical Path

Customer Data Migration Script

  • Create Artisan command: `php artisan migrate:customers`
  • Read from legacy DB
  • Transform data (name splitting, phone formatting, etc.)
  • Insert into new structure:
  • - Main DB: global user record
  • - Sub-app DB: local user record with global_id
  • Handle duplicates (merge logic)
  • Progress tracking
  • Error logging
  • Tests with sample data
BE-M11-003 12H Medium

Phone Numbers Migration Script

  • Create Artisan command: `php artisan migrate:phones`
  • Migrate phone numbers to new structure
  • Normalize phone numbers
  • Set primary flags (calls, messages, WhatsApp)
  • Link to migrated users (global_phone_id)
  • Tests with sample data
BE-M11-004 16H Medium

Booking History Migration (If Needed)

  • Analyze if booking history should be migrated
  • If yes, create: `php artisan migrate:bookings`
  • Transform old booking records
  • Link to migrated customers
  • Link to services (map old service IDs to new)
  • Tests with sample data
BE-M11-005 12H Medium

Service & Package Data Migration

  • Create: `php artisan migrate:services`
  • Migrate service definitions
  • Migrate pricing information
  • Migrate package definitions
  • Tests with sample data
BE-M11-006 16H High

Data Validation & Quality Check

  • Create validation scripts
  • Check data integrity:
  • - All users have global_id
  • - All phones have global_phone_id
  • - Foreign keys valid
  • - No orphaned records
  • Generate validation report
  • Fix identified issues
  • Deliverable: Validation report
  • Phase 2: Advanced Features

    Loyalty, Passport, and Packages Systems

    Package 2.1: Loyalty System

    80H
    Milestone: M13 Total Tasks: 7
    BE-M13-001 10H Medium

    Loyalty Database Schema & Models

    • Create loyalty_tiers table (main DB)
    • Create loyalty_points_transactions table (sub-app DB)
    • Create points_earning_rules table (main DB)
    • Create points_redemption_options table (main DB)
    • Create LoyaltyTier, PointsTransaction, EarningRule models
    • Tests for relationships
    BE-M13-002 16H High

    Points Calculation Engine

    • Implement PointsCalculationService
    • Rules:
    • - 1 point per 1 JOD spent on laser services
    • - 2 points per 1 JOD spent on high-margin services (cross-sell)
    • - Bonus points for completing packages
    • - Bonus points for referrals
    • - Bonus points for social sharing
    • Automatic point crediting after payment
    • Activity logging
    • Tests for all earning scenarios
    BE-M13-003 10H Medium

    Points History & Balance APIs

    • GET /api/v1/loyalty/points/balance
    • GET /api/v1/loyalty/points/history (earned/spent)
    • Filter by date range
    • Pagination
    • Tests for points queries
    BE-M13-004 14H High

    Tier System & Progression

    • Define tier thresholds:
    • - Insider: 0-749 points
    • - Ambassador: 750-1999 points
    • - Royal: 2000+ points
    • GET /api/v1/loyalty/tiers (list all tiers)
    • GET /api/v1/loyalty/tiers/my-progress
    • Auto-upgrade users when reaching threshold
    • Notification on tier upgrade
    • Tier benefits management
    • Tests for tier progression
    BE-M13-005 16H High

    Points Redemption System

    • GET /api/v1/loyalty/redemption-options (what can be redeemed)
    • POST /api/v1/loyalty/redeem endpoint
    • Redemption types:
    • - Discount on next booking
    • - Free service
    • - Passport benefit (Phase 2)
    • Validate sufficient points
    • Deduct points
    • Create redemption record
    • Activity logging
    • Tests for redemption scenarios
    BE-M13-006 10H Medium

    Points Expiration Management

    • Points expiry policy: Expire if no activity for 6 months
    • Scheduled job to expire points
    • Warning notifications before expiry
    • GET /api/v1/loyalty/points/expiring-soon
    • Tests for expiration logic
    BE-M13-007 4H Medium

    Manual Points Adjustment (Admin)

    • POST /api/v1/admin/customers/{id}/points/adjust (add/deduct points manually)
    • Reason required
    • Activity logging
    • Tests for manual adjustments

Team Structure & Resource Allocation

Backend Team (From Official Budget & WBS)

Package 2.2: Passport System

60H
Milestone: M14 Total Tasks: 5
BE-M14-001 16H High

Partner Management System

  • Create partners table (main DB)
  • Create partner_categories table (main DB)
  • Create partner_benefits table (main DB)
  • Create Partner, PartnerCategory models
  • GET /api/v1/admin/partners
  • POST /api/v1/admin/partners (create partner)
  • PUT /api/v1/admin/partners/{id}
  • DELETE /api/v1/admin/partners/{id}
  • Partner contract management
  • Tests for partner management
BE-M14-002 10H Medium

Partner Categories & Benefits

  • Define partner categories (Dining, Fitness, Fashion, Entertainment)
  • GET /api/v1/passport/partners (list for customers)
  • GET /api/v1/passport/partners/category/{id}
  • GET /api/v1/passport/partners/{id} (partner detail)
  • Filter by location, category
  • Cache partner list
  • Tests for partner queries
BE-M14-003 18H High

Benefit Activation & QR Code System

  • Create passport_benefit_activations table
  • POST /api/v1/passport/partners/{id}/activate endpoint
  • Generate time-limited QR code (5-minute expiry)
  • QR code contains: user_id, partner_id, benefit_id, timestamp, signature
  • POST /api/v1/passport/partners/verify-qr (partner validates QR)
  • Mark benefit as used
  • Limit: 1 use per month per partner (configurable)
  • Activity logging
  • Tests for QR generation and validation
BE-M14-004 10H Medium

Passport Usage Tracking & Analytics

  • GET /api/v1/passport/my-activity (customer's usage history)
  • GET /api/v1/admin/passport/analytics (admin dashboard)
  • Partner-specific analytics
  • Most popular partners
  • Usage trends
  • Tests for analytics queries
BE-M14-005 6H Medium

Partner PromoCode System

  • Partners can have unique PromoCode for Golden Opportunities
  • POST /api/v1/admin/partners/{id}/promo-code (assign code to partner)
  • Partners can give this code to their VIP customers
  • Usage tracking per partner's code
  • Tests for partner promo codes

Package 2.3: Packages System

100H
Milestone: M13 Total Tasks: 8
BE-M13-008 12H Medium

Packages Database Schema

  • Create packages table (sub-app DB)
  • Create package_services table (package includes multiple services)
  • Create customer_packages table (purchased packages)
  • Create customer_package_sessions table (session tracking)
  • Create Package, CustomerPackage models
  • Relationships setup
  • Tests for relationships
BE-M13-009 16H High

Package Configuration APIs (Admin)

  • GET /api/v1/admin/packages
  • POST /api/v1/admin/packages (create package)
  • PUT /api/v1/admin/packages/{id}
  • DELETE /api/v1/admin/packages/{id}
  • Package includes:
  • - Name, description
  • - Services (multiple)
  • - Sessions per service
  • - Total price
  • - Validity period
  • - Payment plans (full/installments)
  • Tests for package management
BE-M13-010 20H High

Package Purchase & Payment Plans

  • GET /api/v1/packages/available (list for customers)
  • GET /api/v1/packages/{id} (package detail)
  • POST /api/v1/packages/{id}/purchase
  • Support payment plans:
  • - Full payment upfront
  • - Installments (3, 6, 12 months)
  • Create customer_package record
  • Payment processing
  • Activity logging
  • Tests for package purchase
BE-M13-011 16H High

Package Session Tracking & Usage

  • GET /api/v1/packages/my-packages (customer's active packages)
  • GET /api/v1/packages/{id}/details (sessions remaining, used, total)
  • GET /api/v1/packages/{id}/usage-history
  • Deduct session when booking with package
  • POST /api/v1/bookings/create-with-package
  • Prevent booking if no sessions remaining
  • Tests for session tracking
BE-M13-012 12H Medium

Package Freezing System

  • Create package_freezes table
  • POST /api/v1/packages/{id}/freeze (freeze package, pause expiry)
  • Freeze policy: Max 2 weeks per freeze, max 2 freezes per package
  • DELETE /api/v1/packages/{id}/freeze/{freezeId} (end freeze)
  • GET /api/v1/packages/{id}/freezes (freeze history)
  • Adjust expiry date after unfreeze
  • Tests for freezing logic
BE-M13-013 14H Medium

Package Transfer System

    \n

    Phase 3: KODA AI Features

    AI-Powered Intelligence, Social Media, Voice, and Real-Time Integration

    \n

    Package 3.1: KODA AI - Foundation

    200H
    Milestone: M18 Total Tasks: 8
    BE-M18-001 16H High

    KODA AI Application Setup

    • Create new Laravel application (KODA AI)
    • Separate from KODA Backend (different codebase)
    • Connect to KODA Backend database (read-only)
    • Setup Google AI Studio SDK
    • Environment configuration
    • Basic API structure
    • Tests setup
    BE-M18-002 20H High

    Google AI Studio Integration

    • Integrate Google AI Studio (Gemini) SDK
    • Configure API keys
    • Implement AI request service
    • Rate limiting
    • Error handling
    • Retry logic
    • Cost tracking
    • Tests with AI SDK (mocked)
    BE-M18-003 32H High

    AI Knowledge Base System

    • Create knowledge_base_documents table
    • Document upload system (PDF, DOCX, TXT)
    • Text extraction from documents
    • Vector embeddings generation (via Google AI)
    • Vector storage (PostgreSQL with pgvector or separate vector DB)
    • Semantic search functionality
    • GET /api/v1/ai/knowledge-base/documents
    • POST /api/v1/ai/knowledge-base/documents/upload
    • DELETE /api/v1/ai/knowledge-base/documents/{id}
    • Tests for knowledge base
    BE-M18-004 28H High

    Retrieval-Augmented Generation (RAG)

    • Implement RAG system
    • Query → Vector search → Retrieve relevant documents → Include in AI prompt
    • Improve AI accuracy with KODA-specific knowledge
    • Context window management
    • Tests for RAG
    BE-M18-005 40H High

    AI Report Generation

    • POST /api/v1/ai/reports/generate endpoint
    • Report types:
    • 1. Monthly business summary
    • 2. Customer behavior analysis
    • 3. Service performance analysis
    • 4. Revenue trends with insights
    • 5. Predictive analytics (churn risk, etc.)
    • Query KODA Backend database
    • Analyze data with AI
    • Generate narrative report (natural language)
    • Export to PDF
    • Chart generation (optional)
    • Tests for report generation
    BE-M18-006 24H Medium

    AI Admin Dashboard

    • GET /api/v1/ai/dashboard/stats
    • Conversation logs (count, types)
    • Response accuracy metrics
    • Handoff rate (AI → human)
    • Customer satisfaction scores
    • Cost tracking (API usage)
    • GET /api/v1/ai/conversations (list conversations)
    • GET /api/v1/ai/conversations/{id} (conversation detail)
    • Tests for dashboard
    BE-M18-007 16H Medium

    AI Settings & Configuration

    • GET /api/v1/ai/settings
    • PUT /api/v1/ai/settings
    • Configurable settings:
    • - AI model selection (Gemini models)
    • - Temperature (creativity level)
    • - Max tokens
    • - Response tone (formal, friendly, etc.)
    • - Language preference
    • - Handoff triggers (when to escalate to human)
    • Tests for settings management
    BE-M18-008 24H High

    AI API for Other KODA Apps

    • RESTful API to expose AI capabilities
    • POST /api/v1/ai/chat (chat with AI)
    • POST /api/v1/ai/analyze (analyze text/data)
    • POST /api/v1/ai/recommend (get AI recommendations)
    • Authentication (API key from main system)
    • Rate limiting
    • API documentation (OpenAPI)
    • Tests for AI API
  • POST /api/v1/admin/packages/{id}/transfer (transfer package to another customer)
  • Validation: Both customers must exist, consent required
  • Transfer all remaining sessions
  • Update ownership
  • Activity logging for both customers
  • Tests for transfer
BE-M13-014 10H Medium

Package 3.2: KODA AI - Social Media Integration

200H
Milestone: M19 Total Tasks: 9
BE-M19-001 32H High

WhatsApp Business API Integration

  • Integrate WhatsApp Business API (official or provider like Twilio)
  • Webhook setup (receive messages)
  • POST webhook endpoint: /api/v1/ai/whatsapp/webhook
  • Message validation
  • Message parsing
  • Send message API
  • Media handling (images, documents)
  • Conversation threading
  • Tests with WhatsApp API (mocked)
BE-M19-002 28H High

WhatsApp AI Responder

  • Natural language understanding for WhatsApp messages
  • Intent detection:
  • - Booking inquiry
  • - Service information request
  • - Pricing question
  • - General question
  • - Complaint/issue
  • Auto-response generation (using AI)
  • Handoff logic (escalate to human if complex/urgent)
  • Conversation state management
  • Tests for intent detection and responses
BE-M19-003 24H Medium

Instagram API Integration

  • Integrate Instagram API (Graph API)
  • Webhook setup for DMs and comments
  • POST /api/v1/ai/instagram/webhook
  • Message parsing
  • Send DM API
  • Comment reply API
  • Tests with Instagram API (mocked)
BE-M19-004 24H Medium

Instagram AI Responder

  • Intent detection for Instagram messages/comments
  • Auto-response generation
  • Handoff logic
  • Conversation management
  • Tests for Instagram AI
BE-M19-005 24H Medium

Facebook Messenger Integration

  • Integrate Facebook Messenger API
  • Webhook setup
  • POST /api/v1/ai/facebook/webhook
  • Message parsing
  • Send message API
  • Tests with Facebook API (mocked)
BE-M19-006 24H Medium

Facebook AI Responder

  • Intent detection for Facebook Messenger
  • Auto-response generation
  • Handoff logic
  • Conversation management
  • Page comments monitoring (optional)
  • Tests for Facebook AI
BE-M19-007 20H Medium

Conversation Logs & Analytics

  • Create conversations table (all channels)
  • Store full conversation history
  • GET /api/v1/ai/conversations (admin view)
  • Analytics:
  • - Response time
  • - Resolution rate
  • - Handoff rate
  • - Customer satisfaction (if feedback collected)
  • - Most common intents
  • Tests for conversation logging
BE-M19-008 16H Medium

Lead Capture from Social Media

  • Identify potential leads from conversations
  • Extract contact information (phone, name)
  • POST /api/v1/ai/leads/capture
  • Store in KODA Backend CRM
  • Assign to sales rep
  • Notification to sales team
  • Tests for lead capture
BE-M19-009 8H Medium

Handoff to Human Agent System

  • Implement handoff triggers:
  • - Customer explicitly requests human
  • - AI confidence low
  • - Complex/sensitive issue
  • - VIP customer
  • Notification to human agent (via KODA CORE)
  • Conversation transfer
  • Tests for handoff logic

Package Expiry & Notifications

  • Scheduled job to check expiring packages
  • Send notifications 30 days, 7 days, 1 day before expiry
  • Auto-expire packages
  • GET /api/v1/packages/expiring-soon
  • Tests for expiry logic

Package 3.3: KODA AI - Voice Integration

160H
Milestone: M20 Total Tasks: 8
BE-M20-001 32H High

SIP Protocol Integration

  • Integrate SIP client library (PHP)
  • Connect to SIP server/provider
  • Handle incoming calls
  • Handle outgoing calls
  • Call state management (ringing, answered, ended)
  • Tests for SIP integration (with provider mocking)
BE-M20-002 24H High

Speech-to-Text Integration (Google AI)

  • Integrate Google Speech-to-Text API
  • Receive audio stream from call
  • Convert speech to text (real-time or batch)
  • Support Arabic and English
  • Streaming vs file-based transcription
  • Tests for speech-to-text
BE-M20-003 20H Medium

Voice Intent Detection

  • Analyze transcribed text with AI
  • Intent detection (same intents as chat)
  • Context extraction (customer name, service requested, etc.)
  • Generate appropriate response
  • Tests for voice intent detection
BE-M20-004 24H High

Text-to-Speech Integration (Google AI)

  • Integrate Google Text-to-Speech API
  • Convert AI response text to speech audio
  • Support Arabic and English voices
  • Natural-sounding voice selection
  • Streaming audio back to call
  • Tests for text-to-speech
BE-M20-005 28H High

Call Flow Management

  • Implement conversational call flow
  • IVR menu (initial greeting, options)
  • Multi-turn conversation handling
  • Interrupt handling (customer speaks while AI speaking)
  • Silence detection (prompt customer to speak)
  • Call routing:
  • - AI handles simple queries
  • - Transfer to human for complex issues
  • Tests for call flows
BE-M20-006 16H Medium

Call Recording & Transcription Storage

  • Record all calls (audio)
  • Store recordings
  • Store full transcriptions
  • Link to customer record
  • GET /api/v1/ai/calls/{id}/recording
  • GET /api/v1/ai/calls/{id}/transcript
  • Privacy compliance (customer consent)
  • Tests for call recording
BE-M20-007 12H Medium

Call Analytics & Reporting

  • GET /api/v1/ai/calls/analytics
  • Metrics:
  • - Total calls handled by AI
  • - Average call duration
  • - Resolution rate
  • - Transfer rate (AI → human)
  • - Customer satisfaction (if collected)
  • - Most common call reasons
  • Tests for call analytics
BE-M20-008 4H High

Emergency Call Handling

  • Detect emergency keywords
  • Immediate transfer to human
  • Priority escalation
  • Tests for emergency detection
Team Member Duration Total Hours Monthly Cost Total Cost
Backend Lead (Senior) 8.4 months 1,608h (60% of 2,680h) 2,200 JOD 18,480 JOD
Backend Developer (Mid-level) 8.4 months 1,072h (40% of 2,680h) 1,400 JOD 11,760 JOD
Backend Team Total 8.4 months 2,680 hours 3,600 JOD/mo 30,240 JOD

Note: These 150 backend tasks (2,680 hours) will be completed by the 2-person backend team working in parallel over 8.4 months.

Work Distribution by Phase

Phase Duration Backend Lead Backend Dev Total Hours Phase Cost
Phase 1 4 months 1,128h 752h 1,880h 14,400 JOD
Phase 2 2 months 144h 96h 240h 7,200 JOD
Phase 3 2.4 months 336h 224h 560h 8,640 JOD
TOTAL 8.4 months 1,608h 1,072h 2,680h 30,240 JOD

Task Assignment Strategy

Recommended Task Distribution

Backend Lead (Senior - 60% workload):

  • Multi-tenant architecture & core setup
  • Complex authentication systems
  • Payment gateway integrations
  • Booking availability engine
  • KODA AI engine development
  • Code reviews & architecture decisions

Backend Developer (Mid-level - 40% workload):

  • User management APIs
  • Services catalog APIs
  • Notifications system
  • Staff & HR basic APIs
  • Data migration scripts
  • Testing & documentation

Critical Path Tasks

Critical Dependencies

The following tasks must be completed in sequence (cannot be parallelized):

  1. BE-M3-001 → BE-M3-002 → BE-M3-003 (Foundation - blocks ALL subsequent backend work)
  2. BE-M6-008 (Availability Engine - blocks booking features)
  3. BE-M6-016 (Payment Gateway - blocks payment features)
  4. BE-M11-001 → BE-M11-002 (Data Migration - blocks production launch)

Parallelization Strategy: Once foundation tasks complete, both developers work on different modules simultaneously to achieve 8.4-month timeline instead of 16+ months sequential.

Back to Index Next: ReactJS Developer Tasks