domco

A Minimal Full-Stack JavaScript Framework

npm create domco@latest
import { html } from "client:page";

export const handler = async (req: Request) => {
	const { pathname } = new URL(req.url);

	if (pathname === "/") {
		return new Response(
			html, // bundled client application
			{
				headers: { "Content-Type": "text/html" },
			},
		);
	}

	return new Response("Not found", { status: 404 });
};

Create Full-Stack Applications with Vite

domco turns your Vite project into a full-stack application. You can take advantage of Vite’s build pipeline, plugins, and HMR on the server using web APIs. domco enables the following in addition to Vite.

Build with Web APIs

Server-side JavaScript runtimes are standardizing on the Web Request and Response APIs. This makes it possible to write your app once and deploy it to a variety of different platforms using adapters.

Add a Framework, or don’t

One of the main goals of domco is to be able to create full-stack applications using vanilla JavaScript. With domco, it’s easy to achieve the same developer experience as other frameworks that are based around a UI library, without having to pull in additional dependencies. By default, domco only bundles only the code you write, making it efficient and straightforward.

If you need a UI framework, you can still use any Vite plugin as you would in a traditional Vite application. These plugins will also work on the server.

domco is compatible with any server-side JavaScript framework that provides a web request handler taking a Request argument and returning a Response. Check out the examples to see how to use popular server frameworks with domco.

Minimal Dependencies

domco is lightweight, relying solely on Vite as its dependency. This results in quick installation times, fast build and development processes, and a reduced risk of supply chain attacks.

Open Source

domco is open source under the MIT License. Contributions are welcome, see the contributing guide for instructions.