Skip to main content

๐Ÿ’ป NexHealth Local Development Setup Guide

This guide walks you through setting up the complete NexHealth HMS environment locally on Linux or Windows (WSL2).


๐Ÿ“‹ Prerequisitesโ€‹

Ensure the following tools are installed on your machine:

  • PHP: v8.3 with extensions (php-sqlite3, php-mbstring, php-xml, php-curl)
  • Node.js: v20.0+ & npm
  • Composer: v2.x
  • Flutter SDK: v3.x (Optional: For Mobile App Development)
  • Git

โšก 1. Backend Setup (hms-backend)โ€‹

Navigate to the backend directory and follow these steps:

cd hms-backend

# 1. Install Composer dependencies
composer install

# 2. Copy environment file
cp .env.example .env

# 3. Generate Application Key
php artisan key:generate

# 4. Create local SQLite database file
touch database/database.sqlite

# 5. Run database migrations & seed initial demo data
php artisan migrate:fresh --seed

# 6. Start the local API server (runs on http://127.0.0.1:8000)
php artisan serve --port=8000

:::tip Default Seeded Test Users

  • Super Admin: admin@hms.com | Password: Admin@123
  • Hospital Admin: info@medappdynamics.com | Password: Admin@123
  • Nurse Account: nurse@hms.com | Password: Admin@123 :::

๐Ÿ’ป 2. Frontend Setup (hms-frontend)โ€‹

Open a new terminal window, navigate to the frontend directory, and run:

cd hms-frontend

# 1. Install npm dependencies
npm install

# 2. Copy environment configuration
cp .env.example .env.local

# 3. Start Next.js development server (runs on http://localhost:3000)
npm run dev

Visit http://localhost:3000 in your browser and log in with any of the seeded credentials above!


๐Ÿงช 3. Quality & Test Execution Commandsโ€‹

Run these automated verification commands before pushing code to Git:

# Run PHPStan static analysis on backend
cd hms-backend && vendor/bin/phpstan analyse --memory-limit=1G

# Run PHPUnit backend unit tests
cd hms-backend && vendor/bin/phpunit

# Run ESLint scan on frontend
cd hms-frontend && npm run lint

# Run Vitest unit tests on frontend
cd hms-frontend && npm run test