{"id":21971946,"url":"https://github.com/RozhakXD/MyContact-Backend","last_synced_at":"2025-07-22T17:33:20.662Z","repository":{"id":244726570,"uuid":"816073488","full_name":"RozhakXD/Kontak-Ku","owner":"RozhakXD","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-17T02:00:26.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-18T02:52:22.391Z","etag":null,"topics":["cpp","cpp-programming","tugas-akhir","tugas-besar"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RozhakXD.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-17T01:26:12.000Z","updated_at":"2024-06-17T02:00:28.000Z","dependencies_parsed_at":"2024-06-17T03:03:18.663Z","dependency_job_id":null,"html_url":"https://github.com/RozhakXD/Kontak-Ku","commit_stats":null,"previous_names":["rozhakxd/kontak-ku"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RozhakXD%2FKontak-Ku","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RozhakXD%2FKontak-Ku/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RozhakXD%2FKontak-Ku/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RozhakXD%2FKontak-Ku/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RozhakXD","download_url":"https://codeload.github.com/RozhakXD/Kontak-Ku/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":227150607,"owners_count":17738310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","cpp-programming","tugas-akhir","tugas-besar"],"created_at":"2024-11-29T14:59:54.228Z","updated_at":"2025-07-22T17:33:20.652Z","avatar_url":"https://github.com/RozhakXD.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 MyContact-Backend API: RESTful Powerhouse Built with C++ 🌟\n\n![MyContact - Logo](https://github.com/user-attachments/assets/448a5786-41cb-4d00-a68f-b83467e8470a)\n\n## 📋 Deskripsi Proyek\n\n**MyContact-Backend** adalah sebuah RESTful API untuk manajemen kontak yang dibangun sepenuhnya menggunakan C++. Proyek ini merupakan evolusi dari [aplikasi CLI sederhana](https://raw.githubusercontent.com/RozhakXD/MyContact-Backend/refs/heads/main/Main.cpp) yang sebelumnya dibuat sebagai tugas mata kuliah Struktur Data.\n\nTujuan dari pengembangan ini adalah untuk mentransformasi aplikasi konsol menjadi layanan backend yang kokoh, menerapkan arsitektur perangkat lunak modern (seperti _Repository Pattern_), dan memanfaatkan _toolchain_ C++ profesional (CMake) untuk membangun aplikasi yang scalable dan mudah dikelola.\n\n## ✨ Fitur Utama\n\nAPI ini menyediakan fungsionalitas CRUD (Create, Read, Update, Delete) penuh untuk data kontak, memungkinkan klien eksternal untuk:\n\na. **Menambahkan** kontak baru.  \nb. **Membaca** seluruh daftar kontak.  \nc. **Mencari** kontak berdasarkan ID, nama, atau kategori.  \nd. **Memperbarui** informasi kontak yang sudah ada.  \ne. **Menghapus** kontak dari database.  \n\n## 🏗️ Arsitektur dan Teknologi\n\nProyek ini dibangun dengan fokus pada kode yang bersih dan terstruktur menggunakan prinsip-prinsip Object-Oriented Programming (OOP).\n\n- **Bahasa: C++17**\n- **Web Framework:** **Crow (v1.2.1)** - Sebuah framework micro-web C++ yang ringan dan cepat untuk membangun API.\n- **Database:** **SQLite3** - Sistem database relasional yang disimpan dalam satu file, ideal untuk aplikasi skala kecil hingga menengah.\n- **Database Wrapper:** `sqlite_modern_cpp` - Untuk interaksi yang aman dan modern dengan SQLite.\n- **Build System:** **CMake** - Standar industri untuk mengelola proses build dan dependensi proyek C++.\n- **Arsitektur:**\n  - **Model-View-Controller (MVC) like:** Logika dipisahkan dengan jelas.\n  - **Repository Pattern:** Abstraksi lapisan data yang memisahkan logika bisnis dari interaksi database. `ContactRepository` menjadi satu-satunya gerbang untuk mengakses data.\n\n## 🚀 API Documentation\n\nBerikut adalah dokumentasi lengkap untuk semua _endpoint_ yang tersedia.\n| Method | Endpoint                           | Deskripsi                          | Contoh Body (Request)                                          | Respon Sukses (2xx)                                   | Respon Gagal (4xx/5xx)                     |\n|--------|------------------------------------|------------------------------------|----------------------------------------------------------------|--------------------------------------------------------|--------------------------------------------|\n| POST   | `/contacts`                        | Menambahkan kontak baru            | `{\"name\":\"Nama\", \"phone\":\"+62...\", \"category\":\"#Kategori\"}`     | 201 Created – `{\"message\":\"Contact added\"}`           | 400 Bad Request – 500 Internal Server Error |\n| GET    | `/contacts`                        | Mengambil semua kontak             | -                                                              | 200 OK – `{\"status\":\"success\", \"data\":[...]}`         | -                                          |\n| GET    | `/contacts/{id}`                   | Mengambil kontak berdasarkan ID    | -                                                              | 200 OK – `{\"status\":\"success\", \"data\":{...}}`         | 404 Not Found                             |\n| GET    | `/contacts/search?name=...`        | Mencari kontak berdasarkan nama    | -                                                              | 200 OK – `{\"status\":\"success\", \"data\":[...]}`         | 400 Bad Request                           |\n| GET    | `/contacts/search?category=...`    | Mencari kontak berdasarkan kategori| -                                                              | 200 OK – `{\"status\":\"success\", \"data\":[...]}`         | 400 Bad Request                           |\n| PUT    | `/contacts/{id}`                   | Memperbarui kontak berdasarkan ID  | `{\"name\":\"Nama Baru\", \"phone\":\"+62...\", \"category\":\"#KategoriBaru\"}` | 200 OK – `{\"message\":\"Contact updated\"}`             | 400 Bad Request – 404 Not Found           |\n| DELETE | `/contacts/{id}`                   | Menghapus kontak berdasarkan ID    | -                                                              | 200 OK – `{\"message\":\"Contact deleted\"}`              | 404 Not Found                             |\n\n## 🛠️ Cara Menjalankan Proyek\n\nProyek ini dikembangkan dan diuji pada **WSL (Kali Linux)**.\n\n**1. Prasyarat:**  \nPastikan Anda memiliki `g++`, `cmake`, dan library yang dibutuhkan.\n\n```bash\nsudo apt update\nsudo apt install build-essential cmake libboost-all-dev libsqlite3-dev\n```\n\n**2. Clone Repository:**  \n\n```bash\ngit clone https://github.com/RozhakXD/MyContact-Backend.git\ncd MyContact-Backend\n```\n\n**3. Unduh Dependensi Pihak Ketiga:**  \nProyek ini memerlukan **Crow** dan **sqlite_modern_cpp**. Skrip akan mengunduhnya untuk Anda.\n\n```bash\ncd third_party\ncurl -L https://github.com/CrowCpp/Crow/raw/master/include/crow_all.h -o crow_all.h\ncurl -L https://github.com/SqliteModernCpp/sqlite_modern_cpp/raw/master/hdr/sqlite_modern_cpp.h -o sqlite_modern_cpp.h\ncd ..\n```\n\n**4. Build Proyek:**  \nGunakan CMake untuk meng-generate file build dan kompilasi.\n\n```bash\nmkdir build\ncd build\ncmake ..\nmake\n```\n\n**5. Jalankan Server:**  \nSetelah kompilasi berhasil, jalankan executable-nya.\n\n```bash\n./MyContact\n```\n\nServer akan berjalan di `http://localhost:18080`. Gunakan API Client seperti **Postman** atau **Insomnia** untuk berinteraksi dengan API.\n\n## 📜 Lisensi\n\nProyek ini dilisensikan di bawah [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRozhakXD%2FMyContact-Backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FRozhakXD%2FMyContact-Backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FRozhakXD%2FMyContact-Backend/lists"}