Minimal Hono + Solid SSR SPA meta-framework, built on Vite.
README.md

Igneus [ALPHA] #

SolidJS SSR framework for Cloudflare Workers, powered by Hono.

Igneus gives you file-based routing with full SSR, typed API routes, and end-to-end type safety via Hono's RPC client — all running at the edge. Igneus is currently in alpha, so expect everything can change. All PRs welcome.

Features #

  • File-based routing — drop files in src/routes/, routes are scanned and wired automatically
  • SSR pages — export a GET handler + a SolidJS component as default
  • API routes — export named HTTP methods or a Hono app instance
  • Actions — mutations with Accept-based dispatch: JSON for fetch clients, 302 for form submits
  • File-based middleware — _middleware.ts files register scoped Hono middleware automatically
  • Typed RPC — Hono's hc client gives you end-to-end type safety between API routes and pages
  • Vite plugin — HMR, code-splitting, tree-shaking of server exports from client bundles
  • Cloudflare Workers — built for the edge from the ground up

Stack #

Layer Technology
UI SolidJS
Server Hono
Runtime Cloudflare Workers
Build Vite

Getting Started #

# Install dependencies
pnpm install

# Start dev server (example app)
pnpm dev

# Build all packages
pnpm build

Routing #

Routes live under src/routes/. The file path maps directly to the URL:

File Route
src/routes/index.tsx /
src/routes/about.tsx /about
src/routes/users/[id].tsx /users/:id
src/routes/api/users.ts /api/users
src/routes/_middleware.ts middleware for /*
src/routes/admin/_middleware.ts middleware for /admin/*

SSR Pages #

An SSR page exports a GET handler that calls ssr() with data, and a SolidJS component as the default export. InferPageProps derives the component's prop types directly from the handler — no duplication.

// src/routes/users/[id].tsx
import { createRoute, ssr, type InferPageProps } from 'igneus';
import type { Component } from 'solid-js';

export const GET = createRoute(async (c) => {
  const id = c.req.param('id');
  return ssr(c, { user: { id, name: `User ${id}` } });
});

type Props = InferPageProps<typeof GET>;

const UserPage: Component<Props> = (props) => (
  <main>
    <h1>{props.data.user.name}</h1>
  </main>
);

export default UserPage;

API Routes #

Export named HTTP methods, or export a Hono app instance as default for full routing control.

// src/routes/api/users.ts — named method exports
import { createRoute } from 'igneus';

export const GET = createRoute((c) => c.json({ users: [] }));

export const POST = createRoute(async (c) => {
  const body = await c.req.json();
  return c.json({ user: body }, 201);
});
// src/routes/api/users.ts — Hono app export
import { Hono } from 'hono';

const app = new Hono()
  .get('/', (c) => c.json({ users: [] }))
  .post('/', async (c) => c.json({ user: await c.req.json() }, 201));

export default app;

Typed RPC #

Because API routes are Hono apps, you get full end-to-end type safety with hc:

import { hc } from 'hono/client';
import type { AppType } from '../server'; // generated by Igneus

const client = hc<AppType>('/');

// Fully typed — params, response shape, everything
const res = await client.api.users.$get();
const { users } = await res.json();

Actions #

Actions are route handlers for mutations (POST/PUT/PATCH/DELETE) that work for both native HTML form submissions and JS clients without duplicating logic. The same handler dispatches a 302 redirect for form submits and a JSON response for fetch clients.

Server: action() #

Call action() instead of returning a raw response. Pass a redirect target and an optional json payload:

// src/routes/login.tsx
import { action, createRoute } from 'igneus';

export const POST = createRoute(async (c) => {
  const { email, password } = await c.req.parseBody<{ email: string; password: string }>();
  const result = await authenticate(email, password);

  if (result.isErr()) {
    return action(c, {
      redirect: '/login?error=1',
      json: { error: 'Invalid credentials.' },
      status: 401,
    });
  }

  return action(c, { redirect: '/' });
});

action() reads the Accept header and dispatches inline — no extra middleware needed:

Client type Response
Accept: application/json { ...json, redirect }, or { ok: true, redirect } if no json
Native form submit 302 to redirect

Client: useAction() #

useAction is a SolidJS hook that submits a form with Accept: application/json, manages reactive loading/error/data signals, and auto-navigates on the redirect target embedded in the response.

import { useAction } from 'igneus/client';

const login = useAction<typeof POST>('/login');

return (
  <form method="post" action="/login" onSubmit={login.submit}>
    {login.error() && <p>{login.error()}</p>}
    <button disabled={login.loading()}>
      {login.loading() ? 'Signing in…' : 'Sign in'}
    </button>
  </form>
);
Signal / prop Type Description
loading() boolean true while request is in-flight
error() string | null Error string on failure or network error
data() InferActionResult<T> | null Parsed JSON on success
submit (e: SubmitEvent | FormData) => void Attach to onSubmit or call directly

useAction defaults to POST and sends credentials: 'include'. Override the method with useAction<typeof PUT>('/path', { method: 'PUT' }).

Type safety #

InferActionResult extracts the JSON payload type from the handler array, so data() is fully typed:

import type { InferActionResult } from 'igneus';

type LoginResult = InferActionResult<typeof POST>;
// → { error: string } | Record<string, unknown>

Progressive enhancement #

Because action() handles both dispatch modes, the form degrades gracefully without JavaScript:

// JS present:  onSubmit fires → useAction → JSON fetch → SPA navigation
// JS absent:   native submit → server 302 redirect
<form method="post" action="/login" onSubmit={login.submit}>
  ...
</form>

Middleware #

Inline middleware #

createRoute is a thin wrapper around Hono's createHandlers, so middleware chains work exactly as you'd expect:

export const GET = createRoute(authMiddleware, async (c) =>
  ssr(c, { dashboard: await getDashboard(c) }),
);

Middleware files #

Place a _middleware.ts file anywhere under src/routes/ to register a Hono middleware scoped to that directory and all routes beneath it. Export a createMiddleware handler as the default:

// src/routes/_middleware.ts — runs on every route
import { createMiddleware } from 'igneus';

export default createMiddleware(async (c, next) => {
  // e.g. auth check, request logging
  return next();
});

The scope is derived from the file's location:

File Middleware scope
src/routes/_middleware.ts /*
src/routes/admin/_middleware.ts /admin/*

Middleware files are prepended to the Hono chain before any route handlers.

Client Entry #

Create a src/client.tsx that imports the generated route list from the virtual:igneus-client virtual module and calls createHydrationClient to hydrate the SolidJS app in the browser:

// src/client.tsx
import { createHydrationClient } from 'igneus/client';
import { routes } from 'virtual:igneus-client';

createHydrationClient(routes);

virtual:igneus-client is generated by the Vite plugin. It exports a routes array compatible with @solidjs/router, with server-only exports (GET, POST, …) already tree-shaken out.

Vite Plugin #

// vite.config.ts
import { igneus } from 'igneus/vite-plugin';

export default defineConfig({
  plugins: [
    igneus({
      routesDir: './src/routes', // default
      outFile: './src/igneus.gen.ts', // generated server entrypoint — commit this
    }),
  ],
});

The plugin:

  • Scans routes on startup and whenever files are added/removed
  • Writes a igneus.gen.ts server entrypoint (commit it to your repo)
  • Serves a virtual:igneus-client module for the SolidJS client bundle
  • Tree-shakes all server exports (GET, POST, …) from the client build

Monorepo #

igneus/
├── packages/
│   ├── igneus/     # Core framework
│   └── example/    # Example Cloudflare Workers app
├── package.json
└── pnpm-workspace.yaml

Scripts #

pnpm dev            # Start example dev server
pnpm build          # Build all packages
pnpm test           # Run all tests
pnpm typecheck      # Type-check all packages
pnpm lint           # Lint with oxlint
pnpm format         # Format with oxfmt
pnpm format:check   # Check formatting without writing

License #

MIT