create-thexjs-app 0.1.2 → 0.1.4

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 (36) hide show
  1. package/dist/index.js +43 -20
  2. package/package.json +2 -7
  3. package/templates/basic/src/components/Link.tsx +6 -12
  4. package/templates/basic/src/lib/auth.ts +17 -6
  5. package/templates/basic/src/pages/login.tsx +11 -4
  6. package/templates/basic/src/pages/placeholder.tsx +11 -2
  7. package/templates/blog/src/pages/index.tsx +4 -1
  8. package/templates/default/src/pages/index.tsx +1 -1
  9. package/templates/landing/src/components/code-block.tsx +104 -10
  10. package/templates/landing/src/layouts/main.tsx +48 -18
  11. package/templates/landing/src/pages/docs/_layout.tsx +26 -14
  12. package/templates/landing/src/pages/docs/api-routes.tsx +1 -1
  13. package/templates/landing/src/pages/docs/build-deploy.tsx +1 -1
  14. package/templates/landing/src/pages/docs/configuration.tsx +1 -1
  15. package/templates/landing/src/pages/docs/content-collections.tsx +1 -1
  16. package/templates/landing/src/pages/docs/data-layer.tsx +3 -3
  17. package/templates/landing/src/pages/docs/getting-started.tsx +4 -4
  18. package/templates/landing/src/pages/docs/installation.tsx +16 -20
  19. package/templates/landing/src/pages/docs/introduction.tsx +8 -11
  20. package/templates/landing/src/pages/docs/layouts.tsx +1 -1
  21. package/templates/landing/src/pages/docs/middleware.tsx +1 -1
  22. package/templates/landing/src/pages/docs/packages/cli.tsx +10 -7
  23. package/templates/landing/src/pages/docs/packages/core.tsx +9 -5
  24. package/templates/landing/src/pages/docs/packages/env.tsx +3 -3
  25. package/templates/landing/src/pages/docs/pages.tsx +1 -1
  26. package/templates/landing/src/pages/docs/routing.tsx +1 -1
  27. package/templates/landing/src/pages/docs/server-functions.tsx +60 -6
  28. package/templates/landing/src/pages/features.tsx +1 -1
  29. package/templates/landing/src/pages/index.tsx +91 -126
  30. package/templates/landing/src/styles/globals.css +81 -45
  31. package/templates/landing/tsconfig.json +6 -1
  32. package/templates/saas/src/api/auth/login.ts +31 -0
  33. package/templates/saas/src/lib/auth.ts +27 -6
  34. package/templates/saas/src/pages/dashboard/settings.tsx +8 -2
  35. package/templates/saas/src/pages/login.tsx +83 -10
  36. package/templates/landing/src/pages/contact.tsx +0 -95
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">API Routes</p>
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Configuration</p>
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Data Layer</p>
@@ -20,7 +20,7 @@ export default function DocPage({}: RouteProps) {
20
20
  </p>
21
21
  <CodeBlock
22
22
  label="src/lib/db.ts"
23
- code={`import { connectSQLite, runSQLiteMigrations } from "@thexjs/core";
23
+ code={`import { connectSQLite, runSQLiteMigrations } from "@thexjs/core/data";
24
24
 
25
25
  const db = connectSQLite("data/app.db");
26
26
 
@@ -96,7 +96,7 @@ export default function Users({ loaderData }: RouteProps<typeof loader>) {
96
96
  </p>
97
97
  <CodeBlock
98
98
  label="src/lib/db.ts"
99
- code={`import { connectPostgres, runPostgresMigrations } from "@thexjs/core";
99
+ code={`import { connectPostgres, runPostgresMigrations } from "@thexjs/core/data";
100
100
 
101
101
  const db = connectPostgres({
102
102
  connectionString: process.env.DATABASE_URL,
@@ -4,7 +4,7 @@ import { CodeBlock } from "../../components/code-block";
4
4
 
5
5
  export const mode = "static";
6
6
 
7
- export default function DocPage({}: RouteProps) {
7
+ export default function DocPage(_props: RouteProps) {
8
8
  return (
9
9
  <div>
10
10
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
@@ -31,9 +31,9 @@ cd my-app
31
31
  bun run dev`}
32
32
  />
33
33
  <p className="mt-4 text-muted-foreground">
34
- Press Enter at the template prompt to use{" "}
35
- <span className="text-foreground">default</span> (recommended) — a single home page. Your
36
- app will be running at <span className="text-foreground">http://localhost:3000</span>.
34
+ Press Enter at the template prompt to use <span className="text-foreground">default</span>{" "}
35
+ (recommended) — a single home page. Your app will be running at{" "}
36
+ <span className="text-foreground">http://localhost:3000</span>.
37
37
  </p>
38
38
 
39
39
  <h2 className="mt-12 text-xl font-bold tracking-tight">Manual setup</h2>
@@ -1,10 +1,10 @@
1
1
  import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
- import { CodeBlock } from "../../components/code-block";
3
+ import { CodeBlock, TerminalBlock } from "../../components/code-block";
4
4
 
5
5
  export const mode = "static";
6
6
 
7
- export default function DocPage({}: RouteProps) {
7
+ export default function DocPage(_props: RouteProps) {
8
8
  return (
9
9
  <div>
10
10
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Installation</p>
@@ -23,7 +23,7 @@ export default function DocPage({}: RouteProps) {
23
23
  — x uses <span className="text-foreground">Bun.serve</span>,{" "}
24
24
  <span className="text-foreground">Bun.file</span>, and other Bun-only APIs. Verify with:
25
25
  </p>
26
- <CodeBlock label="terminal" lang="bash" code="bun --version" />
26
+ <TerminalBlock label="terminal — bun" code="bun --version" />
27
27
 
28
28
  <h2 className="mt-12 text-xl font-bold tracking-tight">Create a new project</h2>
29
29
  <p className="mt-3 text-muted-foreground">
@@ -33,41 +33,37 @@ export default function DocPage({}: RouteProps) {
33
33
  <span className="text-foreground">@thexjs/cli</span> versions, and runs{" "}
34
34
  <span className="text-foreground">bun install</span>.
35
35
  </p>
36
- <CodeBlock
37
- label="terminal"
38
- lang="bash"
36
+ <TerminalBlock
37
+ label="~/projects — zsh"
39
38
  code={`bun create thexjs-app@latest my-app
40
39
  cd my-app
41
40
  bun run dev`}
42
41
  />
43
42
  <p className="mt-4 text-muted-foreground">
44
43
  When prompted for a template, press Enter to accept{" "}
45
- <span className="text-foreground">default</span> (recommended) — a single home page to
46
- start from. Other templates include <span className="text-foreground">basic</span>,{" "}
44
+ <span className="text-foreground">default</span> (recommended) — a single home page to start
45
+ from. Other templates include <span className="text-foreground">basic</span>,{" "}
47
46
  <span className="text-foreground">blog</span>, <span className="text-foreground">saas</span>
48
47
  , and <span className="text-foreground">landing</span>.
49
48
  </p>
50
- <CodeBlock
49
+ <TerminalBlock
51
50
  label="template selection"
52
- lang="bash"
53
51
  code={`Available templates:
54
52
 
55
- default Blank slate with a single home page — the fastest way to start. (recommended)
56
- basic Minimal starter: pages, an API route, auth, and a dashboard.
57
- blog Markdown content collections, post listing, and post pages.
58
- saas Dashboard, settings, pricing, auth, and a data layer example.
59
- landing Marketing site with docs pages, styled with shadcn/Tailwind.
53
+ default Blank slate with a single home page. (recommended)
54
+ basic Minimal starter: pages, API route, auth, dashboard.
55
+ blog Markdown content collections.
56
+ saas Dashboard, settings, pricing, auth, data layer.
57
+ landing Marketing site with docs pages.
60
58
 
61
59
  Choose a template (default/basic/blog/saas/landing) (default):`}
62
60
  />
63
61
  <p className="mt-4 text-muted-foreground">
64
- Pass a template explicitly with{" "}
65
- <span className="text-foreground">--template</span> or{" "}
62
+ Pass a template explicitly with <span className="text-foreground">--template</span> or{" "}
66
63
  <span className="text-foreground">-t</span>:
67
64
  </p>
68
- <CodeBlock
69
- label="terminal"
70
- lang="bash"
65
+ <TerminalBlock
66
+ label="~/projects — zsh"
71
67
  code="bun create thexjs-app@latest my-app --template default"
72
68
  />
73
69
 
@@ -4,7 +4,7 @@ import { CodeBlock } from "../../components/code-block";
4
4
 
5
5
  export const mode = "static";
6
6
 
7
- export default function DocPage({}: RouteProps) {
7
+ export default function DocPage(_props: RouteProps) {
8
8
  return (
9
9
  <div>
10
10
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Introduction</p>
@@ -23,9 +23,9 @@ export default function DocPage({}: RouteProps) {
23
23
  Most stacks split concerns across multiple tools: a bundler, a server, a static host, a
24
24
  separate API layer. x keeps everything in one Bun process. Drop a file in{" "}
25
25
  <span className="text-foreground">src/pages</span>, get a route. Mark a page{" "}
26
- <span className="text-foreground">static</span> and it prerenders at build time. Leave it
27
- as server mode and it renders per request. API routes and server functions live alongside
28
- your pages — same types, same runtime.
26
+ <span className="text-foreground">static</span> and it prerenders at build time. Leave it as
27
+ server mode and it renders per request. API routes and server functions live alongside your
28
+ pages — same types, same runtime.
29
29
  </p>
30
30
 
31
31
  <h2 className="mt-12 text-xl font-bold tracking-tight">The package ecosystem</h2>
@@ -88,14 +88,11 @@ export default function HomePage({}: RouteProps) {
88
88
  <p className="mt-3 text-muted-foreground">
89
89
  Pages default to server-rendered (SSR). Opt into build-time prerendering per page:
90
90
  </p>
91
- <CodeBlock
92
- label="route mode"
93
- code={`export const mode: "static" | "server" = "static";`}
94
- />
91
+ <CodeBlock label="route mode" code={`export const mode: "static" | "server" = "static";`} />
95
92
  <p className="mt-4 text-muted-foreground">
96
- Static pages ship as plain HTML in{" "}
97
- <span className="text-foreground">.x/client/</span> — deployable to any static host.
98
- Server pages need a running Bun process via <span className="text-foreground">x start</span>.
93
+ Static pages ship as plain HTML in <span className="text-foreground">.x/client/</span> —
94
+ deployable to any static host. Server pages need a running Bun process via{" "}
95
+ <span className="text-foreground">x start</span>.
99
96
  </p>
100
97
 
101
98
  <div className="mt-16 flex flex-wrap gap-6 border-t border-border pt-8">
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Layouts</p>
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Middleware</p>
@@ -4,7 +4,7 @@ import { CodeBlock } from "../../../components/code-block";
4
4
 
5
5
  export const mode = "static";
6
6
 
7
- export default function DocPage({}: RouteProps) {
7
+ export default function DocPage(_props: RouteProps) {
8
8
  return (
9
9
  <div>
10
10
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Packages</p>
@@ -16,8 +16,9 @@ export default function DocPage({}: RouteProps) {
16
16
 
17
17
  <CodeBlock label="terminal" lang="bash" code="bun add @thexjs/cli" />
18
18
  <p className="mt-4 text-sm text-muted-foreground">
19
- Requires Bun on your PATH. The CLI shells out to <span className="text-foreground">bun</span>{" "}
20
- and uses Bun-only APIs (<span className="text-foreground">Bun.serve</span>,{" "}
19
+ Requires Bun on your PATH. The CLI shells out to{" "}
20
+ <span className="text-foreground">bun</span> and uses Bun-only APIs (
21
+ <span className="text-foreground">Bun.serve</span>,{" "}
21
22
  <span className="text-foreground">Bun.argv</span>).
22
23
  </p>
23
24
 
@@ -65,9 +66,9 @@ export default defineConfig({
65
66
  });`}
66
67
  />
67
68
  <p className="mt-4 text-muted-foreground">
68
- Without a config file, defaults apply: <span className="text-foreground">src/pages</span> for
69
- pages, <span className="text-foreground">content</span> for content collections if present,
70
- port <span className="text-foreground">3000</span>.
69
+ Without a config file, defaults apply: <span className="text-foreground">src/pages</span>{" "}
70
+ for pages, <span className="text-foreground">content</span> for content collections if
71
+ present, port <span className="text-foreground">3000</span>.
71
72
  </p>
72
73
 
73
74
  <h2 className="mt-12 text-xl font-bold tracking-tight">What each command does</h2>
@@ -83,7 +84,9 @@ export default defineConfig({
83
84
  </p>
84
85
 
85
86
  <h3 className="mt-8 text-lg font-semibold">x build</h3>
86
- <p className="mt-2 text-muted-foreground">Compiles Tailwind in production mode, then writes:</p>
87
+ <p className="mt-2 text-muted-foreground">
88
+ Compiles Tailwind in production mode, then writes:
89
+ </p>
87
90
  <ul className="mt-3 list-inside list-disc space-y-2 text-muted-foreground">
88
91
  <li>
89
92
  <span className="text-foreground">.x/client/</span> — prerendered HTML for static pages,
@@ -4,7 +4,7 @@ import { CodeBlock } from "../../../components/code-block";
4
4
 
5
5
  export const mode = "static";
6
6
 
7
- export default function DocPage({}: RouteProps) {
7
+ export default function DocPage(_props: RouteProps) {
8
8
  return (
9
9
  <div>
10
10
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Packages</p>
@@ -69,7 +69,10 @@ src/pages/_404.tsx Custom not-found page`}
69
69
  <p className="mt-3 text-muted-foreground">
70
70
  Every page defaults to server-rendered. Opt into build-time prerendering:
71
71
  </p>
72
- <CodeBlock label="src/pages/index.tsx" code={`export const mode: "static" | "server" = "static";`} />
72
+ <CodeBlock
73
+ label="src/pages/index.tsx"
74
+ code={`export const mode: "static" | "server" = "static";`}
75
+ />
73
76
  <ul className="mt-4 list-inside list-disc space-y-2 text-muted-foreground">
74
77
  <li>
75
78
  <span className="text-foreground">static</span> — rendered once at build time to HTML in{" "}
@@ -77,7 +80,8 @@ src/pages/_404.tsx Custom not-found page`}
77
80
  </li>
78
81
  <li>
79
82
  <span className="text-foreground">server</span> — rendered per request via{" "}
80
- <span className="text-foreground">x start</span> or <span className="text-foreground">x dev</span>
83
+ <span className="text-foreground">x start</span> or{" "}
84
+ <span className="text-foreground">x dev</span>
81
85
  </li>
82
86
  </ul>
83
87
 
@@ -127,14 +131,14 @@ const html = renderMarkdown(posts[0].body);`}
127
131
  <h2 className="mt-12 text-xl font-bold tracking-tight">Data layer</h2>
128
132
  <CodeBlock
129
133
  label="sqlite"
130
- code={`import { connectSQLite, runSQLiteMigrations } from "@thexjs/core";
134
+ code={`import { connectSQLite, runSQLiteMigrations } from "@thexjs/core/data";
131
135
 
132
136
  const db = connectSQLite({ filename: "./data/dev.db" });
133
137
  await runSQLiteMigrations(db, "./data/migrations");`}
134
138
  />
135
139
  <CodeBlock
136
140
  label="postgres"
137
- code={`import { connectPostgres, runPostgresMigrations } from "@thexjs/core";
141
+ code={`import { connectPostgres, runPostgresMigrations } from "@thexjs/core/data";
138
142
 
139
143
  const sql = connectPostgres({ url: process.env.DATABASE_URL! });
140
144
  await runPostgresMigrations(sql, "./data/migrations");`}
@@ -4,7 +4,7 @@ import { CodeBlock } from "../../../components/code-block";
4
4
 
5
5
  export const mode = "static";
6
6
 
7
- export default function DocPage({}: RouteProps) {
7
+ export default function DocPage(_props: RouteProps) {
8
8
  return (
9
9
  <div>
10
10
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Packages</p>
@@ -84,8 +84,8 @@ function json<T>(): EnvValidator<T> {
84
84
 
85
85
  <h2 className="mt-12 text-xl font-bold tracking-tight">client / clientPrefix</h2>
86
86
  <p className="mt-3 text-muted-foreground">
87
- The <span className="text-foreground">client</span> schema is for variables safe to expose to
88
- the browser. <span className="text-foreground">clientPrefix</span> enforces that every
87
+ The <span className="text-foreground">client</span> schema is for variables safe to expose
88
+ to the browser. <span className="text-foreground">clientPrefix</span> enforces that every
89
89
  client key starts with that prefix (e.g.{" "}
90
90
  <span className="text-foreground">NEXT_PUBLIC_</span>,{" "}
91
91
  <span className="text-foreground">PUBLIC_</span>) — a key that does not match fails
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Pages</p>
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">Routing</p>
@@ -2,7 +2,7 @@ import type { RouteProps } from "@thexjs/core";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import { CodeBlock } from "../../components/code-block";
4
4
 
5
- export default function DocPage({}: RouteProps) {
5
+ export default function DocPage(_props: RouteProps) {
6
6
  return (
7
7
  <div>
8
8
  <p className="text-xs font-semibold uppercase tracking-[0.2em] text-primary">
@@ -10,9 +10,10 @@ export default function DocPage({}: RouteProps) {
10
10
  </p>
11
11
  <h1 className="mt-4 text-3xl font-bold tracking-tight sm:text-4xl">Server functions</h1>
12
12
  <p className="mt-4 text-lg text-muted-foreground">
13
- Call server-side functions directly from the browser without writing REST endpoints. Server
14
- functions live in <span className="text-foreground">src/actions/</span> and are invoked via
15
- fetch.
13
+ Call server-side functions from the browser without writing REST endpoints. Server functions
14
+ live in <span className="text-foreground">src/actions/</span>. Import one into a client
15
+ component and call it like a normal function, or call it manually with{" "}
16
+ <span className="text-foreground">fetch</span> — both compile down to the same request.
16
17
  </p>
17
18
 
18
19
  <h2 className="mt-12 text-xl font-bold tracking-tight">Defining server functions</h2>
@@ -37,9 +38,58 @@ export async function sendEmail({ to, subject, body }: {
37
38
  }`}
38
39
  />
39
40
 
40
- <h2 className="mt-12 text-xl font-bold tracking-tight">Calling from the browser</h2>
41
+ <h2 className="mt-12 text-xl font-bold tracking-tight">Calling actions directly</h2>
41
42
  <p className="mt-3 text-muted-foreground">
42
- Server functions are called by sending a POST request to{" "}
43
+ Import the function into a client component and call it like any other async function. When
44
+ you run <span className="text-foreground">x build</span>, the bundler swaps the import for a
45
+ generated fetch client before it reaches the browser, so the real implementation, db calls
46
+ and all, never gets bundled.
47
+ </p>
48
+ <CodeBlock
49
+ label="client component"
50
+ code={`"use client";
51
+
52
+ import { useState } from "react";
53
+ import { subscribeUser } from "../actions/subscribe";
54
+
55
+ export default function SubscribeForm() {
56
+ const [status, setStatus] = useState("");
57
+
58
+ async function handleSubmit(e: React.FormEvent) {
59
+ e.preventDefault();
60
+ const form = new FormData(e.target as HTMLFormElement);
61
+ const email = form.get("email") as string;
62
+
63
+ await subscribeUser(email);
64
+ setStatus("Subscribed!");
65
+ }
66
+
67
+ return (
68
+ <form onSubmit={handleSubmit} className="space-y-4">
69
+ <input
70
+ name="email"
71
+ type="email"
72
+ placeholder="you@example.com"
73
+ className="rounded-xl border border-border bg-card px-4 py-2"
74
+ />
75
+ <button type="submit" className="rounded-xl bg-primary px-4 py-2 text-primary-foreground">
76
+ Subscribe
77
+ </button>
78
+ {status && <p className="text-muted-foreground">{status}</p>}
79
+ </form>
80
+ );
81
+ }`}
82
+ />
83
+ <p className="mt-3 text-sm text-muted-foreground">
84
+ Only files under <span className="text-foreground">actionsDir</span> get this treatment.
85
+ Import a regular server-only helper into client code and it bundles as-is; if it leaks a
86
+ secret, the build-time env isolation check catches it instead.
87
+ </p>
88
+
89
+ <h2 className="mt-12 text-xl font-bold tracking-tight">Calling manually with fetch</h2>
90
+ <p className="mt-3 text-muted-foreground">
91
+ This is what the direct-import style compiles down to, and it works the same way in dev and
92
+ in production: a POST request to{" "}
43
93
  <span className="text-foreground">/__x/actions/&lt;filename&gt;/&lt;functionName&gt;</span>.
44
94
  The arguments are sent as JSON in the request body.
45
95
  </p>
@@ -82,6 +132,10 @@ export default function GreetForm() {
82
132
  );
83
133
  }`}
84
134
  />
135
+ <p className="mt-3 text-sm text-muted-foreground">
136
+ Reach for this style directly when you're calling an action from outside an island, or
137
+ anywhere you'd rather see the request explicitly.
138
+ </p>
85
139
 
86
140
  <h2 className="mt-12 text-xl font-bold tracking-tight">Server functions from loaders</h2>
87
141
  <p className="mt-3 text-muted-foreground">
@@ -37,7 +37,7 @@ const allFeatures = [
37
37
  {
38
38
  icon: Server,
39
39
  title: "Server functions",
40
- desc: "Call server-side functions from the browser without writing REST endpoints. Just export async functions from src/actions/ and call them via fetch.",
40
+ desc: "Call server-side functions from the browser without writing REST endpoints. Import them into a client component and call them directly, or by hand with fetch.",
41
41
  },
42
42
  {
43
43
  icon: Shield,