New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

do-manager-admin-hooks

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

do-manager-admin-hooks

Admin hooks for Cloudflare Durable Objects - enables DO Manager integration

Source
npmnpm
Version
1.1.2
Version published
Maintainers
1
Created
Source

do-manager-admin-hooks

Last Updated March 1, 2026

npm License: MIT

Admin hooks for Cloudflare Durable Objects that enable integration with DO Manager.

Installation

npm install do-manager-admin-hooks

Quick Start

import { withAdminHooks } from "do-manager-admin-hooks";

export class MyDurableObject extends withAdminHooks() {
  async fetch(request: Request): Promise<Response> {
    // Handle admin requests first (required for DO Manager)
    const adminResponse = await this.handleAdminRequest(request);
    if (adminResponse) return adminResponse;

    // Your custom logic here
    return new Response("Hello from my Durable Object!");
  }
}

Configuration Options

export class SecureDO extends withAdminHooks({
  // Change the base path for admin endpoints (default: '/admin')
  basePath: "/admin",

  // Require authentication for admin endpoints (recommended for production)
  requireAuth: true,
  adminKey: "your-secret-key",
}) {
  // ...
}

Admin Endpoints

Once you extend withAdminHooks(), your Durable Object exposes these endpoints:

EndpointMethodDescription
/admin/listGETList storage keys (KV) or tables (SQLite)
/admin/get?key=XGETGet value for a key
/admin/putPOSTSet key-value pair ({ key, value })
/admin/deletePOSTDelete a key ({ key })
/admin/sqlPOSTExecute SQL ({ query }) - SQLite only
/admin/alarmGETGet current alarm
/admin/alarmPUTSet alarm ({ timestamp })
/admin/alarmDELETEDelete alarm
/admin/exportGETExport all storage as JSON
/admin/importPOSTImport data ({ data: {...} })
/admin/:name/freezePUTFreeze instance (block writes)
/admin/:name/freezeDELETEUnfreeze instance (allow writes)
/admin/:name/freezeGETGet freeze status

Freeze Operations

Freeze functionality is used for instance migration cutover modes. When an instance is frozen:

  • PUT, DELETE, and IMPORT operations return 423 Locked
  • Read operations (GET, LIST, EXPORT) continue to work

DO Manager Setup

  • Install this package and deploy your Worker
  • In DO Manager, add your namespace
  • Enter your Admin Hook Endpoint URL (e.g., https://my-worker.workers.dev)
  • Admin hooks are automatically enabled when you save
  • View/edit storage, set alarms, and backup your DOs!

Security

For production, enable authentication:

export class SecureDO extends withAdminHooks({
  requireAuth: true,
  adminKey: process.env.ADMIN_KEY,
}) {
  // ...
}

Features timing-safe key comparison to prevent timing attacks.

TypeScript Support

Full TypeScript support with exported types:

import {
  withAdminHooks,
  AdminHooksOptions,
  AdminListResponse,
  AdminExportResponse,
} from "do-manager-admin-hooks";

License

MIT

Keywords

cloudflare

FAQs

Package last updated on 01 Mar 2026

Related posts