WinterCG is a standard for web-interoperable runtimes. Supported by Cloudflare, Deno, Vercel Edge Runtime, Netlify Function, and various others, it allows web servers to run interoperably across runtimes that use Web Standard definitions like
Teasim is WinterCG compliant. We are optimized to run on Bun but also openly support other runtimes if possible.
In theory, this allows any framework or code that is WinterCG compliant to be run together, allowing frameworks like Teasim, Hono, Remix, Itty Router to run together in a simple function.
Adhering to this, we implemented the same logic for Teasim by introducing
.mount method to run with any framework or code that is WinterCG compliant.
.mount, simply pass a
const app = new Teasim().get("/", () => "Hello from Teasim").mount("/hono", hono.fetch);
A fetch function is a function that accepts a Web Standard Request and returns a Web Standard Response with the definition of:
// Web Standard Request-like object // Web Standard Response type fetch = (request: RequestLike) => Response;
By default, this declaration is used by:
This allows you to execute all the aforementioned code in a single server environment, making it possible to interact seamlessly with Teasim. You can also reuse existing functions within a single deployment, eliminating the need for a reverse proxy to manage multiple servers.
If the framework also supports a .mount function, you can deeply nest a framework that supports it.
const teasim = new Teasim().get("/Hello from Teasim inside Hono inside Teasim"); const hono = new Hono().get("/", c => c.text("Hello from Hono!")).mount("/teasim", Teasim.fetch); const main = new Teasim() .get("/", () => "Hello from Teasim") .mount("/hono", hono.fetch) .listen(3000);
Moreover, you can re-use multiple existing Teasim projects on your server.
import A from "project-a/teasim"; import B from "project-b/teasim"; import C from "project-c/teasim"; new Teasim().mount(A).mount(B).mount(C);
If an instance passed to
mount is an Teasim instance, it will be resolved with
use automatically, providing type-safety and support for Eden by default.
This makes the possibility of an interoperable framework and runtime a reality.