Backend API for timed.cc — a quick cross-device link sharing service using short codes and QR.
This API is built with Hono and runs on Cloudflare Workers, using Cloudflare KV for temporary link storage.
bun i
bun run devbun run deployGet the API information.
Response: JSON object with the following fields:
message: A welcome message.version: The version of the API.
{
"message": "Welcome to the timed.cc API",
"version": "1.0.0"
}Create a new short link.
Request: JSON object with the following fields:
encryptedUrl: The encrypted URL to be shortened.
{
"encryptedUrl": "U2FsdGVkX1/IGvUkIgxEmxSM6kitLRMVCgAroho0bCQqw+HaAcQpGk5X+f2jXMMI"
}Response: JSON object with the following fields:
code: The generated short code.expiresAt: The timestamp when the short link will expire.
{
"code": "A12345",
"expiresAt": 1699999999999
}Resolve a short code to its original URL.
Request: URL parameter code (the short code).
code: The short code to resolve.
{
"code": "A12345"
}Response: JSON object with the following fields:
encryptedUrl: The encrypted URL.
{
"encryptedUrl": "U2FsdGVkX1/IGvUkIgxEmxSM6kitLRMVCgAroho0bCQqw+HaAcQpGk5X+f2jXMMI"
}Check if the API is running.
Response: JSON object with the following fields:
status: The status of the API.timestamp: The current timestamp.
{
"status": "ok",
"timestamp": 1699999999999
}- All codes expire after 5 minutes using KV TTL.
- CORS is enabled for all origins by default in development.
- Keys are stored using Cloudflare Workers KV (
c.env.timed). - Use the
/admin/listendpoint only in local/dev mode — never expose it in production without protection. - Error handling is included for invalid input and failed KV access.
- Bun for the runtime.
- Hono for the web framework.
- Cloudflare Workers for serverless deployment.
- Cloudflare KV for key-value storage.