|
1 | | -# STILL IN PROGRESS |
| 1 | +# 🗂️ Employee Data Management App - Node.js CLI Based |
| 2 | + |
| 3 | +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. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 📌 Project Description |
| 8 | + |
| 9 | +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: |
| 10 | + |
| 11 | +- How to structure CLI apps in Node.js |
| 12 | +- How to manage text-file-based data without a database |
| 13 | +- How to modularize code and separate logic |
| 14 | +- How to mimic real-world HR-like data operations |
| 15 | + |
| 16 | +--- |
| 17 | + |
| 18 | +## 🧬 Origin & Reference |
| 19 | + |
| 20 | +This Node.js project is a **refactored and modernized version** of my previous C++ project: |
| 21 | + |
| 22 | +### 🔁 Rewritten From: |
| 23 | +- [Project-Algoritma-Pemrograman](https://github.com/Nekonepan/College/tree/main/C%2B%2B/Project-Algoritma-Pemrograman) |
| 24 | + |
| 25 | +### 🎯 Enhancements Compared to C++ version: |
| 26 | +| Feature | C++ Version | Node.js Version | |
| 27 | +|-------------------------------|-------------------------------|----------------------------------| |
| 28 | +| Save to File | ✅ TXT | ✅ TXT | |
| 29 | +| Employee Input | ✅ Manual | ✅ Multi-input | |
| 30 | +| ID / Name Search | ✅ (Just ID) | ✅ ID & Name | |
| 31 | +| Edit Data | ❌ None | ✅ Yes | |
| 32 | +| Sort Data | ✅ Yes (Without Saving Data) | ✅ With Saving Data | |
| 33 | +| Table View | ✅ Fixed | ✅ Flexible with console.table() | |
| 34 | +| Input Validation | ❌ Limited | ✅ Interactive | |
| 35 | +| Backup / Log | ❌ None | ✅ Yes (Folder `logs/`) | |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +## 🚀 How to Run the Project |
| 40 | + |
| 41 | +### 1. **Clone this repository** |
| 42 | +``` |
| 43 | +git clone https://github.com/Nekonepan/Employee-Data-Application-Project-JavaScript-based-node.js-.git |
| 44 | +cd Employee-Data-Application-Project-JavaScript-based-node.js- |
| 45 | +``` |
| 46 | +### 2. **Install dependencies** |
| 47 | +``` |
| 48 | +npm install |
| 49 | +``` |
| 50 | +### 3. **Run the app** |
| 51 | +``` |
| 52 | +node main.js |
| 53 | +``` |
| 54 | +> 📌 You'll be guided through an interactive menu system. |
| 55 | + |
| 56 | +--- |
| 57 | + |
| 58 | +## ⚙️ Setup Requirements |
| 59 | + |
| 60 | +- ✅ Node.js installed (v14+ recommended) |
| 61 | +- ✅ Basic terminal or command prompt |
| 62 | +- ✅ (Optional) Text editor like VS Code |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +## 📂 Folder Structure |
| 67 | + |
| 68 | +``` |
| 69 | +├── main.js # Main application logic |
| 70 | +├── data-karyawan.txt # Primary employee data file |
| 71 | +├── backup/ # Folder for backups |
| 72 | +├── logs/ # Log of deleted or modified data |
| 73 | +├── package.json # Metadata and dependencies |
| 74 | +└── node_modules/ # Installed dependencies |
| 75 | +``` |
| 76 | + |
| 77 | +--- |
| 78 | + |
| 79 | +## ✅ Features Implemented |
| 80 | + |
| 81 | +| Feature | Status | |
| 82 | +| ----------------------------------|----------| |
| 83 | +| Input multiple data entries | ✅ | |
| 84 | +| Edit data with confirmation | ✅ | |
| 85 | +| Search by ID or Name | ✅ | |
| 86 | +| Sort (ascending/descending by ID) | ✅ | |
| 87 | +| Validasi field kosong & format | ✅ | |
| 88 | +| Konfirmasi sebelum simpan | ✅ | |
| 89 | +| Modular functions per feature | ✅ | |
| 90 | +| File backup & logging | ✅ | |
| 91 | + |
| 92 | +--- |
| 93 | + |
| 94 | +## ⚙️ How the App Works |
| 95 | + |
| 96 | +Here’s a simplified breakdown of the logic flow behind the app: |
| 97 | + |
| 98 | +1. 📂 **Program loads existing employee data** from `data-karyawan.txt` at startup. |
| 99 | +2. 📜 A **main menu** is displayed using `inquirer`, with options like View, Add, Search, Edit, Sort, and Exit. |
| 100 | +3. 📥 When adding data: |
| 101 | + - User is asked how many records to add |
| 102 | + - Each input is validated (non-empty, phone format, unique ID) |
| 103 | + - Data is optionally saved after confirmation |
| 104 | +4. 🔍 When searching: |
| 105 | + - User can search by ID or Name (case-insensitive, partial match supported) |
| 106 | +5. ✏️ When editing: |
| 107 | + - User selects the data to edit |
| 108 | + - Empty inputs are ignored (retain original value) |
| 109 | + - Confirmation is required before saving |
| 110 | +6. 🔃 When sorting: |
| 111 | + - User can choose Ascending or Descending by ID |
| 112 | + - Sorted result can be saved or discarded |
| 113 | +7. 📁 Data is stored persistently in text format with `|` separators |
| 114 | + |
| 115 | +The application runs in a loop until the user chooses to exit. |
| 116 | + |
| 117 | +--- |
| 118 | + |
| 119 | +## 📝 Data Format |
| 120 | + |
| 121 | +Data is stored in the `data-karyawan.txt` file with the format: |
| 122 | +``` |
| 123 | +ID|NAMA|JABATAN|TELP |
| 124 | +``` |
| 125 | + |
| 126 | +Example: |
| 127 | +``` |
| 128 | +A123|Nekonepan|Manager|081234567890 |
| 129 | +B321|Lutfan Alaudin|HRD|080987654321 |
| 130 | +``` |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +## 📊 Summary & Takeaways |
| 135 | + |
| 136 | +- 🔧 Implementing modular practices in JavaScript CLI |
| 137 | +- 💾 Simulating a CRUD system without a database |
| 138 | +- 🧠 Focusing on algorithmic logic, not UI |
| 139 | +- 🧰 Migrating from procedural C++ to modular JavaScript |
| 140 | +- ✅ Finished with clean documentation and structure |
| 141 | + |
| 142 | +--- |
| 143 | + |
| 144 | +## 🌱 Potential Future Enhancements |
| 145 | + |
| 146 | +| Development Ideas | Status | |
| 147 | +|-----------------------------------------|---------| |
| 148 | +| 🔒 Login & user access rights | ⏺️ ToDo | |
| 149 | +| 🧾 Export data to CSV or JSON | ⏺️ ToDo | |
| 150 | +| 🌐 Migrate to Express + MongoDB API | ⏺️ ToDo | |
| 151 | +| 📦 Create CLI global package via `npm` | ⏺️ ToDo | |
| 152 | +| 🧪 Unit testing (Jest) | ⏺️ ToDo | |
| 153 | + |
| 154 | +--- |
| 155 | + |
| 156 | +## 🙋 Author's Note |
| 157 | + |
| 158 | +This project is currently marked as complete but may receive further updates. |
| 159 | +Feel free to fork, remix, or use it for your own learning. |
| 160 | + |
| 161 | +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: |
| 162 | +- [data-karyawan-alpro.cpp](https://github.com/Nekonepan/College/blob/main/C%2B%2B/Project-Algoritma-Pemrograman/Data-Karyawan/data-karyawan-alpro.cpp) |
| 163 | +- [data-karyawan-alpro-array2D.cpp](https://github.com/Nekonepan/College/blob/main/C%2B%2B/Project-Algoritma-Pemrograman/Data-Karyawan-2D/data-karyawan-alpro-array2D.cpp) |
| 164 | + |
| 165 | +--- |
| 166 | + |
| 167 | +## 🙏 Final Words |
| 168 | + |
| 169 | +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. |
| 170 | + |
| 171 | +Whether you're here to learn, improve it, or just curious, thank you for stopping by! |
| 172 | + |
| 173 | +If you like this project or find it useful, feel free to: |
| 174 | + |
| 175 | +- ⭐ Star the repository |
| 176 | +- 🛠️ Fork it and build your own version |
| 177 | +- 📬 Reach out for questions or collaboration |
| 178 | + |
| 179 | +# Happy coding! 💻✨ |
0 commit comments