DEV.co
Open-Source Databases · groue

GRDB.swift

GRDB.swift is a SQLite database toolkit for iOS/macOS/tvOS/watchOS applications, offering ORM-like record persistence, SQL generation, database observation, and multi-threaded access patterns. It bridges low-level SQLite with Swift-idiomatic APIs while allowing raw SQL when needed.

Source: GitHub — github.com/groue/GRDB.swift
8.5k
GitHub stars
982
Forks
Swift
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
Repositorygroue/GRDB.swift
Ownergroue
Primary languageSwift
LicenseMIT — OSI-approved
Stars8.5k
Forks982
Open issues8
Latest releasev7.11.1 (2026-06-18)
Last updated2026-06-18
Sourcehttps://github.com/groue/GRDB.swift

What GRDB.swift is

GRDB provides Codable-based record mapping (FetchableRecord, PersistableRecord), a query builder DSL, ValueObservation for reactive updates, WAL concurrency support, and migrations. It wraps SQLite 3.20.0+ and supports Swift 6.1+, requiring iOS 13.0+/macOS 10.15+/tvOS 13.0+/watchOS 7.0+.

Quickstart

Get the GRDB.swift source

Clone the repository and explore it locally.

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

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

Best use cases

Local persistence in Apple platform apps

GRDB is purpose-built for iOS, macOS, tvOS, and watchOS apps requiring offline-first local data storage with reactive UI updates via ValueObservation.

Multi-threaded database access with WAL

Applications needing concurrent reads and writes benefit from GRDB's robust concurrency patterns and native WAL (write-ahead logging) support.

Schema evolution across app versions

Built-in migration system simplifies managing database schema changes as you ship new app releases.

Implementation considerations

  • Requires Swift 6.1+ and modern Xcode (16.3+); ensure team uses compatible toolchain and deployment targets (iOS 13.0+ minimum).
  • Schema design and migrations must be planned early; GRDB enforces structure but does not auto-generate schemas from Swift types.
  • ValueObservation introduces reactive patterns; teams unfamiliar with Combine or async/await should budget learning time.
  • Concurrency model (DatabaseQueue vs. DatabasePool) must match app architecture; incorrect choice can bottleneck multi-threaded apps.
  • Testing requires in-memory or temporary database instances; integrate into CI pipeline from the start.

When to avoid it — and what to weigh

  • Server-side backend database layer — GRDB is Swift-only and optimized for client-side SQLite. Server applications should use PostgreSQL, MySQL, or dedicated backend ORMs (ActiveRecord, Sequelize, SQLAlchemy).
  • Cross-platform (non-Apple) mobile requirements — GRDB targets Apple platforms only. Android/Flutter/React Native projects need database solutions with broader platform support.
  • Minimal dependencies and embedded environments — GRDB brings a non-trivial compiled footprint and Swift runtime dependency; embedded systems or dependency-critical contexts may prefer raw SQLite bindings.
  • Need for distributed/networked databases — GRDB is local-database only. Applications requiring distributed transactions, sharding, or multi-node replication should use cloud-native databases (Firestore, Realm Cloud, etc.).

License & commercial use

Licensed under the MIT License, a permissive open-source license. MIT permits commercial use, modification, distribution, and private use without restriction, provided the license notice and copyright are retained.

MIT license clearly permits commercial use. No proprietary restrictions, licensing fees, or attribution requirements beyond retaining the original license text. Suitable for proprietary iOS/macOS app development.

DEV.co evaluation signals

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

SignalAssessment
MaintenanceActive
DocumentationStrong
License clarityClear
Deployment complexityLow
DEV.co fitStrong
Assessment confidenceHigh
Security considerations

GRDB supports parameterized queries and SQL interpolation to prevent SQL injection. Review custom SQL for injection risks. SQLite encryption-at-rest is not built-in; use SQLCipher or platform keychain for sensitive data. No security audit information publicly available; assess risk based on app sensitivity and data classification.

Alternatives to consider

Core Data (Apple native)

Built into iOS/macOS; integrates with iCloud sync. Trade-offs: steeper learning curve, less SQL transparency, older API. Better for ecosystem lock-in; GRDB better for explicit control.

Realm (Realm Swift)

Cross-platform (iOS, Android, web); reactive by default; cloud sync option. Trade-offs: proprietary database format, subscription pricing for Realm Cloud. GRDB offers more direct SQLite control and full MIT freedom.

SQLite.swift (lightweight wrapper)

Minimal, type-safe SQLite wrapper without ORM overhead. Trade-offs: no built-in migrations, no observation layer, requires more manual SQL. GRDB better for full-featured apps needing observation and migrations.

Software development agency

Build on GRDB.swift with DEV.co software developers

GRDB.swift gives you full SQLite control with Swift ergonomics. Start with our technical review and integration roadmap.

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.

GRDB.swift FAQ

Does GRDB support iOS 12 or earlier?
No. Minimum is iOS 13.0+. If targeting iOS 12, evaluate alternatives (Core Data, older SQLite.swift versions, or raw SQLite bindings).
Can I use GRDB with SwiftUI?
Yes. GRDB integrates with SwiftUI via Combine publishers and @Published properties. ValueObservation can drive reactive state updates.
Is GRDB suitable for large datasets (100 GB+)?
SQLite scales to terabytes, but typical mobile apps use far less. For truly massive datasets on-device, consider archiving or server-side querying with local caching.
How do I encrypt my database?
GRDB does not provide built-in encryption. Integrate SQLCipher for encryption-at-rest, or use platform keychain APIs for sensitive credentials. Requires additional setup and testing.

Custom software development services

DEV.co is a software development agency delivering custom software development services to companies building on open source. Our software developers and web developers design, integrate, and ship production systems — spanning web development, APIs, AI, data, and cloud. If GRDB.swift is part of your open-source databases roadmap, our team can implement, customize, migrate, and maintain it.

Ready to build data-driven Apple apps?

GRDB.swift gives you full SQLite control with Swift ergonomics. Start with our technical review and integration roadmap.