Skip to content

Cloudflare D1 Database Manager: Full-featured web app includes visual schema editing, undo/rollback & time-travel history, cascade simulator, foreign key visualizer, circular dependency detection, read replication controls, job tracking, FTS5 search, with seamless Zero Trust and GitHub SSO.

License

Notifications You must be signed in to change notification settings

neverinfamous/d1-manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

D1 Database Manager for Cloudflare

Last Updated November 30, 2025 - Production/Stable v1.1.1

GitHub Docker Pulls License: MIT Version Status Security CodeQL Type Safety

This Docker image provides a modern, full-featured web application for managing Cloudflare D1 databases with enterprise-grade authentication via Cloudflare Access (Zero Trust). Run D1 Database Manager in Docker for development, testing, or self-hosted deployments.

Live Demo β€’ Docker β€’ Wiki β€’ Changelog β€’ Release Article

Tech Stack

Frontend: React 19.2.0 | Vite 7.2.4 | TypeScript 5.9.3 | Tailwind CSS | shadcn/ui Backend: Cloudflare Workers + KV + D1 + R2 + Durable Objects + Zero Trust


🎯 Features

Database Management

  • Create, rename, delete, download, optimize, and upload databases
  • Bulk operations with multi-select
  • Upload/import SQL files
  • Database search filter - Quickly find databases by name
  • NEW ✨Job history tracking - Track all database operations with detailed history

Table Operations

  • Visual schema designer
  • Clone, export (SQL/CSV), and bulk operations
  • Column management (add, modify, rename, delete)
  • Foreign key dependency analysis
  • Table search filter - Quickly find tables by name

Query Console

  • SQL editor with syntax highlighting
  • Query history and saved queries
  • CSV export

Advanced Features

  • Row-Level Filtering - Type-aware filters with OR logic, BETWEEN, IN operators
  • Foreign Key Visualizer - Interactive graph with add/modify/delete constraints
  • ER Diagram - Visual schema documentation with PNG/SVG/JSON export
  • Cascade Impact Simulator - Preview DELETE cascades before execution
  • Undo/Rollback - Restore dropped tables, columns, or deleted rows
  • FTS5 Full-Text Search - Create and manage virtual tables
  • Constraint Validator - Detect orphans and integrity violations
  • Index Analyzer - Smart index recommendations
  • NEW ✨Time Travel - View bookmarks, checkpoint history, and CLI restore commands
  • NEW ✨Read Replication - Enable/disable global read replicas with D1 Sessions API info

User Experience

  • Dark/Light/System themes
  • Responsive design

πŸ“š Full documentation: Wiki


πŸš€ Quick Start

Prerequisites

Local Development

git clone https://github.com/neverinfamous/d1-manager.git
cd d1-manager
npm install
cp .env.example .env

Start the servers (2 terminals):

Terminal 1 - Frontend:

npm run dev

Terminal 2 - Worker API:

npx wrangler dev --config wrangler.dev.toml --local

Open http://localhost:5173 - no auth required, mock data included.


πŸ”§ Production Deployment

1. Authenticate with Cloudflare

npx wrangler login

2. Create Metadata Database

npx wrangler d1 create d1-manager-metadata
npx wrangler d1 execute d1-manager-metadata --remote --file=worker/schema.sql

3. Configure Wrangler

cp wrangler.toml.example wrangler.toml

Edit wrangler.toml with your database_id from step 2.

4. Set Up Cloudflare Access

  1. Go to Cloudflare Zero Trust
  2. Configure authentication (GitHub OAuth, etc.)
  3. Create an Access Application for your domain
  4. Copy the Application Audience (AUD) tag

5. Create API Token

  1. Go to Cloudflare API Tokens
  2. Create Custom Token with Account β†’ D1 β†’ Edit permission

6. Set Secrets

npx wrangler secret put ACCOUNT_ID
npx wrangler secret put API_KEY
npx wrangler secret put TEAM_DOMAIN
npx wrangler secret put POLICY_AUD

7. Deploy

npm run build
npx wrangler deploy

⬆️ Upgrading

Update Schema (Required for New Features)

Run this after pulling updates to add new tables (safe to run multiple times):

npx wrangler d1 execute d1-manager-metadata --remote --file=worker/schema.sql

Redeploy

git pull origin main
npm install
npm run build
npx wrangler deploy

🐳 Docker

docker pull writenotenow/d1-manager:latest
docker run -d -p 8080:8080 \
  -e ACCOUNT_ID=your_account_id \
  -e API_KEY=your_api_token \
  -e TEAM_DOMAIN=https://yourteam.cloudflareaccess.com \
  -e POLICY_AUD=your_aud_tag \
  writenotenow/d1-manager:latest

See DOCKER_README.md for complete Docker instructions.


πŸ“‹ API Reference

Endpoint Description
GET /api/databases List databases
POST /api/databases Create database
DELETE /api/databases/:dbId Delete database
PUT /api/databases/:dbId/replication Set read replication mode
GET /api/tables/:dbId/list List tables
POST /api/query/:dbId/execute Execute SQL

πŸ“š Full API docs: Wiki - API Reference


πŸ› οΈ Tech Stack

Frontend Backend
React 19.2.0 Cloudflare Workers
TypeScript 5.9.3 Cloudflare D1
Vite 7.1.12 Cloudflare Access
Tailwind CSS + shadcn/ui

🐞 Troubleshooting

"Failed to list databases"

  • Verify ACCOUNT_ID is correct
  • Ensure API token has D1 Edit permission (not just Read)

Authentication loop

  • Check TEAM_DOMAIN includes https://
  • Verify POLICY_AUD matches your Access application

πŸ“š More solutions: Wiki - Troubleshooting


🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“š Guidelines: Wiki - Contributing Guide


πŸ“„ License

MIT License - see LICENSE for details.


πŸ“ž Support


Made with ❀️ for the Cloudflare community

About

Cloudflare D1 Database Manager: Full-featured web app includes visual schema editing, undo/rollback & time-travel history, cascade simulator, foreign key visualizer, circular dependency detection, read replication controls, job tracking, FTS5 search, with seamless Zero Trust and GitHub SSO.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Languages