How hunghero32/datn works
Project type and purpose
• This is a full-stack, multi-tier online booking system for medical appointments.
• Backend is a Laravel-based REST API plus a Blade-based admin portal.
• Frontend is a React single-page application serving both guest (patient) and doctor portals.
• A separate Python “chatbot” microservice provides automated symptom guidance.
• The system supports scheduling, user management, medical records, invoicing, real-time chat, push notifications, and payment integration.
Main components
a. Frontends
• Blade‐based Admin UI (Laravel views under backend/resources/views/admin)
• React SPA (guest & doctor portals in frontend/src/components)
b. Backend API (Laravel)
• HTTP layer: Controllers (app/Http/Controllers/*) separated into Admin, Client API, Doctor API, Auth
• Business logic: Services (app/Services), Repositories (app/Repositories), Events (app/Events)
• Data layer: Eloquent Models (app/Models) and Repositories, Migrations/Seeders (database/)
• Scheduling/Jobs: Artisan scheduler (Console/Commands), jobs table, queue workers
• Real-time: Broadcasting with Pusher (app/Events/MessageSent) and FirebaseService
c. Chatbot service
• Python REST microservice (chatbot/main.py) using training_data.json, exposed on its own port
d. Data stores
• Primary relational database (MySQL/PostgreSQL) for booking data, users, records, etc.
• Queue backend (Redis or database queue) for jobs, notifications
e. External services
• Push notifications (Firebase Cloud Messaging)
• Real-time channels (Pusher)
• Payment gateway API
• Email delivery (Mail services via Laravel Mail/Mailgun, SES, etc.)
Component interactions and data flow
• Users (guest, doctor) access the React SPA (http://localhost:3000) → sends API calls (REST/JSON) to Laravel API (http://localhost:8000/api/…)
• Administrators access the Laravel Blade admin portal (served under backend/public/admin) → interacts with Laravel controllers → database updates
• React SPA subscribes to Pusher channels → receives real-time chat and notification events broadcast by Laravel
• Laravel Scheduler / Artisan commands run periodic tasks (auto-update bookings, send reminders) → dispatch events or queue jobs
• Chat messages from users → Laravel ChatController broadcasts via Pusher → React chat UI
• Chatbot UI component in React calls Python microservice REST endpoint → returns automated responses
• Laravel’s NotificationService and FirebaseService push push‐notifications to mobile/web clients
• All data persistence occurs through Eloquent ORM → migrating via migrations and seeding initial data
Architectural patterns and design principles
• MVC on Laravel backend, layered service‐repository pattern for business logic & data access
• Modular controllers for each user role (Admin/Client/Doctor) and transport mechanism (web vs api)
• Event-driven real-time notifications (Laravel Events → Pusher/Firebase)
• Microservice separation for chatbot logic (Python service)
• SPA on the frontend using React, Redux for state, Axios for API calls
• Cron jobs via Laravel Scheduler for background tasks
• RESTful API design with versioning (client_api.php, doctor_api.php, api.php)