01cloud-store is a Go library that provides a single storage-facing API for platform metadata, workflow records, events, services, and related operational data across Firestore and MongoDB backends.
Applications that need to persist CI/CD workflow data, cluster activity, service records, or environment state often end up tightly coupled to a single database implementation. This package keeps that persistence layer behind a consistent interface so consumers can switch between Firestore and MongoDB with environment-driven configuration.
- Unified
StoreInterfacefor Firestore and MongoDB backends - Domain collections for CI workflows, cluster workflows, events, services, storage, cron jobs, release metadata, and more
fakepackage for tests and local development- Environment-based backend selection
- Apache 2.0 licensed and ready for community contributions
- Go
1.13or later - One configured backend:
- Firestore with access to a Google Cloud project
- MongoDB with a reachable connection URI
go get github.com/berrybytes/01cloud-store@latestThe package loads configuration from environment variables using .env support out of the box. Copy the example file and set values for the backend you want to use.
cp .env.example .envexport STORE_TYPE=firestore
export GCLOUD_PROJECT="your-gcp-project-id"
export GCLOUD_NAMESPACE="your-namespace"export STORE_TYPE=mongo
export MONGO_URL="mongodb://localhost:27017"
export MONGO_DB="cloud_store"package main
import (
"log"
store "github.com/berrybytes/01cloud-store"
)
func main() {
s := store.NewStore()
workflow, err := s.CIWOrkflow().GetWorkflow("example-workflow")
if err != nil {
log.Fatal(err)
}
log.Printf("workflow: %#v", workflow)
}Note: the current public API includes legacy method names such as CIWOrkflow() and ClusterWOrkflow(). They are documented here as-is to reflect the current exported surface.
| Variable | Required | Description |
|---|---|---|
STORE_TYPE |
No | Backend selector: firestore by default, or mongo |
GCLOUD_PROJECT |
Firestore only | Google Cloud project ID used to initialize the Firestore client |
GCLOUD_NAMESPACE |
Firestore only | Namespace or tenant scope used by Firestore queries |
MONGO_URL |
Mongo only | MongoDB connection URI |
MONGO_DB |
Mongo only | MongoDB database name |
See .env.example for a working template.
firestore/: Firestore-backed implementationsmongodb/: MongoDB-backed implementationsfake/: in-memory and fake helpers for testsmodel/: shared domain modelsconstant/: collection names and constants
go test ./...pip install pre-commit
pre-commit install
pre-commit run --all-filesTo run a single hook:
pre-commit run gitleaks --all-files- Contributing guide: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
- Security policy: SECURITY.md
- Changelog: CHANGELOG.md
This project is licensed under the Apache License 2.0. See LICENSE.