The micro-VM for AI agents — light enough to embed on your laptop, elastic enough to power an agentic cloud.
/** Console API: the Domains tab, an environment's custom domains (services/domains.ts). */
import type { Hono } from 'hono'
import { z } from 'zod'
import { addDomain, removeDomain, verifyDomain } from '../../services/domains'
import { actorOf, type ConsoleKit } from './kit'
export function consoleDomainRoutes(api: Hono, k: ConsoleKit): void {
const { ctx, appOf, envOf } = k
api.post('/apps/:id/domains', async (c) => {
const app = await appOf(c)
const b = await k.json(c, z.object({ host: z.string().trim().min(1).max(253) }))
return c.json(await addDomain(ctx, app, await envOf(c, app), b.host, actorOf(k.viewer(c))), 201)
})
api.post('/apps/:id/domains/:host/verify', async (c) => {
const app = await appOf(c)
return c.json(await verifyDomain(ctx, app, await envOf(c, app), c.req.param('host'), actorOf(k.viewer(c))))
})
api.delete('/apps/:id/domains/:host', async (c) => {
const app = await appOf(c)
return c.json(await removeDomain(ctx, app, await envOf(c, app), c.req.param('host'), actorOf(k.viewer(c))))
})
}