intmian GitHub avatar

gorm-d1-adapter

intmian

A Cloudflare D1 adapter for GORM and database/sql that uses a Worker Proxy to achieve 2–18× faster performance over the REST API.

Stars

29

7-day growth

No data

Forks

3

Open issues

0

License

No data

Last updated

2026-07-11

AI repository intelligence
FR-AI / ANALYSIS

Why it is worth attention

It fills the gap of an official Go D1 library, offering a production‑ready Worker Proxy mode that not only significantly outperforms the REST API (especially for batch operations and connection setup) but also improves security by keeping Cloudflare API tokens behind the Worker boundary.

Who it is for

  • Go developers using Cloudflare D1 outside the Workers runtime
  • Projects using GORM or database/sql that want to connect to D1
  • Teams migrating from the unmaintained legacy adapter
  • Developers who need high‑throughput batch operations on D1

Use cases

  • Low‑traffic personal projects using D1 with Go
  • Production Go services accessing D1 through a secure Worker proxy
  • Migrating an existing GORM codebase to Cloudflare D1
  • Batch CRUD operations where per‑statement round trips are a bottleneck

Strengths

  • Worker Proxy mode is 2–18× faster than REST across all benchmarks, with connection open 18× faster and batch CRUD 6× faster
  • Security improvements: API tokens never leave Cloudflare; Worker handles auth, rate limiting, and request logging
  • Dual‑mode architecture (REST & Worker) with identical GORM/database/sql interfaces for easy migration and fallback
  • Supports batch operations with native D1 atomicity, reducing round trips without sacrificing consistency

Considerations

  • BLOB encoding uses a reserved prefix ('d1b64:') that can cause false positives if text starts with that string
  • REST mode only accepts Cloudflare Account API Tokens, not User API Tokens
  • No interactive transactions; batch operations are the only transactional mechanism, and some GORM migration operations (e.g., dropping columns) are explicitly unsupported

README quick start

Quick Start

Description

Make your Go-to-D1 connection 2–18× faster.

Related repositories

Similar projects matched by category, topics, and programming language.

nethical6
Featured
nethical6 GitHub avatar

conversation-steganography

A tool that hides encrypted secret messages inside innocent-looking AI-generated chat text for private communication over any messaging platform.

Go
1,149
programmersd21
Featured
programmersd21 GitHub avatar

flow

flow is a minimalist terminal dashboard that displays real-time network throughput with smooth animations, multiple responsive modes, and zero configuration.

Developer ToolsCLI & Terminal
277
MobAI-App
MobAI-App GitHub avatar

simslim

simslim reduces iOS simulator memory usage by 4x by disabling unnecessary background daemons, allowing many more simulators to run on a single Mac.

Go
248