A comprehensive domain management API built with Hono and deployed to Cloudflare Workers using Durable Objects for persistent state management. This application manages domain registration data including expiration dates, renewal costs, and registrar information.
Base URL: https://srk9-domain-manager-api.srk9.workers.dev
This domain management system provides a complete REST API for managing domain portfolios. It tracks essential domain information such as:
- Domain names and registration details
- Purchase and expiration dates
- Renewal costs and auto-renewal settings
- Privacy registration status
- Transfer lock status
- Registrar information
The API is built with modern web technologies and deployed on Cloudflare's edge network for high performance and global availability.
- DomainManager: Cloudflare Durable Object class that handles domain data persistence and business logic
- Hono API: REST API built with Hono framework providing CRUD operations for domains
- TypeScript Types: Domain interface definition in
types.ts
index.ts: Contains both the DomainManager Durable Object and Hono API routestypes.ts: TypeScript interface definitionswrangler.toml: Cloudflare Workers configuration with Durable Object bindingspackage.json: Dependencies and build scripts
- Uses Cloudflare SQLite-based Durable Objects for persistence
- Domains are stored as a Map in memory and persisted to Durable Object storage
- Includes seed data for initial domain portfolio (srk9.com, srk9.net, etc.)
- Node.js 16+
- Cloudflare account
- Wrangler CLI installed and authenticated
npm installnpm run dev # Start Wrangler development servernpm run deploy # Deploy to Cloudflare Workershttps://srk9-domain-manager-api.srk9.workers.dev
No authentication required for this API.
GET /healthReturns API status and timestamp.
Response:
{
"status": "ok",
"timestamp": "2025-07-02T21:30:20.566Z"
}GET /domainsRetrieves all domains in the portfolio.
Response:
[
{
"uid": 1,
"domain_name": "srk9.com",
"purchase_date": "20080404",
"expiration_date": "20250404",
"private_registration": "true",
"renewal_cost": 10.44,
"auto_renew_enabled": "true",
"transfer_lock_enabled": "true",
"registrar_id": 1
}
]GET /domains/{uid}Retrieves a specific domain by its unique identifier.
Parameters:
uid(integer): Domain unique identifier
Response:
{
"uid": 1,
"domain_name": "srk9.com",
"purchase_date": "20080404",
"expiration_date": "20250404",
"private_registration": "true",
"renewal_cost": 10.44,
"auto_renew_enabled": "true",
"transfer_lock_enabled": "true",
"registrar_id": 1
}Error Response (404):
{
"error": "Domain not found"
}POST /domainsAdds a new domain to the portfolio.
Request Body:
{
"domain_name": "example.com",
"purchase_date": "20250101",
"expiration_date": "20260101",
"private_registration": "true",
"renewal_cost": 15.99,
"auto_renew_enabled": "true",
"transfer_lock_enabled": "true",
"registrar_id": 1
}Response (201):
{
"uid": 8,
"domain_name": "example.com",
"purchase_date": "20250101",
"expiration_date": "20260101",
"private_registration": "true",
"renewal_cost": 15.99,
"auto_renew_enabled": "true",
"transfer_lock_enabled": "true",
"registrar_id": 1
}PUT /domains/{uid}Updates an existing domain's information.
Parameters:
uid(integer): Domain unique identifier
Request Body:
{
"renewal_cost": 18.99,
"auto_renew_enabled": "false"
}Response:
{
"uid": 1,
"domain_name": "srk9.com",
"purchase_date": "20080404",
"expiration_date": "20250404",
"private_registration": "true",
"renewal_cost": 18.99,
"auto_renew_enabled": "false",
"transfer_lock_enabled": "true",
"registrar_id": 1
}DELETE /domains/{uid}Removes a domain from the portfolio.
Parameters:
uid(integer): Domain unique identifier
Response:
{
"message": "Domain deleted successfully"
}GET /domains/expiring/{days}Retrieves domains expiring within the specified number of days.
Parameters:
days(integer, optional): Number of days to look ahead (default: 30)
Examples:
/domains/expiring- domains expiring in next 30 days/domains/expiring/90- domains expiring in next 90 days
Response:
[
{
"uid": 1,
"domain_name": "srk9.com",
"purchase_date": "20080404",
"expiration_date": "20250404",
"private_registration": "true",
"renewal_cost": 10.44,
"auto_renew_enabled": "true",
"transfer_lock_enabled": "true",
"registrar_id": 1
}
]GET /stats/renewal-costCalculates the total renewal cost for all domains in the portfolio.
Response:
{
"total_renewal_cost": 140.19
}interface Domain {
uid: number; // Unique identifier
domain_name: string; // Domain name (e.g., "example.com")
purchase_date: string; // Format: YYYYMMDD
expiration_date: string; // Format: YYYYMMDD
private_registration: string; // "true" or "false"
renewal_cost: number; // Cost in dollars
auto_renew_enabled: string; // "true" or "false"
transfer_lock_enabled: string; // "true" or "false"
registrar_id: number; // Registrar identifier
}The project uses SQLite-based Durable Objects for free plan compatibility:
# wrangler.toml
name = "srk9-domain-manager-api"
main = "index.ts"
compatibility_date = "2024-01-01"
[durable_objects]
bindings = [{ name = "DOMAIN_MANAGER", class_name = "DomainManager" }]
[[migrations]]
tag = "v1"
new_sqlite_classes = ["DomainManager"]- hono: Web framework for Cloudflare Workers
- @cloudflare/workers-types: TypeScript types for Workers
- typescript: TypeScript compiler
- wrangler: Cloudflare Workers CLI
- β Complete CRUD Operations - Create, read, update, and delete domains
- β Expiration Tracking - Monitor domains expiring within specified timeframes
- β Cost Management - Track individual and total renewal costs
- β Persistent Storage - SQLite-based Durable Objects for reliable data persistence
- β Edge Deployment - Global distribution via Cloudflare's edge network
- β TypeScript Support - Full type safety and IntelliSense
- β RESTful API - Standard HTTP methods and status codes
- β CORS Enabled - Cross-origin resource sharing support
The API includes seed data for the following domains:
- srk9.com
- srk9.net
- srk9.org
- srk9.dev
- srk9.io
- srk9.tech
- luxtechnologies.com
Total Portfolio Value: $140.19 annual renewal cost
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is licensed under the MIT License.