# ๐Ÿš€ API Service - Sistem Manajemen Pasien ## ๐Ÿ“‘ Daftar Isi - [โœจ Fitur Utama](#-fitur-utama) - [๐Ÿ—๏ธ Arsitektur](#๏ธ-arsitektur) - [โšก Quick Start](#-quick-start) - [๐Ÿ” Autentikasi](#-autentikasi) - [๐Ÿ“Š API Endpoints](#-api-endpoints) - [๐Ÿ› ๏ธ Development](#๏ธ-development) - [๐Ÿš€ Deployment](#-deployment) - [๐Ÿ“š Dokumentasi](#-dokumentasi) - [๐Ÿšจ Troubleshooting](#-troubleshooting) *** ## โœจ Fitur Utama ### Core Features - **๐Ÿ”’ JWT Authentication** - Sistem autentikasi dengan Keycloak integration - **๐Ÿ‘ฅ Patient Management** - CRUD lengkap untuk data pasien - **๐Ÿ” Dynamic Filtering** - Filter dan pencarian data pasien secara dinamis - **๐Ÿ“Š Advanced Search** - Pencarian dengan multiple fields dan operators - **๐Ÿฅ BPJS Integration** - Integrasi dengan layanan kesehatan BPJS - **๐Ÿฉบ SATUSEHAT Integration** - Integrasi dengan platform kesehatan SATUSEHAT - **๐Ÿ“– API Documentation** - Swagger/OpenAPI yang interaktif ### Developer Experience - **๐Ÿ”ฅ Hot Reload** - Development dengan auto-restart - **๐Ÿณ Docker Ready** - Deployment yang mudah - **โšก Code Generator** - Tools untuk generate handler dan model - **๐Ÿงช Testing Suite** - Unit dan integration tests - **๐Ÿ“Š Health Monitoring** - Monitoring kesehatan aplikasi - **๐Ÿ—„๏ธ Multi Database** - Support PostgreSQL, MySQL, dan MongoDB *** ## ๐Ÿ—๏ธ Arsitektur ### Clean Architecture Layers ``` โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Presentation Layer โ”‚ โ† handlers/, routes/ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Application Layer โ”‚ โ† middleware/, services/ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Domain Layer โ”‚ โ† models/, validation/ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Infrastructure Layer โ”‚ โ† database/, external APIs โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ ``` ### Struktur Project ``` api-service/ โ”œโ”€โ”€ ๐Ÿ“ cmd/ # Entry points aplikasi โ”‚ โ””โ”€โ”€ api/main.go # API server โ”œโ”€โ”€ ๐Ÿ“ internal/ # Core business logic โ”‚ โ”œโ”€โ”€ config/ # Configuration management โ”‚ โ”œโ”€โ”€ database/ # Database connections โ”‚ โ”œโ”€โ”€ handlers/ # HTTP controllers โ”‚ โ”œโ”€โ”€ middleware/ # Auth & validation middleware โ”‚ โ”œโ”€โ”€ models/ # Data structures โ”‚ โ”œโ”€โ”€ routes/ # API routing โ”‚ โ”œโ”€โ”€ services/ # Business logic services โ”‚ โ”‚ โ””โ”€โ”€ auth/ # Auth services โ”‚ โ”œโ”€โ”€ utils/ # Utility functions โ”‚ โ”‚ โ”œโ”€โ”€ filters/ # Dynamic filtering โ”‚ โ”‚ โ””โ”€โ”€ validation/ # Data validation โ”‚ โ””โ”€โ”€ server/ # HTTP server setup โ”œโ”€โ”€ ๐Ÿ“ docs/ # Documentation โ””โ”€โ”€ ๐Ÿ“ examples/ # Example files ``` ### Best Practices 1. **Jangan pernah commit file .env ke repository** 2. **Gunakan environment variables untuk semua data sensitif** 3. **Gunakan secret management tools untuk production** 4. **Rotasi kunci API secara berkala** 5. **Implementasi rate limiting untuk API endpoints** ***