A Node.js web application for managing employee data stored in an IBM i database.
This repo is used for giving demonstrations and examples of full-stack development with IBM i.
It was first built as part of a modernisation workshop at the IBM i Community Event "BeNeLux 2025" in Tilburg, Netherlands.
- View Employees: Browse all employees in a responsive table
- Search: Search employees by number, first name, or last name
- Add Employee: Create new employee records with comprehensive data fields
- Edit Employee: Update existing employee information
- Delete Employee: Remove employee records with confirmation
- Responsive Design: Bootstrap-based UI with FontAwesome icons
- Backend: Node.js with Express.js
- Templates: Pug (Jade)
- Styling: Bootstrap 5 with FontAwesome icons
- Database: IBM i accessed via Mapepire
- Testing: Jest with Supertest
-
Clone the repository. In a windows command prompt or powershell window run:
git clone https://github.com/FormaServe/f_EMS.git
-
Change into the project directory:
cd f_EMS -
Install dependencies:
npm install
-
Configure environment variables by copying
.env.exampleto.env:cp .env.example .env
-
Update
.envwith your IBM i connection details:MAPEPIRE_SERVER=your-ibmi-server MAPEPIRE_USER=your-username MAPEPIRE_PASSWORD=your-password MAPEPIRE_PORT=8076
Run with automatic reload:
npm run devnpm run dev:debugnpm startThe application will be available at http://localhost:3000
Run the test suite:
npm testThe application manages the EMPLOYEE table.
To create the table, use the following SQL statement on your IBM i system:
call qsys.create_sql_sample('AY_DEMO');Replace AY_DEMO with your target schema if different. (Must be in uppercase!)
This table has the following structure:
| Field | Type | Length | Description |
|-------|------|--------|-------------|
| EMPNO | CHARACTER | 6 | Employee Number (Primary Key) |
| FIRSTNME | VARCHAR | 12 | First Name |
| MIDINIT | CHARACTER | 1 | Middle Initial |
| LASTNAME | VARCHAR | 15 | Last Name |
| WORKDEPT | CHARACTER | 3 | Work Department Code |
| PHONENO | CHARACTER | 4 | Phone Number Extension |
| HIREDATE | DATE | - | Hire Date |
| JOB | CHARACTER | 8 | Job Title/Code |
| EDLEVEL | SMALLINT | 4 | Education Level |
| SEX | CHARACTER | 1 | Gender (M/F) |
| BIRTHDATE | DATE | - | Birth Date |
| SALARY | DECIMAL | 9,2 | Annual Salary |
| BONUS | DECIMAL | 9,2 | Annual Bonus |
| COMM | DECIMAL | 9,2 | Commission |Employee/
├── app.js # Main Express application
├── examples # Workshop examples and testing
├── package.json # Dependencies and scripts
├── routes/ # Route handlers
│ └── employees.js # Employee CRUD routes
├── views/ # Pug templates
│ ├── layout.pug # Base layout
│ ├── index.pug # Employee list
│ ├── error.pug # Error page
│ └── employee/ # Employee-specific views
│ ├── form.pug # Add/Edit form
│ └── view.pug # Employee details
├── public/ # Static assets
│ ├── css/ # Custom styles
│ ├── js/ # Client-side JavaScript
│ └── documentation/ # Application documentation
├── models/ # Data access layer
│ └── employee.js # Employee model
└── tests/ # Unit tests
├── employee.test.js # Model tests
└── routes.test.js # Route testsGET /employees- List all employeesGET /employees/search?q=term- Search employeesGET /employees/new- Show create formGET /employees/:id- View employee detailsGET /employees/:id/edit- Show edit formPOST /employees- Create new employeePOST /employees/:id- Update employeePOST /employees/:id/delete- Delete employee
- Use camelCase for variable names
- Prefer arrow functions over traditional functions
- All database operations should use async/await
- Include proper error handling with try-catch blocks
- Write unit tests for new features
- Follow RESTful conventions for routes
- All documentation to be stored in
public/documentation/
If you find this project helpful, consider buying me a coffee! ☕
Your support helps me continue creating free educational resources and open-source projects for the IBM i community.
This project is licensed under the Apache License 2.0. It covers the entire project, including all source code, documentation, and assets.
© 2025 FormaServe Systems Ltd.
