AbsoluteJS

Keep Your Framework, Lose the Package Deal

Keep React, Svelte, Vue, Angular, HTML or HTMX. Drop the package deal that usually comes with it. This post covers what each one gains inside one AbsoluteJS server, framework by framework, with the code.

React

Typed props from an ordinary route, streaming by default, opt-in Server Components, and forms that work without JavaScript.

Read the React chapter ↓

What a meta-framework makes you buy

When you pick a UI library today, you usually pick a lot more than a UI library. Choose React and the default path is Next.js. Choose Svelte and it's SvelteKit; Vue, Nuxt; Angular, the Angular CLI and its SSR builder. Each of those is a good piece of software. Each is also a package deal: a router, a bundler, a server, a data-loading model and a deploy story, all designed around one library.

That's fine until the deal stops fitting. Your marketing pages want to ship no JavaScript, but the deal assumes an app. Your team has a Vue dashboard and wants a React editor next to it, and now there are two deals, two servers and two copies of every type. Your backend lives in its own project because the meta-framework's server was built to render pages, not to be your API.

AbsoluteJS splits that deal apart. The framework does what it is best at, rendering UI. Everything else (routing, the server, data, the build, types between client and server) moves into one Elysia server on Bun that every framework shares. A page is a route that returns HTML:

src/backend/server.tsts
new Elysia()
  .use(absolutejs)
  .get('/dashboard', () =>
    handleSveltePageRequest<typeof Dashboard>({
      indexPath: asset(manifest, 'DashboardIndex'),
      pagePath: asset(manifest, 'Dashboard'),
      props: { stats }
    })
  );

Swap that handler for handleReactPageRequest, handleVuePageRequest, handleAngularPageRequest, handleHTMLPageRequest or handleHTMXPageRequest, and the route serves a different framework. Nothing around it changes.

The rest of this post is the part people ask me about most. When you keep your framework and lose its package deal, what does the framework actually gain? Each chapter below starts with the framework at home, then shows it here.

React, without the platform

At home: Next.js 16

  • The App Router, the bundler and the server come as one React-only package.
  • Data loading, caching and Server Components follow its conventions.

Here

  • A React page is a component you return from an Elysia route.
  • Props are typed at the route, and streaming is on by default.
  • Server Components are opt-in, page by page.
  • The same server is your API.

Here's a full React route, with a form that works whether or not JavaScript loads:

actions.tsts
export const createUser = defineAction('/actions/signup', {
  body: t.Object({
    email: t.String({ error: 'Enter a valid email', format: 'email' }),
    name: t.String({ error: 'Name must be at least 2 characters', minLength: 2 })
  }),
  handler: ({ body, fail }) =>
    body.name === 'taken'
      ? fail({ name: 'That name is taken' })
      : { greeting: `Welcome, ${body.name}` }
});
src/backend/server.tsts
.use(createUser)
.get('/signup', () =>
  handleReactPageRequest({
    Page: Signup,
    index: asset(manifest, 'SignupIndex'),
    props: { signupState: getActionState(createUser) ?? null }
  })
)
Signup.tsxtsx
const signup = useFormAction<typeof createUser>('/actions/signup', {
  initialState: signupState ?? undefined
});

<form {...signup.formProps}>
  <input name="name" defaultValue={signup.values.name} />
  {signup.errors.name && <p>{signup.errors.name}</p>}
  …
</form>

The body schema is an ordinary Elysia schema, so the same rules validate the form, type signup.errors, and type the Eden client when your client's type includes the action. With JavaScript on, the form submits without a page load. With it off, the browser posts, the server redirects back, and the page renders the same errors and keeps what you typed.

Streaming needs no setup. Put a SuspenseSlot on the page and the shell goes out first while the slot fills in when its data resolves:

Dashboard.tsxtsx
<SuspenseSlot fallback={<p>Loading…</p>} id="activity" resolve={loadActivity} />

When a page should be a Server Component, put it in the pages folder of your reactServerComponentsDirectory and serve it the same way:

src/backend/server.tsts
.get('/report', () =>
  handleReactServerPageRequest({ page: asset(manifest, 'ReportRSC'), props: { month } })
)

The page can be async and read your database directly. That code stays on the server.

React also gets file routes if you want them. Turn on fileRoutes, add routes/posts/[slug].tsx with a [slug].server.ts beside it, and serve the generated route tree with .use(fileRoutes(routeTree, manifest)). The load function must return the page's props, so a missing or wrong field fails the typecheck.

Svelte, typed from the server

At home: SvelteKit 3

  • Routing, load functions and adapters are SvelteKit's.
  • They are built for Svelte only.

Here

  • A Svelte page is a .svelte file served from any route.
  • Its props are checked where the route calls it.
  • {#await} renders on the server and hydrates.
  • A router with real redirects comes in the box.

The part I'd show a Svelte developer first is the type check. The route passes props to the page, and the page declares them with $props():

Dashboard.sveltesvelte
<script lang="ts">
  let { stats, user }: { stats: Stats; user: User } = $props();
</script>
src/backend/server.tsts
.get('/dashboard', () =>
  handleSveltePageRequest<typeof Dashboard>({
    indexPath: asset(manifest, 'DashboardIndex'),
    pagePath: asset(manifest, 'Dashboard'),
    props: { stats, user: 'ada' }   // TS2322: Type 'string' is not assignable to type 'User'.
  })
)

<typeof Dashboard> ties the handler to the component, so a wrong or missing prop fails absolute typecheck. The check runs svelte-check across your components and TypeScript across the server in one command.

{#await} is plain Svelte. The server renders the pending branch, and the browser resolves it and hydrates. When you'd rather the server send the resolved branch as it arrives, put <!-- absolute:stream --> before the block and add collectStreamingSlots: true to the page's handler:

src/backend/server.tsts
handleSveltePageRequest<typeof Dashboard>({
  collectStreamingSlots: true,
  indexPath: asset(manifest, 'DashboardIndex'),
  pagePath: asset(manifest, 'Dashboard'),
  props: { stats, user }
})
Dashboard.sveltesvelte
<!-- absolute:stream -->
{#await getActivity()}
  <p>Loading activity…</p>
{:then activity}
  <p>{activity.length} updates since your last visit</p>
{/await}

A streamed block's branches go out as HTML, so they hold elements and {expressions}. Anything richer stays in a plain {#await}, which hydrates.

For apps with more than one view, the Svelte router runs on both sides. Its guards run during server rendering too, so a guard that throws redirect() sends a real 302 before any HTML goes out:

App.sveltesvelte
<Router {url}>
  <Route
    path="/app/dashboard"
    guard={async ({ request }) => {
      const user = await loadUser(request);
      if (!user) throw redirect('/app/login?next=/app/dashboard');
    }}
  >
    {#snippet content()}<Dashboard />{/snippet}
  </Route>
</Router>

Lazy routes and scroll restoration come with it, and Svelte pages get the same file routes and typed load as React.

Vue, down to zero JavaScript

At home: Nuxt 4

  • Nuxt decides what hydrates.
  • Its server components are .server.vue files, still marked experimental.

Here

  • Each route decides what hydrates.
  • A page can ship no script at all.
  • Data loads on the server without a second fetch in the browser.
  • Or the page runs a full vue-router app.

Some pages don't need to be apps. A pricing page, a changelog, a legal page: render them with Vue because that's where your components live, then ship no JavaScript:

src/backend/server.tsts
.get('/pricing', () =>
  handleVuePageRequest<typeof Pricing>({
    client: 'none',
    pagePath: asset(manifest, 'Pricing'),
    props: { plans }
  })
)

That page goes out as HTML and CSS with no <script> tag. The next route over can be fully interactive.

When a page does hydrate, useServerData loads its data once:

Profile.vuevue
<script setup lang="ts">
import { useServerData } from '@absolutejs/absolute/vue';

const { data, error, pending, refresh } = useServerData('profile', loadProfile);
</script>

On the server it runs loadProfile and renders the result. The result rides along in the page, so on hydration the browser uses it and doesn't fetch again. refresh is there when you do want new data.

An app with several views exports its routes, and AbsoluteJS sets up vue-router for you:

App.vuevue
<script lang="ts">
import { defineRoutes } from '@absolutejs/absolute/vue';

export const routes = defineRoutes([
  { path: '/app/one', component: () => import('./One.vue').then((m) => m.default) },
  { path: '/app', redirect: '/app/one' }
]);
</script>

<template><RouterView /></template>

Deep links work, lazy routes load on demand, and links navigate without a reload.

The dev loop keeps up. <script setup> state survives template edits, and absolute typecheck checks your .vue files and the props your routes pass in. A clean check of a starter project takes well under a second.

Angular, edited in milliseconds

At home: Angular CLI 22

  • HMR covers styles and templates. Other changes rebuild and reload the page.
  • SSR comes from the CLI builder and a Node server.
  • A bootstrap file, provideRouter and app config come with every app.
  • Wiring up the API, and the types it shares with your components, is your job.

Here

  • Template edits apply in place in 5 to 12 ms on the server, and component state is kept.
  • Zoneless SSR runs on Bun, and @defer streams from the server and stays after hydration.
  • A page is one exported component class. An exported routes is wired for you, base href included.
  • The handler type-checks the request context, and the same Eden client calls your API.

An Angular page is a standalone component. It reads what the route gives it through a typed context:

dashboard.tsts
export type Context = { stats: Stats };

@Component({ selector: 'dashboard-page', standalone: true, templateUrl: '../templates/dashboard.html' })
export class DashboardComponent {
  stats = usePageContext<Context>().stats;
}
src/backend/server.tsts
.get('/dashboard', async () =>
  handleAngularPageRequest<DashboardPage.Context>({
    indexPath: asset(manifest, 'DashboardIndex'),
    pagePath: asset(manifest, 'Dashboard'),
    requestContext: { stats: await getStats() }
  })
)

That's the whole setup. It needs no main.ts, no app.config.ts and no server file. If requestContext doesn't match Context, the typecheck fails.

The part Angular developers notice first is the edit loop. Change a template and it's in the browser almost at once, with your counters, form input and component state where you left them.

@defer streams. Add collectStreamingSlots: true to the handler, and the server sends each deferred block as it resolves, then hydrates the page around it:

dashboard.htmlhtml
@defer (on timer(300ms)) {
  <section class="activity">{{ stats.updates }} updates since your last visit</section>
} @placeholder {
  <p>Loading activity…</p>
}

Pages run zoneless by default. When a library still needs zone.js, set angular: { changeDetection: 'zone' } in absolute.config.ts and bun add zone.js.

Plain HTML, with superpowers

At home: hand-written HTML, or Astro 7

  • Hand-written pages have no build step to hash assets or share a header.
  • Astro gives you one, with islands. Each framework’s components live in their own files, and shared state goes through Nano Stores.

Here

  • A page is an .html file.
  • The build hashes its assets, makes responsive images, and assembles it from layouts and partials.
  • An island from any framework drops in where the page needs one interactive part.

An HTML page here is just HTML. Layouts and partials are two elements:

html/layouts/base.htmlhtml
<!doctype html>
<html>
  <head>
    <abs-slot name="head"><title>My site</title></abs-slot>
  </head>
  <body>
    <abs-include src="../partials/header.html"></abs-include>
    <main><abs-slot></abs-slot></main>
  </body>
</html>
html/pages/About.htmlhtml
<abs-include src="../layouts/base.html">
  <template slot="head"><title>About us</title></template>
  <h1>About us</h1>
  <absolute-island framework="react" component="ContactForm" hydrate="visible"></absolute-island>
</abs-include>

The includes are resolved at build time, so the browser gets one plain document. In dev, editing header.html updates every open page that uses it, and each page keeps its own title and body.

The island in that page is a React component, server-rendered into the HTML and hydrated when it scrolls into view. It could just as well be Svelte, Vue or Angular, and it can read the same store as islands from any other framework.

Errors follow the same idea. Put an error.html in your pages folder, and a route that throws while serving a page renders it with status 500. In production it shows a generic message, and the full error goes to the server log.

HTMX, with a typed server

At home: htmx and a server you bolt on

  • You pick a server and write the fragment endpoints.
  • Validation, per-visitor state and reloading are yours to assemble.

Here

  • Fragment endpoints are typed Elysia routes.
  • htmx is pinned and served from your own origin.
  • Per-visitor state survives a server edit.
  • The page hot-updates without losing what you typed.

An HTMX fragment is an Elysia route, so it gets Elysia's validation:

src/backend/server.tsts
.post(
  '/htmx/greet',
  { body: t.Object({ name: t.String({ minLength: 2 }) }) },
  ({ body }) => `<p id="greeting">Hi ${body.name}</p>`
)

A bad body gets a 422 before your handler runs. A good one gets the fragment.

Per-visitor state lives in scopedState, and it is kept through server edits. Change a route in api.ts and the server picks up the new code without a restart, while every visitor's counter stays where it was:

src/backend/server.tsts
const visitorState = scopedState({ count: { value: 0 } });

new Elysia()
  .use([absolutejs, api, visitorState])
  .post('/htmx/increment', ({ scopedStore }) => ++scopedStore.count);

Form actions work here too. The same defineAction from the React chapter takes an htmx renderer, so hx-post gets a fragment back, and a browser without JavaScript gets a normal post and redirect:

actions.tsts
export const signup = defineAction('/actions/signup', {
  body: t.Object({ name: t.String({ error: 'Name too short', minLength: 2 }) }),
  handler: ({ body }) => ({ hello: body.name }),
  htmx: (result) =>
    result.status === 'success'
      ? `<p>Hello ${result.data?.hello}</p>`
      : `<p>${result.errors.name}</p>`
});

htmx itself is version 2.0.11, pinned and served from your own origin, so there's no CDN to allow in your CSP. Edit the page in dev, and the DOM is patched in place without losing what you typed in the form.

What they get from each other

Everything so far is what one framework gains from losing its package deal. This part comes from them sharing one server and one build. No single-framework tool can offer it, because there is only one framework in the room.

  • ReactPage.tsx
  • SveltePage.svelte
  • VuePage.vue
  • Angularpage.component.ts
  • HTMLPage.html
  • HTMXPage.htmx.html

One Elysia server on Bun

  • Islands in any direction, one shared store
  • React ↔ Svelte navigation with no reload
  • One Eden API, typed everywhere
  • One typecheck across every framework
  • One CSP, with nonces on everything
  • One dev loop
Each framework renders its own pages. Everything underneath is shared.
Serve /dashboard with
new Elysia()
  .use(absolutejs)
  .use(api)
  .get('/dashboard', async ({ user }) => {
    const stats = await getStats(user);

    return handleReactPageRequest({
      Page: Dashboard,
      index: asset(manifest, 'DashboardIndex'),
      props: { stats }
    });
  }, { beforeHandle: requireUser })

Changes: the handler call and the page file, now Page.tsx.

Stays the same:

  • The auth guard, beforeHandle
  • The data loading, getStats(user)
  • The Eden API every page calls
  • The dev server, HMR and absolute typecheck
  • The deploy: still one server
Pick a framework. Only the handler line changes.

One store, any framework. An island store is defined once and read through each framework's own adapter:

src/shared/counterStore.tsts
export const counterStore = createIslandStore('counter', { count: 0 }, (set) => ({
  increment: () => set((state) => ({ count: state.count + 1 }))
}));

A React island calls useIslandStore(counterStore, (s) => s.count). A Svelte island gets the same value as a Svelte store, and Vue gets a ref. Click in one and the others update.

Navigation that keeps the store. Call enableNavigation() on your pages, and links between React and Svelte pages become soft navigations, even though the two pages use different frameworks. Going from a React page to a Svelte page and back, the document never reloads and the store keeps its value.

One API, typed everywhere. Your API is a set of Elysia routes on the same server. Every framework calls it through the same Eden client, typed from the server, so a renamed field is a type error in the React page, the Svelte page and the Angular page at once, in one typecheck.

One typecheck. absolute typecheck runs TypeScript, svelte-check, Vue's checker and Angular's compiler checks in one command, and each error is labelled with the checker that found it.

One security policy. .use(secureHeaders()) sets a strict, nonce-based Content Security Policy for every page, and everything the framework writes into a page carries the nonce: hydration data, streamed slots, island styles and hot updates in dev. You don't loosen the policy for one framework.

One dev loop. Edit a React island on an HTML page, a Svelte component and an API route, and each update arrives in place. Edit a React page that hosts islands from three frameworks, and the page updates around them while every island keeps its state.

Questions people ask

Is this a micro-frontend setup?

No. There's one server, one build and one deploy. Each page is rendered by one framework, and islands let another framework take a part of a page. Nothing is stitched together at runtime from separately deployed apps.

Can I use it with just one framework?

Yes. Most projects start that way. bun create absolutejs my-app --vue gives you a Vue app with the server, typecheck and dev loop described here. Adding a second framework later is one command: absolute add react, absolute add angular, and so on.

Do I have to give up file-based routing?

No, but you choose it. Routes are Elysia routes by default. Turn on fileRoutes and React and Svelte pages under routes/ become routes, with a typed load beside each one.

What about my existing SvelteKit, Nuxt or Next.js app?

Your components move as they are. They're React, Svelte or Vue components, and that's what AbsoluteJS renders. What you rewrite is the glue: the routes, the loaders and the server code, which become Elysia routes. Start with one page.

Does Angular really run on Bun?

Yes. Pages render zoneless on Bun with server-side @defer streaming, and zone.js is one config option and a bun add zone.js away for libraries that still need it.

What does “the framework renders” leave out?

Whatever you'd normally pick per framework: the router for multi-page apps, data loading, form handling, the server and the build. Those come from AbsoluteJS once, for every framework.

Bring the framework. Leave the package deal.

Pick the framework you already like and start there. You'll get the server, the typecheck and the dev loop from this post, with your framework doing what it was always good at.

Start with
bun create absolutejs my-app --svelte