create-fluixi 0.1.0-alpha.8 → 1.0.0-alpha.99

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +19 -5
  3. package/dist/index.js +887 -140
  4. package/package.json +19 -2
  5. package/template-spa/README.md +16 -0
  6. package/template-spa/_gitignore +1 -0
  7. package/template-spa/fluixi.config.ts +18 -0
  8. package/template-spa/index.html +3 -3
  9. package/template-spa/package.json +15 -7
  10. package/template-spa/src/app.tsx +30 -7
  11. package/template-spa/src/entry-client.tsx +8 -0
  12. package/template-spa/src/entry-server.ts +22 -0
  13. package/template-spa/src/routes/about.tsx +8 -0
  14. package/template-spa/src/routes/index.tsx +24 -0
  15. package/template-spa/tsconfig.json +2 -2
  16. package/template-spa-html/README.md +19 -0
  17. package/template-spa-html/_gitignore +1 -0
  18. package/template-spa-html/fluixi.config.ts +18 -0
  19. package/template-spa-html/index.html +3 -3
  20. package/template-spa-html/package.json +15 -6
  21. package/template-spa-html/src/app.ts +28 -7
  22. package/template-spa-html/src/entry-client.ts +8 -0
  23. package/template-spa-html/src/entry-server.ts +22 -0
  24. package/template-spa-html/src/routes/about.ts +10 -0
  25. package/template-spa-html/src/routes/index.ts +24 -0
  26. package/template-spa-html/tsconfig.json +2 -2
  27. package/template-ssr/_gitignore +1 -0
  28. package/template-ssr/fluixi.config.ts +6 -2
  29. package/template-ssr/package.json +9 -4
  30. package/template-ssr/src/app.tsx +5 -5
  31. package/template-ssr/src/entry-client.tsx +2 -2
  32. package/template-ssr/src/entry-server.ts +7 -2
  33. package/template-ssr/src/routes/index.tsx +2 -3
  34. package/template-ssr-html/_gitignore +1 -0
  35. package/template-ssr-html/fluixi.config.ts +6 -2
  36. package/template-ssr-html/package.json +10 -4
  37. package/template-ssr-html/src/app.ts +4 -4
  38. package/template-ssr-html/src/entry-client.ts +2 -2
  39. package/template-ssr-html/src/entry-server.ts +7 -2
  40. package/template-ssr-html/src/routes/index.ts +2 -3
  41. package/template-spa/src/main.tsx +0 -5
  42. package/template-spa/vite.config.ts +0 -6
  43. package/template-spa-html/src/main.ts +0 -5
  44. package/template-spa-html/vite.config.ts +0 -6
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "create-fluixi",
3
- "version": "0.1.0-alpha.8",
3
+ "version": "1.0.0-alpha.99",
4
4
  "license": "MIT",
5
+ "author": "Ibrahima Touré",
5
6
  "description": "Scaffold a new Fluixi app — `npm create fluixi <dir>`.",
6
7
  "type": "module",
7
8
  "bin": {
@@ -25,7 +26,23 @@
25
26
  "url": "https://github.com/fluixi/core.git",
26
27
  "directory": "packages/create"
27
28
  },
29
+ "devDependencies": {
30
+ "esbuild": "^0.24.0",
31
+ "vitest": "^5.0.3",
32
+ "@fluixi/cli": "1.0.0-alpha.99",
33
+ "@fluixi/compiler": "1.0.0-alpha.99"
34
+ },
35
+ "nx": {
36
+ "targets": {
37
+ "test": {
38
+ "dependsOn": [
39
+ "build"
40
+ ]
41
+ }
42
+ }
43
+ },
28
44
  "scripts": {
29
- "build": "tsc -p tsconfig.lib.json"
45
+ "build": "tsc -p tsconfig.lib.json && esbuild src/index.ts --bundle --platform=node --format=esm --target=node18 --outfile=dist/index.js",
46
+ "test": "vitest run"
30
47
  }
31
48
  }
@@ -0,0 +1,16 @@
1
+ # Fluixi app
2
+
3
+ Scaffolded with `npm create fluixi`. Client-rendered with file-based routing, via
4
+ [`@fluixi/start`](https://www.npmjs.com/package/@fluixi/start) (`ssr: false` in `fluixi.config.ts`).
5
+
6
+ ```bash
7
+ pnpm install
8
+ pnpm dev # dev server (HMR)
9
+ pnpm build # production build
10
+ pnpm start # serve the production build
11
+ ```
12
+
13
+ - Routes live in `src/routes/` (file-based).
14
+ - `src/app.tsx` is the shell layout; `src/entry-client.tsx` renders it in the browser. `src/entry-server.ts`
15
+ serves the page shell and runs server functions and middleware.
16
+ - Config in `fluixi.config.ts`; `ssr: true` there renders on the server instead.
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from '@fluixi/start/config';
2
+ import { nodeAdapter } from '@fluixi/start/adapter';
3
+
4
+ export default defineConfig({
5
+ port: 3000,
6
+ // Client-rendered: the server sends the page shell and the browser renders it. Server
7
+ // functions, middleware and API routes still run on the server. `ssr: true` renders on
8
+ // the server instead.
9
+ ssr: false,
10
+ // Where a capitalised tag with no import in scope comes from. One pattern covers
11
+ // the whole folder, so a new component needs no config, `fluixi g component Card`
12
+ // and `<Card />` just works. Delete this if you'd rather import every component.
13
+ resolve: [{ match: /^([A-Z]\w+)$/, module: '/src/components/$1.tsx' }],
14
+ // `pnpm start` runs a Node process from this directory, so the framework stays an
15
+ // import rather than being copied into dist/server. Swap in a deploy adapter ,
16
+ // cloudflare, netlify, vercel: to get the layout that platform expects.
17
+ adapter: nodeAdapter,
18
+ });
@@ -3,10 +3,10 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Fluixi App</title>
6
+ <title>Fluixi Start Example</title>
7
7
  </head>
8
8
  <body>
9
- <div id="app"></div>
10
- <script type="module" src="/src/main.tsx"></script>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/entry-client.tsx"></script>
11
11
  </body>
12
12
  </html>
@@ -4,19 +4,27 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "vite",
8
- "build": "vite build",
9
- "preview": "vite preview"
7
+ "dev": "fluixi dev",
8
+ "build": "fluixi build",
9
+ "start": "fluixi start"
10
10
  },
11
11
  "dependencies": {
12
+ "@fluixi/cli": "alpha",
12
13
  "@fluixi/core": "alpha",
13
- "@fluixi/jsx": "alpha",
14
+ "@fluixi/di": "alpha",
14
15
  "@fluixi/dom": "alpha",
15
- "@fluixi/reactive": "alpha"
16
+ "@fluixi/head": "alpha",
17
+ "@fluixi/jsx": "alpha",
18
+ "@fluixi/reactive": "alpha",
19
+ "@fluixi/router": "alpha",
20
+ "@fluixi/server": "alpha",
21
+ "@fluixi/start": "alpha",
22
+ "@fluixi/storage": "alpha"
16
23
  },
17
24
  "devDependencies": {
18
25
  "@fluixi/ts-plugin": "alpha",
19
- "@fluixi/vite-plugin": "alpha",
20
- "vite": "^5.0.0"
26
+ "@types/node": "^20.0.0",
27
+ "typescript": "^7.0.2",
28
+ "vite": "^8.3.2"
21
29
  }
22
30
  }
@@ -1,13 +1,36 @@
1
- import { createSignal } from '@fluixi/core';
1
+ import { Router, Outlet, Link, createMemoryHistory } from '@fluixi/start/router';
2
+ import { Suspense } from '@fluixi/core';
3
+ import { routes } from '@fluixi/core/routes';
2
4
 
3
- export function App() {
4
- const [count, setCount] = createSignal(0);
5
+ // Shell layout around the routed page. File-routes (src/routes/*) are lazy, so the
6
+ // <Outlet/> sits under <Suspense>: async SSR resolves their content server-side.
7
+ function RootLayout() {
5
8
  return (
6
9
  <div class="app">
7
- <h1>Fluixi</h1>
8
- <button onClick={() => setCount(count() - 1)}>-</button>
9
- <span>{count()}</span>
10
- <button onClick={() => setCount(count() + 1)}>+</button>
10
+ <nav>
11
+ <Link href="/">home</Link>
12
+ {' · '}
13
+ <Link href="/about">about</Link>
14
+ </nav>
15
+ <main>
16
+ <Suspense fallback={<p>loading…</p>}>
17
+ <Outlet />
18
+ </Suspense>
19
+ </main>
11
20
  </div>
12
21
  );
13
22
  }
23
+
24
+ // Exported so entry-client can hand it to startClient, which preloads the current route's
25
+ // lazy chunk before the first render.
26
+ export const appRoutes = [{ path: '/', component: RootLayout, children: routes as any }];
27
+
28
+ export default function App(props?: { url?: string }) {
29
+ // On the server, match the request URL (memory history); on the client, default
30
+ // to browser history.
31
+ const history =
32
+ typeof window === 'undefined'
33
+ ? createMemoryHistory(props?.url ?? '/')
34
+ : undefined;
35
+ return <Router routes={appRoutes as any} history={history as any} />;
36
+ }
@@ -0,0 +1,8 @@
1
+ // Client entry: renders the app into `#root` (the @fluixi/start mountId). The server sends
2
+ // the page shell only (`ssr: false`); with `ssr: true` the same call hydrates instead.
3
+ import { startClient } from '@fluixi/core/client';
4
+ import App, { appRoutes } from './app.js';
5
+
6
+ // Passing the route tree lets startClient preload the matched route's lazy chunk before
7
+ // the first render, so the page does not wait for the router to boot to fetch it.
8
+ startClient(App, { root: '#root', routes: appRoutes });
@@ -0,0 +1,22 @@
1
+ // SSR entry: @fluixi/start's dev/build/start load this. It calls `renderStream`
2
+ // (streaming: head flushed first, body streamed) when present, else `render` (string).
3
+ import App from './app.js';
4
+ import { renderRequestAsync, renderToBodyStream } from '@fluixi/server';
5
+
6
+ export function render(url: string): Promise<string> {
7
+ return renderRequestAsync(App, { url });
8
+ }
9
+
10
+ export function renderStream(url: string): ReadableStream<Uint8Array> {
11
+ return renderToBodyStream(App, { url });
12
+ }
13
+
14
+ // Server-function RPC dispatch: re-exported so the dispatcher shares the registry that
15
+ // this app's `"use server"` modules populate. @fluixi/start routes RPC calls here.
16
+ import '@fluixi/start/server-fns'; // registers every "use server" module (incl. lazy routes)
17
+ export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
18
+
19
+ // File-based API routes under src/api. The dev server dispatches to them itself; a built
20
+ // server finds them through this, and without it every /api request would fall through
21
+ // to the page renderer. Harmless when there are no routes.
22
+ export { isApiRequest, handleApiRequest } from '@fluixi/start/api-routes';
@@ -0,0 +1,8 @@
1
+ export default function About() {
2
+ return (
3
+ <section class="about">
4
+ <h1>About</h1>
5
+ <p>A second file-route — proves URL-based SSR matching works.</p>
6
+ </section>
7
+ );
8
+ }
@@ -0,0 +1,24 @@
1
+ import { seo } from '@fluixi/start/head';
2
+
3
+ const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v), ms));
4
+
5
+ // A data-gated route, like a real page: the browser shows the content once the resource
6
+ // resolves.
7
+ export default function Home() {
8
+ const data = $resource(() => tick('Hello from Fluixi Start 👋'));
9
+
10
+ // Per-route document head: written into <head> in the browser and kept reactive. With
11
+ // `ssr: true` it is rendered on the server too, which is what crawlers and link previews read. The head engine is always on; seo() is optional, call it
12
+ // only where you want page metadata. Drop in og/twitter/canonical/jsonLd as your app grows.
13
+ seo({
14
+ title: 'Fluixi Start',
15
+ description: 'A Fluixi app rendered in the browser, scaffolded by the fluixi CLI.',
16
+ });
17
+
18
+ return (
19
+ <section class="home">
20
+ <h1>{data()}</h1>
21
+ <p>Rendered in the browser, served by the fluixi CLI.</p>
22
+ </section>
23
+ );
24
+ }
@@ -8,8 +8,8 @@
8
8
  "strict": false,
9
9
  "skipLibCheck": true,
10
10
  "noEmit": true,
11
- "types": ["vite/client"],
11
+ "types": ["node", "vite/client"],
12
12
  "plugins": [{ "name": "@fluixi/ts-plugin" }]
13
13
  },
14
- "include": ["src", "fluixi.d.ts", "vite.config.ts"]
14
+ "include": ["src", "fluixi.d.ts", "fluixi.config.ts"]
15
15
  }
@@ -0,0 +1,19 @@
1
+ # Fluixi app
2
+
3
+ Scaffolded with `npm create fluixi`. Client-rendered with file-based routing, via
4
+ [`@fluixi/start`](https://www.npmjs.com/package/@fluixi/start) (`ssr: false` in `fluixi.config.ts`).
5
+
6
+ This variant is authored with `` html`` `` templates (no JSX), so the sources are plain
7
+ `.ts` files and `tsconfig.json` doesn't configure `jsx`. `@fluixi/ts-plugin` gives the
8
+ templates full TypeScript support (hover, completion, type-checking) in your editor.
9
+
10
+ ```bash
11
+ pnpm install
12
+ pnpm dev # dev server (HMR)
13
+ pnpm build # production build
14
+ pnpm start # serve the production build
15
+ ```
16
+
17
+ - Routes live in `src/routes/` (file-based).
18
+ - `src/app.ts` is the shell layout; `src/entry-{server,client}.ts` are the SSR/hydration entries.
19
+ - Config in `fluixi.config.ts`; `ssr: true` there renders on the server instead.
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from '@fluixi/start/config';
2
+ import { nodeAdapter } from '@fluixi/start/adapter';
3
+
4
+ export default defineConfig({
5
+ port: 3000,
6
+ // Client-rendered: the server sends the page shell and the browser renders it. Server
7
+ // functions, middleware and API routes still run on the server. `ssr: true` renders on
8
+ // the server instead.
9
+ ssr: false,
10
+ // Where a capitalised tag with no import in scope comes from. One pattern covers
11
+ // the whole folder, so a new component needs no config, `fluixi g component Card`
12
+ // and `<Card />` just works. Delete this if you'd rather import every component.
13
+ resolve: [{ match: /^([A-Z]\w+)$/, module: '/src/components/$1.ts' }],
14
+ // `pnpm start` runs a Node process from this directory, so the framework stays an
15
+ // import rather than being copied into dist/server. Swap in a deploy adapter ,
16
+ // cloudflare, netlify, vercel: to get the layout that platform expects.
17
+ adapter: nodeAdapter,
18
+ });
@@ -3,10 +3,10 @@
3
3
  <head>
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <title>Fluixi App</title>
6
+ <title>Fluixi Start Example</title>
7
7
  </head>
8
8
  <body>
9
- <div id="app"></div>
10
- <script type="module" src="/src/main.ts"></script>
9
+ <div id="root"></div>
10
+ <script type="module" src="/src/entry-client.ts"></script>
11
11
  </body>
12
12
  </html>
@@ -4,18 +4,27 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "vite",
8
- "build": "vite build",
9
- "preview": "vite preview"
7
+ "dev": "fluixi dev",
8
+ "build": "fluixi build",
9
+ "start": "fluixi start"
10
10
  },
11
11
  "dependencies": {
12
+ "@fluixi/cli": "alpha",
12
13
  "@fluixi/core": "alpha",
14
+ "@fluixi/di": "alpha",
13
15
  "@fluixi/dom": "alpha",
14
- "@fluixi/reactive": "alpha"
16
+ "@fluixi/head": "alpha",
17
+ "@fluixi/jsx": "alpha",
18
+ "@fluixi/reactive": "alpha",
19
+ "@fluixi/router": "alpha",
20
+ "@fluixi/server": "alpha",
21
+ "@fluixi/start": "alpha",
22
+ "@fluixi/storage": "alpha"
15
23
  },
16
24
  "devDependencies": {
17
25
  "@fluixi/ts-plugin": "alpha",
18
- "@fluixi/vite-plugin": "alpha",
19
- "vite": "^5.0.0"
26
+ "@types/node": "^20.0.0",
27
+ "typescript": "^7.0.2",
28
+ "vite": "^8.3.2"
20
29
  }
21
30
  }
@@ -1,13 +1,34 @@
1
- import { createSignal, html } from '@fluixi/core';
1
+ import { Router, Outlet, createMemoryHistory, Link } from '@fluixi/start/router';
2
+ import { Suspense } from '@fluixi/core';
3
+ import { html } from '@fluixi/start';
4
+ import { routes } from '@fluixi/core/routes';
2
5
 
3
- export function App() {
4
- const [count, setCount] = createSignal(0);
6
+ // Shell layout around the routed page. File-routes (src/routes/*) are lazy, so the
7
+ // <Outlet/> sits under <Suspense>: async SSR resolves their content server-side.
8
+ // Components are interpolated as `<${Comp}/>` so TypeScript sees them referenced.
9
+ function RootLayout() {
5
10
  return html`
6
11
  <div class="app">
7
- <h1>Fluixi</h1>
8
- <button @click=${() => setCount(count() - 1)}>-</button>
9
- <span>${count()}</span>
10
- <button @click=${() => setCount(count() + 1)}>+</button>
12
+ <nav>
13
+ <${Link} href="/">home<//> · <${Link} href="/about">about<//>
14
+ </nav>
15
+ <main>
16
+ <${Suspense} fallback=${html`<p>loading…</p>`}>
17
+ <${Outlet} />
18
+ </${Suspense}>
19
+ </main>
11
20
  </div>
12
21
  `;
13
22
  }
23
+
24
+ // Exported so entry-client can hand it to startClient, which preloads the current route's
25
+ // lazy chunk before the first render.
26
+ export const appRoutes = [{ path: '/', component: RootLayout, children: routes as any }];
27
+
28
+ export default function App(props?: { url?: string }) {
29
+ // On the server, match the request URL (memory history); on the client, default
30
+ // to browser history.
31
+ const history =
32
+ typeof window === 'undefined' ? createMemoryHistory(props?.url ?? '/') : undefined;
33
+ return html`<${Router} routes=${appRoutes as any} history=${history as any} />`;
34
+ }
@@ -0,0 +1,8 @@
1
+ // Client entry: renders the app into `#root` (the @fluixi/start mountId). The server sends
2
+ // the page shell only (`ssr: false`); with `ssr: true` the same call hydrates instead.
3
+ import { startClient } from '@fluixi/core/client';
4
+ import App, { appRoutes } from './app.js';
5
+
6
+ // Passing the route tree lets startClient preload the matched route's lazy chunk before
7
+ // the first render, so the page does not wait for the router to boot to fetch it.
8
+ startClient(App, { root: '#root', routes: appRoutes });
@@ -0,0 +1,22 @@
1
+ // SSR entry: @fluixi/start's dev/build/start load this. It calls `renderStream`
2
+ // (streaming: head flushed first, body streamed) when present, else `render` (string).
3
+ import App from './app.js';
4
+ import { renderRequestAsync, renderToBodyStream } from '@fluixi/server';
5
+
6
+ export function render(url: string): Promise<string> {
7
+ return renderRequestAsync(App, { url });
8
+ }
9
+
10
+ export function renderStream(url: string): ReadableStream<Uint8Array> {
11
+ return renderToBodyStream(App, { url });
12
+ }
13
+
14
+ // Server-function RPC dispatch: re-exported so the dispatcher shares the registry that
15
+ // this app's `"use server"` modules populate. @fluixi/start routes RPC calls here.
16
+ import '@fluixi/start/server-fns'; // registers every "use server" module (incl. lazy routes)
17
+ export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
18
+
19
+ // File-based API routes under src/api. The dev server dispatches to them itself; a built
20
+ // server finds them through this, and without it every /api request would fall through
21
+ // to the page renderer. Harmless when there are no routes.
22
+ export { isApiRequest, handleApiRequest } from '@fluixi/start/api-routes';
@@ -0,0 +1,10 @@
1
+ import { html } from '@fluixi/start';
2
+
3
+ export default function About() {
4
+ return html`
5
+ <section class="about">
6
+ <h1>About</h1>
7
+ <p>A second file-route — proves URL-based SSR matching works.</p>
8
+ </section>
9
+ `;
10
+ }
@@ -0,0 +1,24 @@
1
+ import { seo } from '@fluixi/start/head';
2
+ import { html } from '@fluixi/start';
3
+
4
+ const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v), ms));
5
+
6
+ // A data-gated route, like a real page: the browser shows the content once the resource
7
+ // resolves.
8
+ export default function Home() {
9
+ const data = $resource(() => tick('Hello from Fluixi Start 👋'));
10
+
11
+ // Per-route document head: written into <head> in the browser and kept reactive. With
12
+ // `ssr: true` it is rendered on the server too, which is what crawlers and link previews read. seo() is optional; call it where you want metadata.
13
+ seo({
14
+ title: 'Fluixi Start',
15
+ description: 'A Fluixi app rendered in the browser, scaffolded by the fluixi CLI.',
16
+ });
17
+
18
+ return html`
19
+ <section class="home">
20
+ <h1>${data()}</h1>
21
+ <p>Rendered in the browser, served by the fluixi CLI.</p>
22
+ </section>
23
+ `;
24
+ }
@@ -6,8 +6,8 @@
6
6
  "strict": false,
7
7
  "skipLibCheck": true,
8
8
  "noEmit": true,
9
- "types": ["vite/client"],
9
+ "types": ["node", "vite/client"],
10
10
  "plugins": [{ "name": "@fluixi/ts-plugin" }]
11
11
  },
12
- "include": ["src", "fluixi.d.ts", "vite.config.ts"]
12
+ "include": ["src", "fluixi.d.ts", "fluixi.config.ts"]
13
13
  }
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -3,8 +3,12 @@ import { nodeAdapter } from '@fluixi/start/adapter';
3
3
 
4
4
  export default defineConfig({
5
5
  port: 3000,
6
+ // Where a capitalised tag with no import in scope comes from. One pattern covers
7
+ // the whole folder, so a new component needs no config, `fluixi g component Card`
8
+ // and `<Card />` just works. Delete this if you'd rather import every component.
9
+ resolve: [{ match: /^([A-Z]\w+)$/, module: '/src/components/$1.tsx' }],
6
10
  // `pnpm start` runs a Node process from this directory, so the framework stays an
7
- // import rather than being copied into dist/server. Swap in a deploy adapter —
8
- // cloudflare, netlify, vercel — to get the layout that platform expects.
11
+ // import rather than being copied into dist/server. Swap in a deploy adapter ,
12
+ // cloudflare, netlify, vercel: to get the layout that platform expects.
9
13
  adapter: nodeAdapter,
10
14
  });
@@ -10,16 +10,21 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@fluixi/cli": "alpha",
13
- "@fluixi/start": "alpha",
14
13
  "@fluixi/core": "alpha",
14
+ "@fluixi/di": "alpha",
15
+ "@fluixi/dom": "alpha",
16
+ "@fluixi/head": "alpha",
15
17
  "@fluixi/jsx": "alpha",
16
- "@fluixi/server": "alpha",
17
18
  "@fluixi/reactive": "alpha",
18
- "@fluixi/dom": "alpha"
19
+ "@fluixi/router": "alpha",
20
+ "@fluixi/server": "alpha",
21
+ "@fluixi/start": "alpha",
22
+ "@fluixi/storage": "alpha"
19
23
  },
20
24
  "devDependencies": {
21
25
  "@fluixi/ts-plugin": "alpha",
22
26
  "@types/node": "^20.0.0",
23
- "vite": "^5.0.0"
27
+ "typescript": "^7.0.2",
28
+ "vite": "^8.3.2"
24
29
  }
25
30
  }
@@ -1,16 +1,16 @@
1
- import { Router, Outlet, createMemoryHistory } from '@fluixi/start/router';
1
+ import { Router, Outlet, Link, createMemoryHistory } from '@fluixi/start/router';
2
2
  import { Suspense } from '@fluixi/core';
3
3
  import { routes } from '@fluixi/core/routes';
4
4
 
5
5
  // Shell layout around the routed page. File-routes (src/routes/*) are lazy, so the
6
- // <Outlet/> sits under <Suspense> — async SSR resolves their content server-side.
6
+ // <Outlet/> sits under <Suspense>: async SSR resolves their content server-side.
7
7
  function RootLayout() {
8
8
  return (
9
9
  <div class="app">
10
10
  <nav>
11
- <a href="/">home</a>
11
+ <Link href="/">home</Link>
12
12
  {' · '}
13
- <a href="/about">about</a>
13
+ <Link href="/about">about</Link>
14
14
  </nav>
15
15
  <main>
16
16
  <Suspense fallback={<p>loading…</p>}>
@@ -21,7 +21,7 @@ function RootLayout() {
21
21
  );
22
22
  }
23
23
 
24
- // Exported so entry-client can hand it to startClient — it preloads the current route's
24
+ // Exported so entry-client can hand it to startClient, it preloads the current route's
25
25
  // lazy chunk before hydrating, so the server-rendered DOM is adopted in place (flash-free).
26
26
  export const appRoutes = [{ path: '/', component: RootLayout, children: routes as any }];
27
27
 
@@ -1,10 +1,10 @@
1
- // Client entry — hydrates the server-rendered markup. The app HTML is injected into
1
+ // Client entry: hydrates the server-rendered markup. The app HTML is injected into
2
2
  // `#root` (the @fluixi/start mountId), so hydrate that container.
3
3
  import { startClient } from '@fluixi/core/client';
4
4
  import App, { appRoutes } from './app.js';
5
5
 
6
6
  // Passing the route tree lets startClient preload the matched route's lazy chunk before
7
- // hydrating — the lazy file-route then resolves synchronously and adopts the server DOM in
7
+ // hydrating: the lazy file-route then resolves synchronously and adopts the server DOM in
8
8
  // place (no first-paint flash, no duplicate). It also enables auto-hydration of the
9
9
  // server-rendered root.
10
10
  startClient(App, { root: '#root', routes: appRoutes });
@@ -1,4 +1,4 @@
1
- // SSR entry — @fluixi/start's dev/build/start load this. It calls `renderStream`
1
+ // SSR entry: @fluixi/start's dev/build/start load this. It calls `renderStream`
2
2
  // (streaming: head flushed first, body streamed) when present, else `render` (string).
3
3
  import App from './app.js';
4
4
  import { renderRequestAsync, renderToBodyStream } from '@fluixi/server';
@@ -11,7 +11,12 @@ export function renderStream(url: string): ReadableStream<Uint8Array> {
11
11
  return renderToBodyStream(App, { url });
12
12
  }
13
13
 
14
- // Server-function RPC dispatch — re-exported so the dispatcher shares the registry that
14
+ // Server-function RPC dispatch: re-exported so the dispatcher shares the registry that
15
15
  // this app's `"use server"` modules populate. @fluixi/start routes RPC calls here.
16
16
  import '@fluixi/start/server-fns'; // registers every "use server" module (incl. lazy routes)
17
17
  export { isServerFnRequest, handleServerFn } from '@fluixi/start/server-fn';
18
+
19
+ // File-based API routes under src/api. The dev server dispatches to them itself; a built
20
+ // server finds them through this, and without it every /api request would fall through
21
+ // to the page renderer. Harmless when there are no routes.
22
+ export { isApiRequest, handleApiRequest } from '@fluixi/start/api-routes';
@@ -1,4 +1,3 @@
1
- import { createResource } from '@fluixi/reactive/signal';
2
1
  import { seo } from '@fluixi/start/head';
3
2
 
4
3
  const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v), ms));
@@ -6,9 +5,9 @@ const tick = <T,>(v: T, ms = 30) => new Promise<T>((r) => setTimeout(() => r(v),
6
5
  // A data-gated route, like a real page: the resource is awaited during SSR so the
7
6
  // content (not the spinner) is server-rendered, then hydrated.
8
7
  export default function Home() {
9
- const [data] = createResource(() => tick('Hello from Fluixi Start 👋'));
8
+ const data = $resource(() => tick('Hello from Fluixi Start 👋'));
10
9
 
11
- // Per-route document head — rendered into <head> on the server (great for crawlers/links)
10
+ // Per-route document head: rendered into <head> on the server (great for crawlers/links)
12
11
  // and kept reactive on the client. The head engine is always on; seo() is optional, call it
13
12
  // only where you want page metadata. Drop in og/twitter/canonical/jsonLd as your app grows.
14
13
  seo({
@@ -2,3 +2,4 @@ node_modules
2
2
  dist
3
3
  *.log
4
4
  .DS_Store
5
+ .fluixi
@@ -3,8 +3,12 @@ import { nodeAdapter } from '@fluixi/start/adapter';
3
3
 
4
4
  export default defineConfig({
5
5
  port: 3000,
6
+ // Where a capitalised tag with no import in scope comes from. One pattern covers
7
+ // the whole folder, so a new component needs no config, `fluixi g component Card`
8
+ // and `<Card />` just works. Delete this if you'd rather import every component.
9
+ resolve: [{ match: /^([A-Z]\w+)$/, module: '/src/components/$1.ts' }],
6
10
  // `pnpm start` runs a Node process from this directory, so the framework stays an
7
- // import rather than being copied into dist/server. Swap in a deploy adapter —
8
- // cloudflare, netlify, vercel — to get the layout that platform expects.
11
+ // import rather than being copied into dist/server. Swap in a deploy adapter ,
12
+ // cloudflare, netlify, vercel: to get the layout that platform expects.
9
13
  adapter: nodeAdapter,
10
14
  });