KiviGo Documentation

Welcome to KiviGo, a lightweight, modular key-value store library for Go that provides a unified interface for different backends and encoders.
The name is a play on words: "Kivi" sounds like "key-value" (the core concept of the library) and "Go" refers to the Go programming language. It also playfully evokes the fruit "kiwi" ๐ฅ !
๐ What is KiviGo?โ
KiviGo is designed to simplify key-value storage operations in Go applications by providing:
- Unified Interface: Work with different storage backends using the same API
- Modular Architecture: Each backend is a separate Go module to minimize dependencies
- Pluggable Encoders: Support for JSON, YAML, and custom encoders
- Zero-Boilerplate: Automatic marshalling/unmarshalling of your Go structs
- Testing-Friendly: Built-in mock backend for unit testing
โจ Key Featuresโ
๐ง Multiple Backendsโ
Choose from a variety of storage backends:
- Embedded: BadgerDB, BoltDB (local)
- Distributed: Redis, Consul, etcd
- Cloud: Azure Cosmos DB, DynamoDB
- SQL: MySQL, PostgreSQL
- NoSQL: MongoDB
- In-Memory: Memcached
๐ฆ Modular Dependenciesโ
Each backend is provided as a separate Go module. If you only need Redis, you only get Redis dependencies - keeping your application lightweight.
๐ฏ Simple APIโ
// Store any Go struct
type User struct {
Name string `json:"name"`
Email string `json:"email"`
}
user := User{Name: "John", Email: "john@example.com"}
err := client.Set(ctx, "user:123", user)
// Retrieve it back
var retrievedUser User
err = client.Get(ctx, "user:123", &retrievedUser)
๐งช Testing Made Easyโ
Built-in mock backend for unit testing without external dependencies:
mockKV := &mock.MockKV{Data: map[string][]byte{}}
client, _ := kivigo.New(mockKV)
// Test your code without Redis/Database
๐ฏ Use Casesโ
KiviGo is perfect for:
- Configuration Management: Store and retrieve application settings
- Caching: Implement distributed caching with Redis or local caching with BadgerDB
- Session Storage: Manage user sessions across different backends
- Feature Flags: Store and manage feature toggles
- Distributed Coordination: Use Consul or etcd for service discovery and coordination
- Testing: Write comprehensive unit tests with the mock backend
๐๏ธ Design Philosophyโ
1. Zero-Boilerplate Usageโ
No need to implement custom marshal/unmarshal methods. KiviGo automatically handles serialization using your chosen encoder.
2. Modular Go Packagesโ
Each backend is a separate Go module. This approach allows you to:
- Fetch only the dependencies you need
- Keep your project lightweight
- Avoid version conflicts between different backend dependencies
3. Consistent Interfaceโ
Whether you're using Redis, BadgerDB, or any other backend, the API remains the same:
client.Set(ctx, key, value) // Store
client.Get(ctx, key, &value) // Retrieve
client.Delete(ctx, key) // Remove
client.List(ctx, prefix) // List keys
๐ Getting Startedโ
Ready to start using KiviGo? Check out our Getting Started Guide to set up your first key-value store in minutes.
For backend-specific information, browse our Backends section, or explore Advanced Features for more sophisticated use cases.
๐ Licenseโ
KiviGo is released under the Mozilla Public License 2.0.