Skip to content

williamveith/cdnmanager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

102 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CDN Manager

CDN Manager is a native desktop application for managing Cloudflare Workers KV through a local desktop interface.

Instead of working directly in the Cloudflare dashboard, the app syncs KV records into a local SQLite database so records can be searched, reviewed, inserted, and deleted quickly from a desktop UI.

The application is built with:

  • Go
  • Wails
  • SQLite
  • Vanilla JavaScript
  • Fuse.js for approximate table search

macOS releases are packaged as a universal DMG containing a universal app bundle for both Apple Silicon (arm64) and Intel (x86_64) Macs. Release builds are Developer ID signed and Apple notarized.


Features

Cloudflare KV management

  • Syncs records from a Cloudflare Workers KV namespace into a local SQLite database
  • Inserts KV records with structured metadata
  • Deletes KV records from Cloudflare and the local database
  • Uses the configured domain to generate shareable entry links

Local database workflow

  • Maintains a local SQLite cache of KV records for fast lookups

  • Supports search by:

    • all entries
    • UUID
    • URL (single result)
    • URL (multiple results)
  • Supports approximate in-table search using Fuse.js on metadata fields:

    • name
    • mimetype
    • location
    • description

Metadata support

Each KV record can include structured metadata:

  • name
  • external
  • mimetype
  • location
  • cloud_storage_id
  • md5Checksum
  • description

Bulk insertion support

  • Downloadable CSV template for bulk inserts
  • CSV-based insert workflow from the desktop UI

macOS Distribution

  • Universal macOS app bundle (arm64 + x86_64)
  • Universal DMG installer
  • Developer ID signed
  • Apple notarized
  • Gatekeeper-compatible distribution

Developer Release Pipeline

Source provenance

  • Signed Git commits
  • Signed Git tags
  • Tagged GitHub releases

Build and distribution

  • Universal macOS build generation
  • App bundle signing (Developer ID)
  • DMG packaging
  • Apple notarization
  • Stapling and verification

Note: Git tagging and GitHub release publishing are performed outside of the Makefile.


Project Structure

Project Structure

.
β”œβ”€β”€ Makefile                     # Build, package, and release automation
β”œβ”€β”€ README.md                    # Project documentation
β”œβ”€β”€ app.go                       # Wails application bindings and exposed methods
β”œβ”€β”€ data
β”‚   └── schema.sql               # SQLite schema used to initialize the local database
β”œβ”€β”€ frontend
β”‚   β”œβ”€β”€ dist                     # Production frontend build output
β”‚   β”‚   β”œβ”€β”€ assets
β”‚   β”‚   β”‚   β”œβ”€β”€ IBMPlexMono-Regular.49ce58b4.woff2          # Bundled IBM Plex Mono font
β”‚   β”‚   β”‚   β”œβ”€β”€ appicon.d007682b.png                        # Bundled application icon
β”‚   β”‚   β”‚   β”œβ”€β”€ glyphicons-halflings-regular.fe185d11.woff2 # Bundled glyphicon font
β”‚   β”‚   β”‚   β”œβ”€β”€ index.24410bbd.css                          # Compiled frontend styles
β”‚   β”‚   β”‚   └── index.6078d637.js                           # Compiled frontend logic
β”‚   β”‚   └── index.html              # Built frontend entrypoint
β”‚   β”œβ”€β”€ index.html                 # Frontend HTML shell used during development/build
β”‚   β”œβ”€β”€ package-lock.json          # Locked frontend dependency versions
β”‚   β”œβ”€β”€ package.json               # Frontend package manifest
β”‚   β”œβ”€β”€ package.json.md5           # Integrity hash for package manifest
β”‚   β”œβ”€β”€ src                        # Frontend source code
β”‚   β”‚   β”œβ”€β”€ assets
β”‚   β”‚   β”‚   β”œβ”€β”€ fonts
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ IBM_Plex_Mono
β”‚   β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ IBMPlexMono-Regular.woff2          # Primary monospace UI font
β”‚   β”‚   β”‚   β”‚   β”‚   └── license.txt                        # IBM Plex Mono license
β”‚   β”‚   β”‚   β”‚   └── glyphicons_halflings
β”‚   β”‚   β”‚   β”‚       β”œβ”€β”€ glyphicons-halflings-regular.woff2 # Icon font
β”‚   β”‚   β”‚   β”‚       └── license.txt                        # Glyphicon license
β”‚   β”‚   β”‚   └── images
β”‚   β”‚   β”‚       β”œβ”€β”€ appicon.png          # Raster app icon
β”‚   β”‚   β”‚       └── appicon.svg          # Vector app icon
β”‚   β”‚   β”œβ”€β”€ controllers                  # Frontend behavior and UI orchestration
β”‚   β”‚   β”‚   β”œβ”€β”€ appController.js         # Application bootstrap/controller coordination
β”‚   β”‚   β”‚   β”œβ”€β”€ configController.js      # Setup form behavior and submission handling
β”‚   β”‚   β”‚   β”œβ”€β”€ deleteController.js      # Delete flow and event handling
β”‚   β”‚   β”‚   β”œβ”€β”€ exportController.js      # Export flow and event handling
β”‚   β”‚   β”‚   β”œβ”€β”€ insertController.js      # Manual/CSV insert workflows
β”‚   β”‚   β”‚   └── searchController.js      # Search flow and result handling
β”‚   β”‚   β”œβ”€β”€ main.js                      # Frontend entrypoint
β”‚   β”‚   β”œβ”€β”€ services                     # Thin wrappers around Wails/Go APIs
β”‚   β”‚   β”‚   β”œβ”€β”€ appService.js            # App-level backend service calls
β”‚   β”‚   β”‚   └── dbService.js             # Database-related backend service calls
β”‚   β”‚   β”œβ”€β”€ state
β”‚   β”‚   β”‚   └── appState.js              # Shared frontend state
β”‚   β”‚   β”œβ”€β”€ styles
β”‚   β”‚   β”‚   └── app.css                  # Application styling
β”‚   β”‚   β”œβ”€β”€ utils
β”‚   β”‚   β”‚   β”œβ”€β”€ clipboard.js             # Clipboard helpers
β”‚   β”‚   β”‚   β”œβ”€β”€ domain.js                # Domain/link normalization helpers
β”‚   β”‚   β”‚   └── uuid.js                  # UUID helper functions
β”‚   β”‚   └── views                        # DOM rendering and UI templates
β”‚   β”‚       β”œβ”€β”€ configView.js            # Initial setup/configuration view
β”‚   β”‚       β”œβ”€β”€ shellView.js             # Main application shell
β”‚   β”‚       └── tableView.js             # Search result table rendering
β”‚   └── wailsjs                          # Auto-generated Wails JS bindings
β”‚       β”œβ”€β”€ go
β”‚       β”‚   β”œβ”€β”€ database
β”‚       β”‚   β”‚   β”œβ”€β”€ Database.d.ts        # TypeScript definitions for DB bindings
β”‚       β”‚   β”‚   └── Database.js          # JS bindings for DB methods
β”‚       β”‚   β”œβ”€β”€ main
β”‚       β”‚   β”‚   β”œβ”€β”€ App.d.ts             # TypeScript definitions for app bindings
β”‚       β”‚   β”‚   └── App.js               # JS bindings for app methods
β”‚       β”‚   └── models.ts                # Shared generated model definitions
β”‚       └── runtime
β”‚           β”œβ”€β”€ package.json             # Wails runtime package metadata
β”‚           β”œβ”€β”€ runtime.d.ts             # Wails runtime TypeScript definitions
β”‚           └── runtime.js               # Wails runtime helpers
β”œβ”€β”€ go.mod                         # Go module definition
β”œβ”€β”€ go.sum                         # Go dependency checksums
β”œβ”€β”€ hooks
β”‚   β”œβ”€β”€ postbuild.sh               # Post-build automation hook
β”‚   └── prebuild.sh                # Pre-build automation hook
β”œβ”€β”€ main.go                        # Go application entrypoint
β”œβ”€β”€ pkg                            # Internal Go packages
β”‚   β”œβ”€β”€ config
β”‚   β”‚   └── config.go              # App configuration loading, validation, normalization
β”‚   β”œβ”€β”€ database
β”‚   β”‚   └── database.go            # SQLite/database access layer
β”‚   β”œβ”€β”€ models
β”‚   β”‚   └── models.go              # Shared Go data models
β”‚   β”œβ”€β”€ reconcile
β”‚   β”‚   └── reconcile.go           # Cloudflare/database reconciliation logic
β”‚   └── session
β”‚       └── session.go             # Session/runtime state management
└── wails.json                     # Wails project configuration

Key Components

main.go

Application entry point. Responsible for:

  • resolving app data/config paths
  • initializing the config file
  • initializing the SQLite database from embedded schema
  • embedding frontend assets and schema
  • launching the Wails desktop app

app.go

Main application bridge exposed to the frontend. Handles:

  • config checks and saves
  • retrieving the configured domain
  • Cloudflare session initialization
  • syncing Cloudflare KV into the local database
  • insert/delete actions
  • generating the CSV bulk insert template

pkg/config

Defines the application config structure and JSON load/save behavior.


pkg/session

Wraps Cloudflare Workers KV API operations, including:

  • listing keys
  • reading values
  • inserting entries
  • deleting entries
  • loading KV entries
  • concurrent retrieval of KV values

pkg/reconcile

Responsible for synchronizing Cloudflare KV state with the local SQLite database.

  • Compares remote KV data against the local cache
  • Determines when a full rebuild or update is required
  • Ensures local database consistency with Cloudflare
  • Acts as the coordination layer between pkg/session and pkg/database

This package isolates synchronization logic from both the API layer and storage layer.


pkg/database

Local SQLite cache layer for:

  • creating/dropping the records table
  • inserting entries
  • deleting entries
  • querying records
  • retrieving cached entries

pkg/models

Shared record and metadata models with JSON serialization helpers.


frontend/src/main.js

Handles:

  • initial config flow
  • syncing on startup
  • search and rendering
  • approximate search
  • insert/delete workflows
  • CSV processing
  • dynamic link generation

How It Works

1. First launch

  • resolves user config directory
  • creates cdnmanager/
  • initializes config.json and database
  • loads frontend

2. Configuration

Prompts for:

  • Cloudflare API token
  • Cloudflare account ID
  • Cloudflare namespace ID
  • domain

3. Sync

  • initializes Cloudflare session
  • retrieves KV state
  • runs reconciliation against local DB via pkg/reconcile
  • updates or rebuilds cache as needed

4. Search and browse

All reads occur against the local SQLite cache.


5. Insert and delete

Writes are applied to:

  • Cloudflare Workers KV
  • local SQLite database

Configuration File

config.json

{
  "cloudflare_api_token": "your_api_token",
  "account_id": "0123456789abcdef0123456789abcdef",
  "namespace_id": "fedcba9876543210fedcba9876543210",
  "domain": "cdn.example.com"
}

Fields

  • cloudflare_api_token
  • account_id
  • namespace_id
  • domain

Local Data Paths

cdnmanager/
β”œβ”€β”€ config.json
└── cdnmanager.sqlite3

Database Schema

Table: records

  • name (primary key)
  • value
  • metadata (JSON text)

Search Modes

  • All
  • By UUID
  • By URL (single)
  • By URL (multiple)

Bulk Insert CSV Template

CDN Manager Bulk Insert Template.csv

Header:

name,value,metadata_name,metadata_external,metadata_mimetype,metadata_location,metadata_description,metadata_cloud_storage_id,metadata_md5Checksum

Link Generation

https://your-domain.example/?id=<uuid>

Fallback:

?id=<uuid>

Build Requirements

Core

  • Go
  • Node.js / npm
  • Wails v2

macOS

  • Apple Developer account
  • Developer ID certificate
  • Xcode CLI tools
  • notarytool configured

Development

cd frontend
npm install

wails dev

Commands

make build
make release
make clean

Architecture Notes

  • Config centralized in pkg/config
  • Token-based Cloudflare auth
  • Reconciliation logic isolated in pkg/reconcile
  • SQLite used as primary read layer
  • Parallel KV retrieval

Tech Stack

  • Go
  • Wails v2
  • Cloudflare Go SDK
  • SQLite
  • Vanilla JS
  • Fuse.js

Author

William Veith

About

URL Redirect Admin GUI for Cloudflare KV Namespace & Cloudflare Worker

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors