What is Tirne?

Tirne is a minimal, type‑safe web framework for multi‑runtime edge environments — born for Bun, Workers, and Deno. Unlike traditional backend frameworks, Tirne treats structure as the source of truth, and side effects as first‑class citizens.

✨ Declarative APIs. Sub‑millisecond performance. Zero boilerplate.

Whether you're building latency‑critical APIs or designing strongly‑typed systems, Tirne puts control, clarity, and composition back in your hands.

🎯 Why Tirne Exists

Modern web frameworks often prioritize developer convenience at the cost of architectural clarity. In particular, frameworks like Hono and Next.js API Routes popularize behavior that is implied, not defined.

🧨 The Problem With 'Implicit Backends'
  • Hono uses global middleware via app.use(), obscuring scope of logic.
  • Next.js relies on isolated files and hidden conventions for context, cookies, auth.
  • Side effects happen without visibility or contract—no structure, no trace.

This leads to:

  • Hard‑to‑audit security
  • Unpredictable performance under load
  • Error handling as an afterthought

Tirne exists to break free from this invisible glue.

⚔️ Tirne vs Hono vs Next.js — Why We Must Be Explicit

FeatureTirneHonoNext.js
RoutingDeclarative <code>Route[]</code> structureChain‑style <code>app.get()</code>Filesystem magic
MiddlewareScoped per‑routeGlobal <code>use()</code> by defaultNone or ad hoc
Side EffectsControlled, typed, visibleImplicit via handler bodyScattered across files
Error Handling<code>TirneError</code> with metadatathrow or context mutationres.status(500) manually
Type SafetyFirst‑classMedium, context‑specificWeak, manual inference
Tirne exists because the modern backend deserves intention, not implication.

🧪 Real Code. Real Performance. No Magic.

import { Server, json, setCookie, requireAuth } from "tirne";
import type { Route } from "tirne";

const routes: Route[] = [
  {
    method: "GET",
    path: "/login",
    handler: () => {
      const headers = new Headers();
      headers.append("Set-Cookie", setCookie("auth", "valid-token", {
        httpOnly: true,
        path: "/",
        maxAge: 3600,
      }));
      return json({ message: "Logged in" }, 200, headers);
    },
    middleware: [],
  },
  {
    method: "GET",
    path: "/private",
    handler: () => json({ message: "Secret data only for authenticated users" }),
    middleware: [requireAuth],
  },
];

const server = new Server(routes);

export default {
  fetch: (req: Request) => server.fetch(req),
};

💬 Elevator Pitch

Tirne is a zero‑boilerplate, edge‑native web framework where your routes are code, your errors are typed, and your side effects are intentional. If you’re tired of magical frameworks that hide too much and explain too little — welcome home.

👉 https://github.com/Tirne‑ts/Tirne