first commit
This commit is contained in:
63
README.md
Normal file
63
README.md
Normal file
@@ -0,0 +1,63 @@
|
||||
# 🧩 Watermill PostgreSQL Template
|
||||
|
||||
Template ini adalah **boilerplate siap pakai** untuk membangun sistem **Publish / Subscribe (Event-driven)** menggunakan [Watermill](https://watermill.io) dan **PostgreSQL** sebagai backend message store.
|
||||
|
||||
Cocok digunakan untuk:
|
||||
- Integrasi antar microservice (event-driven)
|
||||
- Streaming data dari sistem eksternal
|
||||
- Pengganti message broker seperti Kafka/RabbitMQ berbasis PostgreSQL
|
||||
- Middleware antar aplikasi HIS, klaim, billing, atau sistem logistik
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Fitur Utama
|
||||
|
||||
| Fitur | Keterangan |
|
||||
|-------|-------------|
|
||||
| ⚙️ **Watermill v1.3.x stable** | Versi stabil terbaru dengan dukungan PostgreSQL schema & offset adapter |
|
||||
| 🧱 **Auto-create table** | Semua tabel `watermill_<topic>` dan `watermill_offsets_<topic>` dibuat otomatis |
|
||||
| 🔧 **Konfigurasi lewat `.env`** | Semua koneksi & daftar topik diatur lewat environment variable |
|
||||
| 🧰 **Makefile command** | Jalankan, build, atau buat tabel hanya dengan 1 perintah |
|
||||
| 📡 **Contoh Publisher & Subscriber** | Sudah ada implementasi minimal yang langsung jalan |
|
||||
| 🐘 **PostgreSQL ready** | Menggunakan driver `lib/pq` yang kompatibel dengan Watermill-SQL |
|
||||
|
||||
---
|
||||
|
||||
## 📁 Struktur Folder
|
||||
|
||||
├── cmd/
|
||||
│ └── main.go # Entry point aplikasi
|
||||
├── internal/
|
||||
│ ├── config/ # Loader file .env
|
||||
│ ├── db/ # Koneksi ke PostgreSQL
|
||||
│ └── pubsub/ # Implementasi Watermill (publisher, subscriber, table helper)
|
||||
├── .env.example # Contoh konfigurasi environment
|
||||
├── Makefile # Shortcut command
|
||||
├── go.mod # Modul Go
|
||||
├── go.sum # Dependency checksum
|
||||
└── README.md # Dokumentasi
|
||||
|
||||
## ⚙️ Setup Langkah Demi Langkah
|
||||
|
||||
### 1️⃣ Clone Repository & Install Dependency
|
||||
|
||||
```bash
|
||||
git clone https://github.com/yourname/watermill-template.git
|
||||
cd watermill-template
|
||||
go mod tidy
|
||||
|
||||
cp .env.example .env
|
||||
|
||||
# PostgreSQL Connection
|
||||
DB_HOST=localhost
|
||||
DB_PORT=5432
|
||||
DB_USER=postgres
|
||||
DB_PASSWORD=postgres
|
||||
DB_NAME=middleware
|
||||
DB_SSLMODE=disable
|
||||
|
||||
# Watermill Topics (comma separated)
|
||||
WATERMILL_TOPICS=mdw_close_bill,mdw_claim_request,mdw_kd_inacbg,mdw_berkas
|
||||
|
||||
# Logger
|
||||
LOG_DEBUG=false
|
||||
Reference in New Issue
Block a user