Handler Pattern Every app deployed on onvibe runs inside a managed server. Your code must export a default handler function — do NOT call Deno.serve() yourself. Correct pattern export default async function handler(req: Request): Promise { const url = new URL(req.url); if (url.pathname === "/") { return new Response("Hello from onvibe!", { headers: { "content-type": "text/plain" }, }); } return new Response("Not found", { status: 404 }); } With context (env vars) interface Context { env: Readonly>; } export default async function handler(req: Request, ctx: Context): Promise { const appURL = ctx.env.APP_URL; return new Response("Running at " + appURL); } HTML responses — always use template literals Use backtick template literals (` `) for HTML. They support multiline content, avoid quote escaping inside attributes, and allow ${expression}` interpolation: export default async function handler(req: Request): Promise { const name = "world"; const html = ` My App

Hello, ${name}!

About `; return new Response(html, { headers: { "content-type": "text/html; charset=utf-8" }, }); } With regular strings you would need to escape every " inside attributes (class=\"title\"). With template literals there is no escaping at all — use " for HTML attributes and ' or ${...} inside them freely. Rules - File must be named main.ts - Must have export default — named exports are ignored - The function receives (Request, Context?) and returns Promise - Never call Deno.serve() — causes a crash on startup (status 0 in check_app) - Never call Deno.exit() — terminates the server - Top-level await is allowed (e.g. for DB pool initialization) Available env vars (injected automatically) Variable Value APP_URL Public URL of this app APP_ID Internal app identifier DATABASE_URL PostgreSQL connection string (provisioned automatically for every project)