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.

This guide walks you through getting a fully functional local instance of XHealtXperience running from scratch. By the end you will have the central database seeded with a Super Admin account, the dev server running all required processes concurrently, and a browser pointed at the Super Admin panel.
If you just want the fastest possible setup, run composer run setup from the project root. This single command installs all PHP and Node dependencies, copies .env.example to .env, generates the app key, runs the central migrations, and builds frontend assets. You can then jump straight to Step 5 to seed roles and create the Super Admin.

Prerequisites

Before you begin, make sure the following tools are installed on your machine:
  • PHP 8.2 or higher — required by Laravel 12 (composer.json declares "php": "^8.2")
  • Composer — PHP dependency manager
  • Node.js 18+ and npm — for the React/Vite frontend
  • SQLite (default) or MySQL 8 — SQLite is enabled out of the box via the .env.example; no extra database server is needed for local development
1
Clone the repository and install dependencies
2
Clone the project and install both PHP and JavaScript dependencies:
3
git clone https://github.com/Arthurr23/XHealtXperience.git
cd XHealtXperience

composer install
npm install
4
The composer install step will auto-discover all Laravel packages (including stancl/tenancy, spatie/laravel-permission, and pragmarx/google2fa-laravel).
5
Configure the environment file
6
Copy the example environment file and generate a unique application key:
7
cp .env.example .env
php artisan key:generate
8
The default .env.example is pre-configured for SQLite with a database-backed queue and session driver — no additional changes are required to get the platform running locally.
9
# .env defaults that matter most for local dev
APP_URL=http://localhost

DB_CONNECTION=sqlite          # Central database (auto-created at database/database.sqlite)

SESSION_DRIVER=database
QUEUE_CONNECTION=database     # Queue worker is required — see Step 6
10
Tenant databases are stored as separate SQLite files (e.g. database/tenant{uuid}.sqlite) and are created automatically by stancl/tenancy when a new clinic is provisioned through the Super Admin panel.
11
Run the central database migrations
12
Create the SQLite file (if it doesn’t already exist) and run all central migrations:
13
touch database/database.sqlite
php artisan migrate
14
This sets up the central tables: users, tenants, domains, sessions, jobs, cache, and the Spatie Permission tables for the central guard.
15
Run tenant migrations
16
Apply the tenant-specific schema to any tenant databases that may already exist, and confirm the tenant migration path is correctly registered:
17
php artisan tenants:migrate
18
For a fresh install with no tenants yet, this command exits cleanly. It will be useful after you create your first clinic from the Super Admin panel.
19
Seed roles and the Super Admin account
20
Run the central database seeder to create the Super Admin role and the default Super Admin user:
21
php artisan db:seed
22
This executes DatabaseSeeder, which:
23
  • Creates the Super Admin role in the central database.
  • Creates the Super Admin user account with the credentials hardcoded in DatabaseSeeder.php:
  • 24
    Email:    superadmin@xhealthxperience.com
    Password: SuperAdmin2024!
    
    25
    Change these credentials before any production or staging deployment. The default password is committed to the repository and is publicly known. Update DatabaseSeeder.php or override the values directly in the database after seeding.
    26
    To seed roles inside a specific tenant clinic (after creating one via the Super Admin panel), run:
    27
    php artisan tenants:seed --tenants=your-tenant-id
    
    28
    This executes RoleSeeder inside the tenant’s database, creating all tenant roles: Administrador Clinica, Administrador Profesionista, Doctor, Recepcion, Enfermero, Paciente, Auditor, and Practicante Externo.
    29
    Start the development server
    30
    The composer run dev script uses Concurrently to launch all four required processes in a single terminal session with colour-coded output:
    31
    composer run dev
    
    32
    This runs the following four processes simultaneously:
    33
    [server]  php artisan serve                           → HTTP server on http://127.0.0.1:8000
    [queue]   php artisan queue:listen --tries=1 --timeout=0  → Processes async jobs (tenant provisioning, etc.)
    [logs]    php artisan pail --timeout=0               → Live log tail in the terminal
    [vite]    npm run dev                                 → Vite HMR on http://127.0.0.1:5173
    
    34
    The queue worker ([queue]) is not optional. Tenant database creation and other background tasks are dispatched to the queue. Without an active worker, provisioning a new clinic from the Super Admin panel will silently stall.
    35
    Open the Super Admin panel
    36
    With all processes running, navigate to the Super Admin login in your browser:
    37
    http://127.0.0.1:8000/login
    
    38
    Log in with the seeded credentials (superadmin@xhealthxperience.com / SuperAdmin2024!). Because 2FA is mandatory, you will be redirected to the 2FA setup screen on your first login. Complete the setup using an authenticator app (TOTP) or e-mail OTP, then proceed to the dashboard:
    39
    http://127.0.0.1:8000/panel-global/dashboard
    
    40
    From here you can create your first clinic, which will automatically provision a new tenant database, apply tenant migrations, and make the clinic accessible at:
    41
    http://127.0.0.1:8000/{tenantId}/login
    

    Available Composer Scripts

    The following scripts are defined in composer.json:
    ScriptWhat it does
    composer run setupFull first-time setup: install deps, copy .env, generate key, migrate, build assets
    composer run devStart all dev processes concurrently (serve, queue, pail, vite)
    composer run testClear config cache and run the PHPUnit test suite

    Next Steps

    Once the platform is running locally, explore these topics:

    Build docs developers (and LLMs) love