How teo-information/sistema_reflexo works
Project Type and Purpose
• This is a full-stack clinic management application (“ReflexoPeru”), split into two main parts:
• Frontend (React + Vite + Ant Design + ApexCharts + Axios)
• Backend (Laravel/PHP API with MVC, Services, Sanctum auth, Mail, Queue, Storage)
• Purpose: enable administrative staff and therapists to manage patients, appointments, histories, payments and generate reports/metrics.
File Structure Highlights
• Top-level:
– /backend → Laravel API (app/, routes/, config/, database/, public/, resources/, tests/)
– /src → React SPA (components/, features/, pages/, routes/, services/, utils/)
– /docs → Markdown guides (architecture, components, hooks, services, routes, styles)
– index.html, package.json, vite.config.js → React/Vite entry
• Backend layering:
– app/Http/Controllers (API & Auth controllers)
– app/Services (business logic per domain)
– app/Models (Eloquent models)
– database/migrations & seeders (schema + dummy data)
– config/ (auth, database, mail, sanctum, permission)
• Frontend modularity:
– src/components (UI primitives)
– src/features (domain modules: appointments, patients, history, etc.)
– src/services/api (Axios configuration + methods)
– src/routes (React Router + protected routes)
– src/utils, src/context (shared logic & state)
a. Main Components
– User’s Browser (SPA UI)
– Frontend SPA (React App)
• UI Components
• Feature Modules (Appointments, Patients, Reports, Staff, Auth, etc.)
• API Service Layer (Axios + Toastify)
– Backend API (Laravel)
• HTTP Layer (Routes → Controllers)
• Business Layer (Services)
• Data Layer (Models → MySQL/PostgreSQL)
• Auth Module (Sanctum tokens, Password reset, Email verification)
• Mail & Queue subsystem
• File Storage (public & private)
– Database (Relational)
– External Services
• SMTP (Mailtrap/SMTP provider)
• File storage or cloud (if used)
b. Relationships and Data Flows
– Browser → React SPA: HTTP(s)
– React SPA → Backend API: Axios calls to /api endpoints, attaching access token
– Backend Controllers delegate to Services → Models → Database
– Auth flows: SPA → /auth endpoints → Sanctum issues tokens → SPA stores token (localStorage)
– Mail flows: Backend triggers Mailables → SMTP service
– Storage: API serves file URLs from storage/app/public
– SPA receives JSON, updates UI components & charts
c. Architectural Patterns
– Frontend: Feature-based folder structure, separation between reusable components vs feature modules, use of React Context for global state, React Router for route protection
– Backend: MVC + Service-layer pattern, Request validation, Resource transformers, Repository-style Eloquent models, Laravel Sanctum for SPA auth, queued Mail jobs, standardized config files
d. Key Technologies & Frameworks
– Frontend: React, Vite, Ant Design, ApexCharts, React Router v7, Axios, Context API, Toastify
– Backend: Laravel 10, PHP 8.x, Eloquent ORM, Sanctum, Mail, Queue, MySQL/Postgres
– Deployment hints: Vercel for SPA (vercel.json), Apache/.htaccess in backend/public