🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

do-manager-admin-hooks

Package Overview
Dependencies
Maintainers
1
Versions
12
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

latest
Source
npmnpm
Version
1.1.13
Version published
Weekly downloads
1
-95.83%
Maintainers
1
Weekly downloads
 
Created
Source

do-manager-admin-hooks

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 10 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts