DEV.co
Open-Source Databases · upper

db

upper/db is a Go data access layer that abstracts across multiple databases—PostgreSQL, MySQL, CockroachDB, MongoDB, SQLite, and others—with ORM-like query building. It has been actively maintained since 2013 and provides a single interface to work with both SQL and NoSQL data sources.

Source: GitHub — github.com/upper/db
3.7k
GitHub stars
238
Forks
Go
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
Repositoryupper/db
Ownerupper
Primary languageGo
LicenseMIT — OSI-approved
Stars3.7k
Forks238
Open issues165
Latest releasev4.10.0 (2025-03-09)
Last updated2025-12-06
Sourcehttps://github.com/upper/db

What db is

upper/db is a database-agnostic DAL written in Go that provides query builders, model mapping, and transaction support for heterogeneous data sources including relational (PostgreSQL, MySQL, MSSQL, CockroachDB, SQLite) and document (MongoDB) stores. It abstracts database-specific dialects behind a unified interface, reducing boilerplate and vendor lock-in for polyglot persistence patterns.

Quickstart

Get the db source

Clone the repository and explore it locally.

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

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

Best use cases

Multi-database applications

Projects requiring support for multiple database backends (e.g., PostgreSQL in production, SQLite in testing, MongoDB for documents) can use the same DAL interface across data sources.

Rapid API development

REST/GraphQL APIs with CRUD operations benefit from the ORM-like query syntax and automatic schema mapping, reducing manual query writing and model boilerplate.

Distributed system data layers

CockroachDB and multi-region deployments can leverage upper/db's transaction and connection pool abstractions without reimplementing database drivers.

Implementation considerations

  • Verify adapter support for your target databases (PostgreSQL, MySQL, MSSQL, CockroachDB, MongoDB, SQLite); not all features are equally mature across backends.
  • Plan for connection pooling configuration per database—upper/db delegates to underlying drivers, so tune driver settings appropriately.
  • Test transactions and error handling across supported databases; behavior may vary (e.g., MongoDB's transaction support is more limited).
  • Evaluate the ORM-like syntax against your query complexity; fallback to raw SQL may be needed for performance-critical paths.
  • Review the 165 open issues to assess pain points relevant to your use case.

When to avoid it — and what to weigh

  • Complex analytical queries — Data warehouse workloads requiring window functions, CTEs, and query optimization typically need lower-level control or dedicated SQL—upper/db's abstraction may obscure performance tuning.
  • Strongly-typed compiled databases — If your schema is highly normalized and requires compile-time type safety guarantees, alternatives like sqlc or ent may be more appropriate.
  • Established non-Go codebases — upper/db is Go-specific; migration from Java, Python, or Node.js stacks adds operational complexity if not part of a larger Go adoption plan.
  • Expert-level database tuning — Projects where DBA-level control over execution plans, indexes, and query hints is critical may find the abstraction limiting.

License & commercial use

Licensed under the MIT License, which is a permissive OSI-approved license permitting commercial use, modification, and distribution with minimal restrictions. Attribution appreciated but not required.

MIT License explicitly permits commercial use. However, as with any open-source dependency, review the full LICENSE file and evaluate any third-party database drivers bundled with upper/db for their own license terms. No warranty is provided.

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

upper/db relies on underlying database drivers for connection security (TLS, authentication). Parameterized queries reduce SQL injection risk. Ensure environment-based credential management (e.g., no hardcoded passwords in code). Database connection strings and secrets should be treated as sensitive. No security audits or vulnerability disclosures are mentioned in the provided data; assess via GitHub issues and external security tracking.

Alternatives to consider

sqlc

Type-safe SQL query generation with compile-time verification; stronger for complex queries and schema enforcement but less abstraction across database types.

ent

Go-native graph-based ORM with schema-as-code; better for strongly-typed models and deeper feature completeness, but opinionated and less database-agnostic.

GORM

More widely adopted Go ORM with richer ecosystem; supports multiple databases and complex features, but heavier footprint and steeper learning curve.

Software development agency

Build on db with DEV.co software developers

upper/db abstracts multiple databases behind a single interface. Our engineers can help you evaluate whether it fits your architecture, design a clean DAL integration, and optimize database performance.

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.

db FAQ

Does upper/db support transactions across multiple databases?
upper/db provides transaction interfaces per database adapter. Distributed transactions across heterogeneous backends are not abstracted; you must implement application-level coordination or use databases with native distributed transaction support (e.g., CockroachDB).
What is the performance overhead compared to raw driver usage?
Not quantified in the provided data. Overhead depends on query complexity and abstraction depth. Simple CRUD operations typically add minimal latency; complex queries may benefit from raw SQL fallback.
Is upper/db suitable for microservices?
Yes. Each service can use upper/db with its own database adapter, enabling data source flexibility without coupling services through a shared DAL.
Can I migrate an application from upper/db if needed?
Possible but non-trivial. Query code is coupled to upper/db syntax; rewriting to raw SQL or another ORM requires mapping each query. Mitigation: encapsulate DAL behind a repository pattern to limit scope of refactoring.

Work with a software development agency

Need help beyond evaluating db? 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.

Need a flexible data layer for your Go application?

upper/db abstracts multiple databases behind a single interface. Our engineers can help you evaluate whether it fits your architecture, design a clean DAL integration, and optimize database performance.