@fluixi/start
v0.1.0-alpha.47
Published
The Fluixi meta-framework — dev server, build, and production SSR server over @fluixi/server + Vite.
Readme
@fluixi/start
The Fluixi meta-framework — zero-config dev/build/start with SSR, file routing, and hydration.
✨ Overview
@fluixi/start is dev, build, and production start over @fluixi/server
- Vite, so apps stop hand-rolling a
server.mjs. This package is the runtime (programmatic commands + config); thefluixiCLI lives in@fluixi/cli, and you scaffold a new app withcreate-fluixi(npm create fluixi).
fluixi dev # SSR dev server (Vite middleware + HMR)
fluixi build # client + server bundles → dist/client, dist/server
fluixi start # production SSR server (after build)📦 Installation
pnpm add @fluixi/start @fluixi/cli🗂️ Conventions
| Default | Config key |
| --- | --- |
| src/entry-server.ts exporting render(url) (and optionally renderStream(url)) | serverEntry |
| src/entry-client.ts (hydration) | clientEntry |
| src/routes/ (file-based routes → virtual:fluixi-routes) | routesDir |
| src/middleware.ts (optional request middleware) | middleware |
| index.html with <div id="root"></div> | template / mountId |
| port 3000 | port |
⚙️ Config
fluixi.config.{ts,mts,mjs,js} — TypeScript configs are bundled on the fly:
import { defineConfig } from '@fluixi/start/config';
export default defineConfig({
port: 3010,
ssrNoExternal: ['@medusajs/js-sdk'], // SSR deps Vite must bundle
});🚀 Features
- Streaming SSR — export
renderStream(url)(via@fluixi/server'srenderToBodyStream) and theindex.htmlhead is flushed first, then the app body is streamed into the mount point. - Middleware / guards —
src/middleware.tsdefault-exportsdefineMiddleware([...]), a(request, next) => Responsechain run before SSR (auth redirects, headers, …). - Server functions — a
"use server"function runs only on the server and is callable from the client over RPC (/_server, same-origin CSRF);getRequestEvent()works inside it. - Routing —
@fluixi/start/routerre-exports@fluixi/core/router-next:Router,Outlet,Link,Form, the hooks,createMemoryHistory. - Deploy adapters —
createProdHandlerbuilds a runtime-neutral fetch handler;nodeAdapter(Node http + static files) andwebAdapter(export { fetch }for edge/worker) serve it. The same handler runs on Node, Bun, Deno, and edge runtimes.
🧰 Programmatic
import { dev, build, start, createProdHandler } from '@fluixi/start';
await dev({ port: 3010 }); // or build() / start()
const handler = await createProdHandler(); // a (Request) => Promise<Response>🔌 Subpaths
| Import | What |
| --- | --- |
| @fluixi/start | dev/build/start, the fetch-handler layer, adapters, middleware helpers |
| @fluixi/start/config | defineConfig, loadConfig, resolveConfig |
| @fluixi/start/router | the routing surface (re-export of @fluixi/core/router-next) |
| @fluixi/start/server-fn | server-function runtime (isServerFnRequest, handleServerFn) |
