A feature-rich CLI (Command Line Interface) application for managing employee data using JavaScript (Node.js). This app is a rewrite and improvement of my previous project written in C++, with added enhancements like bulk input, interactive editing, real file persistence, and modular design.
This project simulates a basic employee database management system that runs entirely in the terminal. It's designed for learning purposes, suitable for beginner-to-intermediate developers who want to understand:
- How to structure CLI apps in Node.js
- How to manage JSON-file-based data without a database
- How to modularize code and separate logic
- How to mimic real-world HR-like data operations
This Node.js project is a refactored and modernized version of my previous C++ project:
| Feature | C++ Version | Node.js Version |
|---|---|---|
| Save to File | ✅ TXT | ✅ JSON (Array of Objects) |
| Employee Input | ✅ Manual | ✅ Single & Bulk Input |
| ID / Name Search | ✅ Only by ID | ✅ By ID & Name (with list selection) |
| Edit Data | ❌ None | ✅ Full interactive editing |
| Sort Data | ✅ Yes (no persistence) | ✅ With option to save results to file |
| Table View | ✅ Static | ✅ Dynamic with console.table() |
| Input Validation | ❌ Very limited | ✅ Rich & interactive validation |
| Log Deleted Data | ❌ None | ✅ Yes (logs/deleted-logs.json) |
| Backup | ❌ None | ✅ Yes (backup/data-karyawan-backup.json) |
| Restore | ❌ None | ✅ Yes (from backup file with confirmation) |
- ✅ Node.js installed (v14+ recommended)
- ✅ Basic terminal or command prompt
- ✅ (Optional) Text editor like VS Code
git clone https://github.com/Nekonepan/Employee-Data-Application-Project-JavaScript-based-node.js-.git
cd Employee-Data-Application-Project-JavaScript-based-node.js-
npm install
node main.js
📌 You'll be guided through an interactive menu system.
|-- main.js # Main application logic
|-- data/
|-- data-karyawan.json # Primary employee data file
|-- backup/
|-- data-karyawan-backup.json # Backup file
|-- logs/
|-- deleted-logs.json # Log of deleted employee data
|-- package.json # Metadata and dependencies
|-- node_modules/ # Installed dependencies
| Feature | Status |
|---|---|
| Input single & multiple data entries | ✅ |
| Edit data with summary & confirmation | ✅ |
| Search by ID or Name (list selection if duplicate) | ✅ |
| Sort data by ID (ascending/descending, optional save) | ✅ |
| Empty field validation & interactive prompts | ✅ |
| Confirm before save or restore | ✅ |
| Modularized functions per feature | ✅ |
| File backup (JSON) & deleted data logging | ✅ |
Here’s a simplified breakdown of the logic flow behind the app:
- 📂 Program loads existing employee data from
data-karyawan.jsonat startup. - 📜 A main menu is displayed using
inquirer, with options like View, Add, Search, Edit, Sort, Statistics, Backup/Restore, and Exit. - 📥 When adding data:
- User is asked how many records to add (input
0= cancel) - Each input is validated (non-empty, unique ID)
- Data is optionally saved after confirmation
- User is asked how many records to add (input
- 🔍 When searching:
- User can search by ID or Name (case-insensitive, partial match supported)
- If multiple results are found (e.g., duplicate names), a list is displayed to select the correct record
- ✏️ When editing:
- User selects data from search results (by ID or Name)
- Empty inputs are ignored (retain original value)
- A summary table is shown after edit
- Confirmation is required before saving
- 🔃 When sorting:
- User can choose Ascending or Descending by ID
- Sorted result can be saved or discarded
- 📊 Statistics:
- Show total employee count
- Group employees by job position
- Count employees by ID prefix
- 📁 Data is stored persistently in JSON format for easier read/write operations, backups, and logs.
The application runs in a loop until the user chooses to exit.
[
{
"ID": "A123",
"NAMA": "Nekonepan",
"JABATAN": "Manager",
"TELP": "081234567890"
},
{
"ID": "B321",
"NAMA": "Lutfan Alaudin",
"JABATAN": "HRD",
"TELP": "080987654321"
}
]
- Data is structured as an array of objects
- Each object represents one employee record
- This format makes it easier to read, write, backup, and restore data
[
{
"ID": "H739",
"NAMA": "Farhan Wulandari",
"JABATAN": "Supervisor",
"TELP": "08323250265",
"deletedAt": "2025-08-18T10:30:45.123Z"
}
]
- Each deleted record is logged with the same structure as the main data
- An additional field
"deletedAt"records the exact time the deletion occurred
- 🔧 Implemented modular practices in a Node.js CLI application
- 💾 Built a CRUD system without a database, using JSON file persistence
- 🧠 Focused on algorithmic logic and data handling, not UI/Frontend
- 🧰 Migrated from procedural C++ (TXT storage) into modular JavaScript (JSON storage)
- 📁 Added features: backup system and deletion logs with timestamp
- ✅ Finished with clean documentation, maintainable structure, and extensible design
| Development Ideas | Status |
|---|---|
| 🔒 Add login system & user access rights | ⏺️ ToDo |
| 🧾 Export employee data to CSV/Excel | ⏺️ ToDo |
| 🌐 Migrate backend to Express + MongoDB | ⏺️ ToDo |
| 🧪 Add unit testing with Jest | ⏺️ ToDo |
"These are planned features for future versions"
This project is currently marked as complete but may receive further updates. Feel free to fork, remix, or use it for your own learning.
If you want to know what the previous version of C++ looked like before it was refactored into Node.js, you can look at these two files:
This project started as a simple C++ console app and has now evolved into a more modular, maintainable, and interactive CLI application using JavaScript and Node.js. It was built as a personal learning project, but it’s fully functional and easy to expand.
Whether you're here to learn, improve it, or just curious, thank you for stopping by!
If you like this project or find it useful, feel free to:
- ⭐ Star the repository
- 🛠️ Fork it and build your own version
- 📬 Reach out for questions or collaboration