intmian/gorm-d1-adapter — explained in plain English
Analysis updated 2026-05-18
Connect an existing Go and GORM application to Cloudflare D1 without rewriting it for Workers.
Deploy the included Worker proxy so services never handle a raw Cloudflare account token directly.
Batch multiple database reads and writes into a single fast, atomic request.
Migrate from the older, slower community D1 adapter using a compatible interface.
| intmian/gorm-d1-adapter | glockinhand/guns.lol-view-bot | volcengine/mediakit-cli | |
|---|---|---|---|
| Stars | 39 | 40 | 40 |
| Language | Go | Go | Go |
| Setup difficulty | moderate | moderate | moderate |
| Complexity | 3/5 | 3/5 | 2/5 |
| Audience | developer | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Worker mode requires deploying the included Cloudflare Worker proxy, REST mode needs a Cloudflare account API token and database ID.
gorm-d1-adapter lets Go applications connect to Cloudflare's D1 database using the popular GORM library or Go's standard database/sql interface. Cloudflare does not provide an official Go library for D1, and an earlier community adapter broke when D1's API changed and was no longer maintained. The author rewrote the connector from scratch to fix that and make it much faster. The recommended way to connect is through a small Cloudflare Worker that the project includes. Instead of putting a Cloudflare account token directly into every Go service, that token stays inside the Worker, and Go services only need a simple access token to talk to it. This also lets multiple database operations get bundled into one request while keeping D1's built in guarantee that a batch either fully succeeds or fully rolls back. An older REST based connection mode, which talks to Cloudflare's API directly, is still available for existing setups or as a fallback. According to the project's own benchmarks, run on the same region and database for both modes, the Worker based connection opens about 18 times faster than the REST mode, and batches of database operations run about 6 times faster. Even single database operations are noticeably faster through the Worker. Using it means installing the Go package, choosing either Worker or REST mode in a small configuration object, and passing that into GORM as normal. Switching between the two modes later does not require changing application code. There are some limitations to be aware of: no interactive transactions, specific rules for how column names are interpreted as booleans or timestamps, and only basic table and column creation supported through GORM migrations, not more destructive changes like dropping columns.
A Go adapter that connects GORM or database/sql to Cloudflare D1, running 2 to 18 times faster through an included Worker proxy.
Mainly Go. The stack also includes Go, GORM, Cloudflare D1.
No license information is stated in this description.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.