How im-vishesh15th/distri-kv works
DistriKV is a distributed key-value database with a hosted, tenant-isolated service and web console. Users sign up or log in, manage API keys and quotas, then submit key-value operations through the gateway; requests are routed to sharded Raft groups and applied to replicated state machines. The graph preserves the documented consensus, storage, sharding, observability, and fault-analysis capabilities. Backend relationships are mainly documented in the README; unsampled implementation links are marked dashed where their exact call path is not shown.
Main entry points: AuthContext.tsx Session and Auth · App.tsx Web Console · gateway.go Gateway Service · ui Shared UI Components
Components 26
Clients and Console
- Web Console
console/src/App.tsx - Session and Auth
console/src/context/AuthContext.tsx - Tenant Dashboard
console/src/pages/dashboard/DashboardPage.tsx - API Key Management
console/src/pages/keys/KeysPage.tsx - Key Details
console/src/pages/keys/KeyDetailPage.tsx - Admin Tenant Views
console/src/pages/admin/AdminTenantDetailPage.tsx - Usage Views
console/src/pages/usage/UsagePage.tsx - Shared UI Components
console/src/components/ui - Go Client SDK
pkg/client/client.go
Hosted Service
- Gateway Service
internal/gateway/gateway.go - Tenant and Key Control
internal/gateway/control.go - Gateway Persistence
internal/gateway/storage.go - Usage and Metrics
internal/gateway/metrics.go - KV Service API
internal/server/service.go
Sharding and Consensus
- Fixed-Slot Router
internal/shard/shard.go - Multi-Raft Host
internal/multiraft/cluster.go - Raft Consensus
internal/raft/raft.go - gRPC Transport
internal/transport/grpc/real.go
Replicated Storage
- Persistent Raft Log
internal/raftlog/raftlog.go - KV State Machine
internal/kv/sm.go - KV Engine
internal/kv/kv.go
Reliability and Operations
- Fault Simulation
internal/transport/sim/network.go - Linearizability Checker
internal/lincheck/lincheck.go - Operation History
internal/history/history.go - Node Metrics
internal/nodemetrics/nodemetrics.go
Other components
- Tenant / Operator
Connections 33
- Tenant / Operator → Web Console: uses console
console/src/App.tsx - Web Console → Session and Auth: routes through
console/src/App.tsx - Web Console → Tenant Dashboard: routes to
console/src/App.tsx - Web Console → API Key Management: routes to
console/src/App.tsx - Web Console → Key Details: routes to
console/src/App.tsx - Web Console → Admin Tenant Views: routes to
console/src/App.tsx - Tenant Dashboard → Session and Auth: requests API
console/src/pages/dashboard/DashboardPage.tsx - API Key Management → Session and Auth: requests API
console/src/pages/keys/KeysPage.tsx - Key Details → Session and Auth: requests API
console/src/pages/keys/KeyDetailPage.tsx - Usage Views → Session and Auth: requests API
console/src/pages/usage/UsagePage.tsx - Admin Tenant Views → Session and Auth: requests API
console/src/pages/admin/AdminTenantDetailPage.tsx - Tenant Dashboard → Shared UI Components: renders with
console/src/pages/dashboard/DashboardPage.tsx - API Key Management → Shared UI Components: renders with
console/src/pages/keys/KeysPage.tsx - Key Details → Shared UI Components: renders with
console/src/pages/keys/KeyDetailPage.tsx - Admin Tenant Views → Shared UI Components: renders with
console/src/pages/admin/AdminTenantDetailPage.tsx - Usage Views → Shared UI Components: renders with
console/src/pages/usage/UsagePage.tsx - Tenant / Operator → Go Client SDK: submits operations
README.md - Session and Auth → Gateway Service: calls HTTP API
- Go Client SDK → KV Service API: calls KV API
README.md - Gateway Service → Tenant and Key Control: authenticates tenants
- Gateway Service → Gateway Persistence: persists service data
- Gateway Service → Usage and Metrics: records usage
- Gateway Service → KV Service API: forwards KV requests
README.md - KV Service API → Fixed-Slot Router: routes key slots
README.md - Fixed-Slot Router → Multi-Raft Host: selects group
README.md - Multi-Raft Host → Raft Consensus: hosts groups
README.md - Raft Consensus → Persistent Raft Log: persists log
README.md - Raft Consensus → KV State Machine: applies commits
README.md - KV State Machine → KV Engine: executes commands
internal/kv/sm.go - Raft Consensus → gRPC Transport: exchanges messages
- Fault Simulation → gRPC Transport: simulates faults
- Operation History → Linearizability Checker: checks histories
- Multi-Raft Host → Node Metrics: emits metrics