DEV.co
Open-Source Databases · github

github-ds

GitHub::DS is a collection of Ruby libraries for querying MySQL databases through Rails ActiveRecord. It provides a key-value store, a fluent SQL query builder, and a Result object for error handling—all used in production at GitHub.

Source: GitHub — github.com/github/github-ds
698
GitHub stars
27
Forks
Ruby
Primary language
MIT
License (OSI-approved)

Key facts

Objective fields from the source. Values we can't verify are shown as “Unknown” rather than guessed.

FieldValue
Repositorygithub/github-ds
Ownergithub
Primary languageRuby
LicenseMIT — OSI-approved
Stars698
Forks27
Open issues7
Latest releaseUnknown
Last updated2025-06-11
Sourcehttps://github.com/github/github-ds

What github-ds is

Comprises three components: GitHub::KV (MySQL-backed key-value store with expiration support), GitHub::SQL (parameterized query builder using ActiveRecord connections), and GitHub::Result (monadic error handling). Designed for Rails applications and requires MySQL.

Quickstart

Get the github-ds source

Clone the repository and explore it locally.

terminalbash
git clone https://github.com/github/github-ds.gitcd github-ds# follow the project's README for install & configuration

Need it deployed, integrated, or customized instead? DEV.co ships production installs.

Best use cases

Rails applications needing a simple distributed key-value store

GitHub::KV provides an easy way to add cache-like key-value storage backed by MySQL without introducing a separate cache layer, reducing operational complexity.

Building complex SQL queries with conditional logic

GitHub::SQL's fluent builder and bind-parameter support make it practical to construct queries incrementally based on runtime conditions while maintaining injection safety.

Implementing resilient database operations in Rails

GitHub::Result enables pipeline-style error handling in database code, reducing exceptions and making failure paths explicit and composable.

Implementation considerations

  • Requires MySQL database with root user passwordless access (for local dev/test); Docker Compose setup is provided.
  • Must run Rails migration generator (`rails generate github:ds:active_record`) to create the `key_values` table before use.
  • Table name for KV store is configurable via `GitHub::KV.configure`; plan for multi-tenancy or multiple stores accordingly.
  • KV expiration feature does not auto-purge; schedule external archival jobs to prevent table bloat over time.
  • Result object composition requires familiarity with monadic patterns; team training recommended for consistency.

When to avoid it — and what to weigh

  • You require a general-purpose cache layer — GitHub::KV is MySQL-specific and not a replacement for Redis or Memcached; it trades off speed for durability and simplicity.
  • Your application does not use ActiveRecord or Rails — These libraries are tightly coupled to Rails and ActiveRecord's connection model; they are not suitable for standalone Ruby or non-Rails contexts.
  • You need automatic key expiration with row cleanup — GitHub::KV respects expiration but does not purge expired rows automatically; you must run external tools like pt-archiver for maintenance.
  • Your schema includes case-sensitive key lookups — MySQL's default collation makes GitHub::KV keys case-insensitive; this may not suit applications requiring strict key differentiation.

License & commercial use

MIT License (OSI-approved permissive license). Permits commercial use, modification, and distribution with attribution.

MIT is a permissive OSI license allowing commercial use without restriction. No license-based barriers to production deployment. However, no warranty or liability protection is provided; review company policy on open-source use.

DEV.co evaluation signals

Editorial assessment — not user reviews. Directional, with an explicit confidence level.

SignalAssessment
MaintenanceActive
DocumentationAdequate
License clarityClear
Deployment complexityLow
DEV.co fitGood
Assessment confidenceHigh
Security considerations

Uses ActiveRecord's parameterized bind values, reducing SQL injection risk. KV store keys are case-insensitive due to MySQL collation; verify this does not expose security assumptions. No mention of encryption at rest, audit logging, or access control beyond database permissions. Review threat model for sensitive data storage.

Alternatives to consider

Redis + Kredis (Rails native)

Faster for caching and sessions; simpler operational model for modern Rails apps. Trade-off: external dependency.

Sequel or other query builders

Language-agnostic query builders with similar fluent API; not Rails-specific. Trade-off: less integrated with ActiveRecord ecosystem.

Dry::Monads for Result patterns

Standalone monadic error handling; composable across any Ruby codebase. Trade-off: requires separate adoption for database layer.

Software development agency

Build on github-ds with DEV.co software developers

Review our technical assessment to determine if GitHub::DS fits your caching and query needs, or discuss alternatives for your use case.

Talk to DEV.co

Related open-source tools

Surfaced by semantic similarity across the DEV.co open-source index.

Related on DEV.co

Explore the category and the services that help you build with it.

github-ds FAQ

Is GitHub::DS suitable for high-throughput caching?
No. GitHub::KV is optimized for durability and simplicity, not throughput. Use Redis or Memcached for cache layers with strict latency requirements.
Can I use GitHub::DS with non-Rails apps?
Not without significant refactoring. The libraries depend on Rails and ActiveRecord's connection model.
How do I handle expired keys in GitHub::KV?
KV respects expiration on reads but does not auto-delete rows. Use pt-archiver or similar tools to purge expired rows asynchronously.
What is GitHub::Result used for?
GitHub::Result provides monadic error handling, allowing you to chain database operations without raising exceptions. Failures short-circuit the chain.

Software developers & web developers for hire

Need help beyond evaluating github-ds? DEV.co is a software development agency offering software development services and web development for teams of every size. Our software developers and web developers build custom software, web applications, APIs, and open-source databases integrations — and maintain them long-term.

Evaluate GitHub::DS for your Rails stack

Review our technical assessment to determine if GitHub::DS fits your caching and query needs, or discuss alternatives for your use case.