How yassirham/amudbank works
Project type and purpose
• This is a full-stack Laravel web application for managing banking operations (accounts, transactions, credits) with three user roles—SuperAdmin, MiniAdmin, and end-user. It provides web UI (Blade templates + JS/CSS), RESTful controllers, background jobs, emails, QR/OTP codes, and integrates with an external Telegram bot and a Python OCR script for document extraction.
File structure
• Top-level directories:
• app/ (MVC controllers, Eloquent models, a TelegramBotService, custom services)
• resources/views (Blade templates organized by role: super-admin, mini-admin, user)
• resources/js/css (frontend assets built by Vite)
• routes/web.php (HTTP routes)
• database/ (migrations, seeders)
• config/ (Laravel configuration for auth, cache, queue, mail, services…)
• storage/ (file storage for uploads, cache, sessions, logs)
• public/ (webroot assets, index.php)
• resources/python/ocr_extract.py (OCR helper script)
• Key patterns:
• MVC (app/Http/Controllers + app/Models)
• Service layer (app/Services)
• Jobs/queues likely used for email and Telegram notifications (config/queue.php)
• Mailables (app/Mail)
• Eloquent ORM for database interactions
README
a. Main components
• Users (SuperAdmin, MiniAdmin, end-user) interact via Web Browser
• Webserver (Nginx/Apache) + PHP-FPM
• Laravel Application (MVC, Services, Jobs)
• Relational Database (MySQL/PostgreSQL)
• Cache/Session Store (Redis or file-based)
• Queue Worker(s) (for email, Telegram notifications, OCR tasks)
• Mail Service (SMTP provider)
• External Telegram API
• OCR Service (Python script, local or containerized)
• File Storage (local disk under storage/app or S3 if configured)
b. Relationships & data flows
1. Browser → HTTP request → Webserver → Laravel route → Controller → Model/Service
2. Controller reads/writes DB (Eloquent) & Cache
3. Controller dispatches Jobs to Queue (e.g., email OTP, Telegram notific.)
4. Queue Worker processes Jobs → Mail Service or Telegram API or spawns OCR script
5. OCR script reads uploaded documents from disk, writes extracted data back to DB via Laravel command or API
6. Laravel responds → Webserver → Browser (HTML/JSON)
c. Architectural patterns/design principles
• MVC separation (Controllers, Views, Models)
• Service layer for external integrations (TelegramBotService)
• Queued background jobs for async tasks (Mailables, notifications, OCR)
• Configuration via Laravel’s config files and .env
• Modular Blade views per role (DRY layouts)
d. Key technologies/frameworks
• PHP 8+, Laravel Framework
• Eloquent ORM
• Blade templating + Vite for asset bundling
• Redis (cache/queue), MySQL
• Laravel Queues (database or Redis driver)
• SMTP mail driver (config/mail.php)
• TelegramBotService (app/Services)
• Python 3 OCR library (resources/python/ocr_extract.py)
Elements
• HTTP request/response flow
• DB queries (read/write)
• Job dispatch → worker → external service
• File I/O for uploads & OCR
• Application (blue)
• Data stores (green)
• External services (orange)
• Users (grey)
Detailed capture of essential elements
• User roles reaching different controllers (SuperAdminController vs MiniAdminController vs UserController)
• OCR service invocation path: file upload → queue job → Python script → DB update
• Mailables sending OTP or profile emails via SMTP