Quick Start Guide
Get up and running with iHospita HMS development environment.
Prerequisites
Before you begin, ensure you have the following installed:
- Node.js >= 18.0
- npm >= 9.0 or pnpm >= 8.0
- Docker and Docker Compose
- Git
Project Structure
ihospita/
├── server/ # NestJS Backend Monorepo
│ ├── apps/
│ │ ├── auth/ # Authentication service
│ │ ├── hms/ # Hospital management service
│ │ ├── crm/ # CRM service
│ │ ├── payment/ # Payment service
│ │ ├── queue/ # Queue service
│ │ ├── report/ # Report service
│ │ └── console/ # Console service
│ └── libs/
│ ├── prisma/ # Database ORM
│ ├── common/ # Shared utilities
│ └── redis/ # Redis integration
├── portal/ # Hospital Portal (React + Vite)
├── console/ # Admin Console (Next.js)
├─ ─ queue/ # Queue Display (Next.js)
├── landing/ # Marketing Website (Next.js)
└── infrastructure/ # Docker, Kong, Keycloak configs
Development Setup
1. Clone the Repository
git clone https://github.com/ihospita/ihospita-hms.git
cd ihospita-hms
2. Start Infrastructure Services
Start the required infrastructure services using Docker Compose:
cd infrastructure
docker-compose up -d postgres redis keycloak kong
This starts:
- PostgreSQL on port 5432
- Redis on port 6379
- Keycloak on port 8080
- Kong on ports 8000 (proxy) and 8001 (admin)
3. Setup Backend
cd server
# Install dependencies
npm install
# Generate Prisma client
npx prisma generate
# Run database migrations
npx prisma migrate dev
# Seed initial data
npx prisma db seed
# Start all services in development mode
npm run dev
4. Setup Portal (Hospital Staff App)
cd portal
# Install dependencies
npm install
# Start development server
npm run dev
The Portal will be available at http://localhost:3000
5. Setup Console (Admin App)
cd console
# Install dependencies
npm install
# Start development server
npm run dev
The Console will be available at http://localhost:3001
Environment Variables
Backend (.env)
# Database
DATABASE_URL="postgresql://postgres:password@localhost:5432/ihospita"
# Redis
REDIS_URL="redis://localhost:6379"
# Keycloak
KEYCLOAK_URL="http://localhost:8080"
KEYCLOAK_REALM="ihospita"
KEYCLOAK_CLIENT_ID="ihospita-api"
KEYCLOAK_CLIENT_SECRET="your-client-secret"
# JWT
JWT_SECRET="your-jwt-secret"
# S3 Storage
S3_ENDPOINT="https://sgp1.digitaloceanspaces.com"
S3_ACCESS_KEY="your-access-key"
S3_SECRET_KEY="your-secret-key"
S3_BUCKET="ihospita-files"
Portal (.env)
VITE_API_URL="http://localhost:8000/api"
VITE_KEYCLOAK_URL="http://localhost:8080"
VITE_KEYCLOAK_REALM="ihospita"
VITE_KEYCLOAK_CLIENT_ID="ihospita-portal"
VITE_HOSPITAL_ID="hospital-uuid"
VITE_HOSPITAL_PREFIX="demo"
Default Credentials
After seeding the database, use these credentials:
| Application | Password | Role | |
|---|---|---|---|
| Console | admin@ihospita.com | Admin123! | Super Admin |
| Portal | owner@demo.hospital.com | Owner123! | Hospital Owner |
| Portal | doctor@demo.hospital.com | Doctor123! | Doctor |
Running Tests
# Backend tests
cd server
npm run test
# E2E tests
npm run test:e2e
# Portal tests
cd portal
npm run test
Building for Production
# Build backend
cd server
npm run build
# Build portal
cd portal
npm run build
# Build console
cd console
npm run build
Docker Deployment
Build and run all services using Docker:
cd infrastructure
docker-compose -f docker-compose.prod.yml up -d
Helpful Commands
# View logs
docker-compose logs -f [service-name]
# Reset database
npx prisma migrate reset
# Open Prisma Studio
npx prisma studio
# Generate API documentation
npm run docs:generate
Next Steps
- Read the Technical Architecture for detailed system design
- Explore the API Reference for endpoint documentation
- Check Infrastructure for deployment configuration