How juls-33/rbtc-ims works
1. Overall shape
- This is a Laravel 12 “modern monolith”: the backend serves both application logic and the SPA shell, while React 19 handles the interactive UI through Inertia.js.
- There is no separate public API layer; the main boundary is between Laravel controllers/models and the React pages under resources/js.
2. Request entry and composition
- HTTP traffic enters through public/index.php, is routed by routes/web.php and routes/auth.php, and is handled by Laravel controllers in app/Http/Controllers.
- Inertia middleware (app/Http/Middleware/HandleInertiaRequests.php) bridges server-side routing with React page rendering.
3. Core domain areas
- The system centers on patient care and operations: patients, admissions, visits, prescriptions, rooms/room stays, medicine inventory, billing, archives, and staff administration.
- The main domain models live in app/Models, with migrations defining the database schema and foreign-key relationships.
4. Role-based application slices
- The frontend is organized by user role: resources/js/Pages/Admin, Doctor, Nurse, plus shared auth and profile pages.
- Backend access is similarly constrained through middleware such as DoctorMiddleware, NurseMiddleware, CheckAccountStatus, and ForcePasswordChange, so diagrammatically this is a role-gated system rather than a single flat app.
5. Authentication and staff identity
- Authentication is built around the staff table and the auth controllers under app/Http/Controllers/Auth.
- The auth flow supports registration, login, email verification, password reset/confirmation, and a forced password-change path, indicating staff accounts are first-class security principals.
6. Patient workflow
- Patient management spans creation, editing, visiting, admission/discharge, and logging.
- Related backend components include PatientController, AdmissionController, PatientVisitController, PatientLogController, and archive support, while the React side contains modal-driven screens for adding/editing/deleting and viewing patient profiles and logs.
7. Hospital/clinical operations
- Clinical work is split between doctors and nurses, each with dedicated dashboards and patient-facing screens.
- The data flow appears to be: staff opens a role-specific dashboard, views patients, records visits/vitals, creates prescriptions, and stores operational history in visit/log tables.
8. Inventory and medication control
- Medicine inventory is modeled explicitly with catalogs, batches, stock logs, medication logs, and prescription records.
- This suggests a stock-tracked flow: medicine catalog -> batch inventory -> prescription/dispense action -> stock/medication logs, with admin UI components for managing batches and stock ledgers.
9. Billing and invoices
- Billing is split into outpatient and inpatient paths, with separate controllers and bill item models for each.
- Printable invoice rendering is handled by Blade views in resources/views/inpatient_invoice.blade.php and outpatient_invoice.blade.php, so billing combines SPA management screens with server-rendered document output.
10. Persistence model and schema evolution
- The database is MySQL, and the migration history shows continuous evolution of key tables: soft deletes, billing redesigns, added vitals, room stays, monthly rates, and security fields.
- Factories and seeders support realistic test/dev data for patients, rooms, staff, medicine, and inpatient scenarios.
11. Security and searchable data
- The project explicitly uses CipherSweet and Sodium for encrypted/searchable data, which materially affects schema design and runtime requirements.
- The README’s PHP extension requirements matter because encryption/search features depend on those extensions being available.
12. Frontend structure
- React pages live under resources/js/Pages, shared UI widgets under resources/js/Components, and common layouts under resources/js/Layouts.
- The UI is heavily componentized around modals, tables, stats cards, notifications, and form controls, which matches a CRUD-heavy internal system.
13. Operational tooling
- Vite builds the frontend, Tailwind provides styling, and PHPUnit covers backend/auth/profile features.
- GitHub Actions run tests and maintenance workflows, including changelog updates, which indicates the repo is treated as a maintained production application.
14. Key diagram boundaries
- A useful architecture diagram should show: browser/UI → Inertia/Laravel controllers → domain models → MySQL, with a side path for auth/middleware and a separate path for printable invoice generation.
- On the client side, divide the SPA into admin, doctor, nurse, auth, and shared component areas; on the server side, divide into controllers, middleware, models, migrations, and security/encryption support.
Main entry points: DashboardController.php Controllers · 2026_01_09_122923_create_patients_table.php Migrations · app.jsx SPA shell · index.php Entry
Components 19
Client
Browser and React/Inertia frontend
- Browser · Users access the SPA and server-rendered pages here
- SPA shell · Client bootstrap for the Inertia app
resources/js/app.jsx - Role pages · Admin, doctor, and nurse screens
resources/js/Pages/Admin/PatientManagement.jsx - Shared UI · Reusable modals, tables, inputs, and layout primitives
resources/js/Components/Modal.jsx
HTTP App
Laravel entrypoint, routing, controllers, and middleware
- Entry · HTTP bootstrap for all web requests
public/index.php - Web routes · Main application routing for the monolith
routes/web.php - Auth routes · Authentication and verification routes
routes/auth.php - Controllers · Primary application controllers for patient, staff, room, and billing flows
app/Http/Controllers/DashboardController.php - Auth flow · Login, registration, reset, verification, and password controls
app/Http/Controllers/Auth/AuthenticatedSessionController.php - Inertia bridge · Bridges Laravel responses to React page rendering
app/Http/Middleware/HandleInertiaRequests.php - Access guards · Role, account-status, and forced-password-change checks
app/Http/Middleware/DoctorMiddleware.php
Domain
Core patient, inventory, billing, and staff workflows
- Patient ops · Patients, admissions, visits, logs, and archives
app/Models/Patient.php - Inventory · Medicine catalogs, batches, stock logs, and medication logs
app/Models/MedicineCatalog.php - Billing · Outpatient and inpatient billing flows
app/Models/OutpatientBillItem.php - Staff identity · Staff accounts, logs, and identity state
app/Models/Staff.php
Data
Database schema, persistence, and encryption support
- Migrations · Database schema and relationship history
database/migrations/2026_01_09_122923_create_patients_table.php - MySQL · Primary relational datastore
config/database.php - CipherSweet · Encrypted and searchable data support
config/ciphersweet.php
Output
Server-rendered documents
- Invoices · Printable inpatient and outpatient invoice templates
resources/views/inpatient_invoice.blade.php
Connections 23
- Browser → Entry: requests · Browser traffic enters the Laravel front controller
- Entry → Web routes: dispatches · Web requests are routed through the main route table
- Entry → Auth routes: auth dispatch · Authentication requests are routed separately
- Web routes → Controllers: handles · Controllers implement the main application flows
- Auth routes → Auth flow: handles · Auth controllers manage login and account recovery
- Controllers → Access guards: protected by · Role and status middleware gate sensitive actions
- Auth flow → Access guards: checks · Auth lifecycle is constrained by account and password rules
- Controllers → Inertia bridge: renders · Controllers return Inertia responses into the React UI
- Inertia bridge → SPA shell: bootstraps · Inertia hydrates the client entrypoint
- SPA shell → Role pages: loads · Role-specific pages provide the main UI slices
- SPA shell → Shared UI: composes · Shared components and layouts are reused across pages
- Role pages → Controllers: actions · Page interactions submit back to Laravel controllers
- Controllers → Patient ops: orchestrates · Patient admissions, visits, logs, and archives are coordinated server-side
- Controllers → Inventory: orchestrates · Medicine and stock management flows pass through controllers
- Controllers → Billing: orchestrates · Billing and invoice generation are handled in the backend
- Controllers → Staff identity: manages · Staff management and operational history are part of the domain
- Patient ops → Migrations: persisted by · Patient workflow data is defined by schema migrations
- Inventory → Migrations: persisted by · Inventory tables and logs are created and evolved in migrations
- Billing → Migrations: persisted by · Billing tables and redesigns are captured in migrations
- Staff identity → Migrations: persisted by · Staff identity and security fields evolve through migrations
- Migrations → MySQL: applies to · Migrations define the MySQL schema
- Staff identity → CipherSweet: secured by · Encrypted/searchable staff data depends on CipherSweet support
- Billing → Invoices: prints · Billing records can be rendered into Blade invoice documents