graph TD
A[Gio Frontend] -->|① dRPC/Protobuf| B[Gin API Server]
B -->|② Cache Check| C[(Redis Cache)]
C -->|③ Miss| D[(PostgreSQL/TimescaleDB)]
D -->|④ Strategy| B
B -->|⑤ Scrape| E[External Cantors]
E -->|⑥ Data| B
B -->|⑦ Store| C
B -->|⑧ Archive| D
B -->|⑨ Response| A
B -->|⑩ Publish| H[NATS JetStream]
subgraph Infrastructure
F[DigitalOcean K8s]
G[DockerHub]
end
style A fill:#b45f00,stroke:#ff8c00,stroke-width:3px,color:#fff
style B fill:#d97706,stroke:#fbbf24,stroke-width:3px,color:#fff
style C fill:#92400e,stroke:#b45f00,stroke-width:2px,color:#fff
style D fill:#92400e,stroke:#b45f00,stroke-width:2px,color:#fff
style E fill:#78350f,stroke:#92400e,stroke-width:2px,color:#fff
style F fill:#0080FF,stroke:#0059b3,stroke-width:2px,color:#fff
style G fill:#2496ED,stroke:#0059b3,stroke-width:2px,color:#fff
style H fill:#3b82f6,stroke:#1d4ed8,stroke-width:2px,color:#fff
| Step | Action | Description |
|---|---|---|
| ① | Request | Frontend → API: dRPC call with Protobuf payload |
| ② | Cache Check | API checks Redis for cached rates (60s TTL) |
| ③ | Cache Result | Hit: Return immediately / Miss: Query database |
| ④ | Get Strategy | Database returns scraping strategy (selectors & logic) |
| ⑤ | Scrape | API executes strategy-specific scraper using Goquery |
| ⑥ | HTML Response | External cantor returns exchange rate data |
| ⑦ | Cache Update | Store fresh data in Redis (60s expiry) |
| ⑧ | Archive | Async save to TimescaleDB (PGX) for historical analysis |
| ⑨ | Response | API → Frontend: Protobuf encoded response via dRPC |
| ⑩ | Publish Event | Async publish to NATS Stream (24h retention) |
| Component | Technology | Purpose |
|---|---|---|
| Frontend | Go + Gio UI | Native cross-platform desktop application |
| API Framework | Gin (Go) | High-performance HTTP/REST API server |
| Communication | dRPC + ProtoBuf | Lightweight Protobuf-based RPC |
| Messaging | NATS JetStream | Event Streaming & Replay |
| Cache | Redis | 60-second TTL for rate limiting and performance |
| Database | TimescaleDB | Time-series optimized PostgreSQL |
| DB Driver | PGX | PostgreSQL Driver and Toolkit for Go |
| Scraping | Goquery | Strategy Pattern for parsing cantor layouts |
| Infrastructure | DigitalOcean + K8s | Scalable Kubernetes-managed hosting |
| Container | Docker + DockerHub | Containerized deployment and registry |
| Observability | DataDog | Infrastructure & Application Monitoring |
Make sure you have installed:
1. Clone the project:
git clone https://github.com/Niutaq/Gix.git
cd Gix2. Install Task (once):
# using Go
go install github.com/go-task/task/v3/cmd/task@latest3. Run using commands