A comprehensive leave management system built with Hapi.js, TypeORM, PostgreSQL, and React.
client/- React frontend applicationserver/- Hapi.js backend API
- Node.js (v14 or higher)
- PostgreSQL (v12 or higher)
-
Navigate to the server directory:
cd server -
Install dependencies:
npm install -
Create a
.envfile in the server directory with the following content (adjust as needed):NODE_ENV=development PORT=3001 # Database DB_HOST=localhost DB_PORT=5432 DB_USERNAME=postgres DB_PASSWORD=your_password DB_DATABASE=leave_management # JWT JWT_SECRET=your_jwt_secret_key -
Start the server:
npm run dev
-
Navigate to the client directory:
cd client -
Install dependencies:
npm install -
Create a
.envfile in the client directory with the following content:REACT_APP_API_URL=http://localhost:3001/api -
Start the client:
npm start
The system automatically creates 10 default users with various roles if they don't already exist:
- Email: john.smith@example.com, Password: Admin@123
- Email: sarah.johnson@example.com, Password: Admin@123
- Email: robert.miller@example.com, Password: Manager@123 (Engineering)
- Email: jennifer.davis@example.com, Password: Manager@123 (Marketing)
- Email: susan.clark@example.com, Password: HR@123
- Email: richard.rodriguez@example.com, Password: HR@123
- Email: michael.brown@example.com, Password: Employee@123 (Engineering)
- Email: emily.wilson@example.com, Password: Employee@123 (Engineering)
- Email: david.taylor@example.com, Password: Employee@123 (Marketing)
- Email: lisa.martinez@example.com, Password: Employee@123 (Marketing)
- User management with different roles (Super Admin, Manager, HR, Employee)
- Department and position tracking
- Leave request management
- Leave approval workflows
- Leave balance tracking
- Holiday management
- Dashboard with analytics
npm run dev- Start the server in development modenpm run build- Build the server for productionnpm start- Start the server in production modenpm run ensure:default-users- Ensure default users exist in the databasenpm run migration:generate- Generate a new TypeORM migrationnpm run migration:run- Run pending TypeORM migrationsnpm run migration:revert- Revert the last TypeORM migration
npm start- Start the client in development modenpm run build- Build the client for productionnpm test- Run testsnpm run eject- Eject from Create React App