Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Arthurr23/XHealtXperience/llms.txt

Use this file to discover all available pages before exploring further.

XHealtXperience is a production-ready, multi-tenant clinic management platform designed for healthcare organisations that operate one or more independent clinics under a single deployment. Each clinic (tenant) is completely isolated in its own dedicated database, ensuring that patient records, staff accounts, appointments, and audit logs from one clinic can never be accessed by another. The platform is built on Laravel 12 (PHP 8.2+), React 18 with Inertia.js 2, and Tailwind CSS 3, and it ships with mandatory two-factor authentication (TOTP or e-mail OTP) for every user on the system.

Quickstart

Clone the repo, run migrations, seed roles, and have the platform running locally in minutes.

Architecture

Learn how the two-database model, path-based tenancy, and middleware pipeline work together.

Roles & Permissions

Explore every role, what it can do, and how Spatie Laravel Permission enforces access.

Patient Management

Manage patient records, clinical files, uploaded IDs, digital signatures, and service tracking.

What is XHealtXperience?

At its core, XHealtXperience solves the problem of running multiple clinics from a single codebase without ever mixing their data. A central Super Admin creates and manages clinic accounts (tenants). The moment a clinic is provisioned, the platform automatically creates a fresh SQLite (or MySQL) database for it, runs the tenant-specific migrations, and seeds the required roles. From that point on, every HTTP request routed through that clinic’s URL prefix (/{tenantId}/...) operates entirely inside that clinic’s database context.
The platform uses stancl/tenancy v3 with path-based identification (InitializeTenancyByPath). There is no subdomain DNS configuration required for local development — the tenant ID is simply the first path segment of every tenant URL.

Key Concepts

Multi-Tenancy: One Database per Clinic

Every tenant clinic gets its own isolated database. The central database stores only the tenants registry, domain mappings, and the Super Admin account. All clinical data — patients, users, appointments, audit logs — lives exclusively in the tenant database. Databases follow the naming convention tenant{uuid}.sqlite (SQLite) or tenant{uuid} (MySQL).

Subscription Plans & Account Limits

When a Super Admin creates a clinic, they assign a subscription plan. Each plan sets a default maximum number of staff accounts that clinic can create:
PlanDefault Account Limit
basico5
pro20
premium50
personalizadoAdjustable manually
The limit is stored per tenant and can be updated at any time from the Super Admin panel.

Mandatory Two-Factor Authentication

2FA is not optional. Every user — from the Super Admin down to a receptionist — must complete 2FA setup before accessing any protected dashboard. The platform supports:
  • TOTP (Time-based One-Time Password) via an authenticator app, powered by pragmarx/google2fa-laravel and QR code generation with endroid/qr-code.
  • E-mail OTP as an alternative method.
If a user has not yet configured 2FA, they will be redirected to the 2FA setup screen on their first login and will be unable to proceed until setup is complete.

Role-Based Access Control

Permissions are enforced through Spatie Laravel Permission v7. Roles exist at the tenant level (inside each clinic’s database), with the sole exception of Super Admin, which lives in the central database. The roles available in a tenant clinic are:
RoleScope
Super AdminCentral only — manages all clinics and tenant accounts
Administrador ClinicaFull clinic administration: users, services, settings
Administrador ProfesionistaProfessional administrator with delegated clinic management
DoctorPatient care, appointments, surgery scheduling, schedule blocks
RecepcionAppointment booking, patient check-in, surgery confirmation
EnfermeroClinical support, service stage execution
AuditorRead-only access to the audit log and auditor dashboard
PacientePatient-facing access to their own data
Practicante ExternoExternal trainee with limited clinic access
All nine roles above are created by RoleSeeder, which runs automatically during tenant setup via php artisan tenants:seed. The Super Admin role is created separately in the central database by DatabaseSeeder.

Tech Stack

LayerTechnology
BackendLaravel 12, PHP 8.2+
FrontendReact 18, Inertia.js 2, Tailwind CSS 3
Build ToolVite 7 (laravel-vite-plugin, @vitejs/plugin-react)
Multi-Tenancystancl/tenancy 3.10
PermissionsSpatie Laravel Permission 7.2
2FApragmarx/google2fa-laravel 3, endroid/qr-code 6
Auth BridgeLaravel Sanctum 4, Tightenco Ziggy 2
Dev ToolsLaravel Pail, Laravel Pint, Laravel Sail, Concurrently

Central vs. Tenant Routing at a Glance

Route PrefixDatabaseWho Accesses It
/panel-global/*CentralSuper Admin only
/login, /CentralAll unauthenticated users
/{tenantId}/*Tenant DBClinic staff and patients

Build docs developers (and LLMs) love