@farm.js/create-app 0.1.0-beta.87 → 0.1.0-beta.88
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.
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/templates/_integrations/better-auth/preact/farm.config.ts +3 -0
- package/templates/_integrations/better-auth/solid/farm.config.ts +3 -0
- package/templates/_integrations/better-auth/svelte/farm.config.ts +3 -0
- package/templates/_integrations/better-auth/svelte/src/components/resource-links.svelte +1 -1
- package/templates/_integrations/better-auth/vue/farm.config.ts +3 -0
- package/templates/_integrations/better-auth/vue/src/components/resource-links.vue +1 -1
- package/templates/_renderers/preact/package.json +2 -2
- package/templates/_renderers/preact/src/components/resource-links.tsx +1 -1
- package/templates/_renderers/solid/package.json +2 -2
- package/templates/_renderers/solid/src/components/resource-links.tsx +1 -1
- package/templates/_renderers/svelte/package.json +2 -2
- package/templates/_renderers/svelte/src/components/resource-links.svelte +1 -1
- package/templates/_renderers/vue/package.json +2 -2
- package/templates/_renderers/vue/src/components/resource-links.vue +1 -1
- package/templates/auth/package.json +3 -3
- package/templates/auth/src/app/docs/page.md +2 -2
- package/templates/auth/src/components/resource-links.tsx +1 -1
- package/templates/auth/src/components/site-header.tsx +1 -1
- package/templates/basic/package.json +2 -2
- package/templates/basic/src/app/docs/page.md +2 -2
- package/templates/basic/src/components/resource-links.tsx +1 -1
- package/templates/better-auth/README.md +9 -3
- package/templates/better-auth/farm.config.ts +8 -0
- package/templates/better-auth/package.json +4 -3
- package/templates/better-auth/src/app/docs/page.md +2 -2
- package/templates/better-auth/src/components/resource-links.tsx +1 -1
- package/templates/better-auth/src/components/site-header.tsx +1 -1
- package/templates/better-auth/src/lib/auth.ts +2 -6
- package/templates/better-auth/src/lib/migrate-auth.ts +10 -0
- package/templates/react-compiler/README.md +1 -1
- package/templates/react-compiler/package.json +2 -2
- package/templates/react-compiler/src/app/docs/page.md +2 -2
- package/templates/react-compiler/src/components/resource-links.tsx +1 -1
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ defineProps<{
|
|
|
11
11
|
</span>
|
|
12
12
|
<span class="resource-link-item">
|
|
13
13
|
<span v-if="primary" class="resource-separator" aria-hidden="true">/</span>
|
|
14
|
-
<a href="https://
|
|
14
|
+
<a href="https://farmjs.dev">
|
|
15
15
|
<svg
|
|
16
16
|
class="resource-icon"
|
|
17
17
|
viewBox="0 0 24 24"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"type-check": "tsc --noEmit"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@farm.js/core": "0.1.0-beta.
|
|
13
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
14
14
|
"@farm.js/preact": "0.1.0-beta.31",
|
|
15
15
|
"@fontsource-variable/geist": "5.3.0",
|
|
16
16
|
"@fontsource-variable/geist-mono": "5.3.0",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"zod": "4.1.12"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
21
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
22
22
|
"tailwindcss": "^4.0.0",
|
|
23
23
|
"typescript": "^5.3.3"
|
|
24
24
|
},
|
|
@@ -54,7 +54,7 @@ export function ResourceLinks({ className, primary }: ResourceLinksProps) {
|
|
|
54
54
|
) : null}
|
|
55
55
|
<span className="resource-link-item">
|
|
56
56
|
{primary ? <ResourceSeparator /> : null}
|
|
57
|
-
<a href="https://
|
|
57
|
+
<a href="https://farmjs.dev">
|
|
58
58
|
<DocsIcon />
|
|
59
59
|
<span>Docs</span>
|
|
60
60
|
</a>
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"type-check": "tsc --noEmit"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@farm.js/core": "0.1.0-beta.
|
|
12
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
13
13
|
"@farm.js/solid": "0.1.0-beta.27",
|
|
14
14
|
"@fontsource-variable/geist": "5.3.0",
|
|
15
15
|
"@fontsource-variable/geist-mono": "5.3.0",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"zod": "4.1.12"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
20
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
21
21
|
"tailwindcss": "^4.0.0",
|
|
22
22
|
"typescript": "^5.3.3"
|
|
23
23
|
},
|
|
@@ -54,7 +54,7 @@ export function ResourceLinks(props: ResourceLinksProps) {
|
|
|
54
54
|
) : null}
|
|
55
55
|
<span class="resource-link-item">
|
|
56
56
|
{props.primary ? <ResourceSeparator /> : null}
|
|
57
|
-
<a href="https://
|
|
57
|
+
<a href="https://farmjs.dev">
|
|
58
58
|
<DocsIcon />
|
|
59
59
|
<span>Docs</span>
|
|
60
60
|
</a>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type-check": "svelte-check --tsconfig ./tsconfig.json"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@farm.js/core": "0.1.0-beta.
|
|
14
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
15
15
|
"@farm.js/svelte": "0.1.0-beta.30",
|
|
16
16
|
"@fontsource-variable/geist": "5.3.0",
|
|
17
17
|
"@fontsource-variable/geist-mono": "5.3.0",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"zod": "4.1.12"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
22
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
23
23
|
"svelte-check": "4.7.5",
|
|
24
24
|
"tailwindcss": "^4.0.0",
|
|
25
25
|
"typescript": "^5.3.3"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"type-check": "vue-tsc --noEmit"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@farm.js/core": "0.1.0-beta.
|
|
12
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
13
13
|
"@farm.js/vue": "0.1.0-beta.27",
|
|
14
14
|
"@fontsource-variable/geist": "5.3.0",
|
|
15
15
|
"@fontsource-variable/geist-mono": "5.3.0",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"zod": "4.1.12"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
20
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
21
21
|
"tailwindcss": "^4.0.0",
|
|
22
22
|
"typescript": "^5.3.3",
|
|
23
23
|
"vue-tsc": "3.3.9"
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"type-check": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@farm.js/auth": "0.1.0-beta.
|
|
15
|
-
"@farm.js/core": "0.1.0-beta.
|
|
14
|
+
"@farm.js/auth": "0.1.0-beta.88",
|
|
15
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
16
16
|
"@farming-labs/docs": "0.2.111",
|
|
17
17
|
"@farming-labs/farmjs": "0.2.111",
|
|
18
18
|
"@farming-labs/theme": "0.2.111",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"react-dom": "^19.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
26
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
27
27
|
"@types/node": "22.20.1",
|
|
28
28
|
"@types/react": "^19.0.0",
|
|
29
29
|
"@types/react-dom": "^19.0.0",
|
|
@@ -25,5 +25,5 @@ manual wiring required.
|
|
|
25
25
|
|
|
26
26
|
## Learn more
|
|
27
27
|
|
|
28
|
-
- [Farm.js documentation](https://
|
|
29
|
-
- [Configuration guide](https://
|
|
28
|
+
- [Farm.js documentation](https://farmjs.dev/docs)
|
|
29
|
+
- [Configuration guide](https://farmjs.dev/docs/configuration)
|
|
@@ -61,7 +61,7 @@ export function ResourceLinks({ className, primary }: ResourceLinksProps) {
|
|
|
61
61
|
) : null}
|
|
62
62
|
<span className="resource-link-item">
|
|
63
63
|
{primary ? <ResourceSeparator /> : null}
|
|
64
|
-
<a href="https://
|
|
64
|
+
<a href="https://farmjs.dev">
|
|
65
65
|
<DocsIcon />
|
|
66
66
|
<span>Docs</span>
|
|
67
67
|
</a>
|
|
@@ -21,7 +21,7 @@ export function SiteHeader({ user }: SiteHeaderProps) {
|
|
|
21
21
|
</a>
|
|
22
22
|
|
|
23
23
|
<nav className="header-nav" aria-label="Primary navigation">
|
|
24
|
-
<a href="https://
|
|
24
|
+
<a href="https://farmjs.dev">Docs</a>
|
|
25
25
|
{user ? (
|
|
26
26
|
<a className="header-account" href="/dashboard">
|
|
27
27
|
<span className="avatar" aria-hidden="true">
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"type-check": "tsc --noEmit"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@farm.js/core": "0.1.0-beta.
|
|
12
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
13
13
|
"@farming-labs/docs": "0.2.111",
|
|
14
14
|
"@farming-labs/farmjs": "0.2.111",
|
|
15
15
|
"@farming-labs/theme": "0.2.111",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"react-dom": "^19.0.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
22
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
23
23
|
"@types/react": "^19.0.0",
|
|
24
24
|
"@types/react-dom": "^19.0.0",
|
|
25
25
|
"tailwindcss": "^4.0.0",
|
|
@@ -25,5 +25,5 @@ manual wiring required.
|
|
|
25
25
|
|
|
26
26
|
## Learn more
|
|
27
27
|
|
|
28
|
-
- [Farm.js documentation](https://
|
|
29
|
-
- [Configuration guide](https://
|
|
28
|
+
- [Farm.js documentation](https://farmjs.dev/docs)
|
|
29
|
+
- [Configuration guide](https://farmjs.dev/docs/configuration)
|
|
@@ -61,7 +61,7 @@ export function ResourceLinks({ className, primary }: ResourceLinksProps) {
|
|
|
61
61
|
) : null}
|
|
62
62
|
<span className="resource-link-item">
|
|
63
63
|
{primary ? <ResourceSeparator /> : null}
|
|
64
|
-
<a href="https://
|
|
64
|
+
<a href="https://farmjs.dev">
|
|
65
65
|
<DocsIcon />
|
|
66
66
|
<span>Docs</span>
|
|
67
67
|
</a>
|
|
@@ -10,7 +10,7 @@ This project was generated from the Better Auth template included with `@farm.js
|
|
|
10
10
|
- email and password sign-up and sign-in
|
|
11
11
|
- Better Auth session cookies
|
|
12
12
|
- a server-middleware-protected `/dashboard`
|
|
13
|
-
- pooled Postgres persistence and
|
|
13
|
+
- pooled Postgres persistence and explicit Better Auth migrations
|
|
14
14
|
- a dark-first, one-page welcome screen set in Geist Sans and Geist Mono
|
|
15
15
|
- pending, error, unauthorized, loading, and not-found states
|
|
16
16
|
- responsive starter UI
|
|
@@ -34,6 +34,7 @@ Then install and start the app:
|
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
36
|
pnpm install
|
|
37
|
+
pnpm auth:migrate
|
|
37
38
|
pnpm dev
|
|
38
39
|
```
|
|
39
40
|
|
|
@@ -41,8 +42,9 @@ Open [http://localhost:3000](http://localhost:3000), create an account, and cont
|
|
|
41
42
|
|
|
42
43
|
## How it is wired
|
|
43
44
|
|
|
44
|
-
- [`src/lib/auth.ts`](./src/lib/auth.ts) creates the Better Auth instance
|
|
45
|
-
Postgres connection
|
|
45
|
+
- [`src/lib/auth.ts`](./src/lib/auth.ts) creates the Better Auth instance and configures the pooled
|
|
46
|
+
Postgres connection without touching the database during a build.
|
|
47
|
+
- [`src/lib/migrate-auth.ts`](./src/lib/migrate-auth.ts) runs schema migrations only when requested.
|
|
46
48
|
- [`farm.config.ts`](./farm.config.ts) mounts that instance through `@farm.js/better-auth`.
|
|
47
49
|
- [`src/lib/auth-client.ts`](./src/lib/auth-client.ts) exposes the browser client.
|
|
48
50
|
- [`src/lib/session.ts`](./src/lib/session.ts) resolves the current request session on the server.
|
|
@@ -72,12 +74,16 @@ The starter uses `pg` with a small connection pool suitable for a pooled Neon en
|
|
|
72
74
|
`DATABASE_URL`, `BETTER_AUTH_SECRET`, and the production `BETTER_AUTH_URL` to your deployment
|
|
73
75
|
environment before building.
|
|
74
76
|
|
|
77
|
+
Run `pnpm auth:migrate` (or `farm migrate`) as an explicit deployment step before serving traffic.
|
|
78
|
+
The production build itself never runs database migrations.
|
|
79
|
+
|
|
75
80
|
The FARMJS deployment target is configured in [`farm.config.ts`](./farm.config.ts) for Vercel.
|
|
76
81
|
|
|
77
82
|
## Commands
|
|
78
83
|
|
|
79
84
|
```bash
|
|
80
85
|
pnpm dev # start the development server
|
|
86
|
+
pnpm auth:migrate # apply Better Auth database migrations
|
|
81
87
|
pnpm type-check # run TypeScript checks
|
|
82
88
|
pnpm build # create the production build
|
|
83
89
|
pnpm check # type-check and build
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "farm dev",
|
|
7
7
|
"build": "farm build",
|
|
8
|
+
"auth:migrate": "node --experimental-strip-types src/lib/migrate-auth.ts",
|
|
8
9
|
"check": "pnpm type-check && pnpm build",
|
|
9
10
|
"deploy": "farm deploy",
|
|
10
11
|
"type-check": "tsc --noEmit"
|
|
11
12
|
},
|
|
12
13
|
"dependencies": {
|
|
13
|
-
"@farm.js/better-auth": "0.1.0-beta.
|
|
14
|
-
"@farm.js/core": "0.1.0-beta.
|
|
14
|
+
"@farm.js/better-auth": "0.1.0-beta.88",
|
|
15
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
15
16
|
"@farming-labs/docs": "0.2.111",
|
|
16
17
|
"@farming-labs/farmjs": "0.2.111",
|
|
17
18
|
"@farming-labs/theme": "0.2.111",
|
|
@@ -24,7 +25,7 @@
|
|
|
24
25
|
"react-dom": "^19.0.0"
|
|
25
26
|
},
|
|
26
27
|
"devDependencies": {
|
|
27
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
28
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
28
29
|
"@types/node": "22.20.1",
|
|
29
30
|
"@types/pg": "8.20.0",
|
|
30
31
|
"@types/react": "^19.0.0",
|
|
@@ -25,5 +25,5 @@ manual wiring required.
|
|
|
25
25
|
|
|
26
26
|
## Learn more
|
|
27
27
|
|
|
28
|
-
- [Farm.js documentation](https://
|
|
29
|
-
- [Configuration guide](https://
|
|
28
|
+
- [Farm.js documentation](https://farmjs.dev/docs)
|
|
29
|
+
- [Configuration guide](https://farmjs.dev/docs/configuration)
|
|
@@ -61,7 +61,7 @@ export function ResourceLinks({ className, primary }: ResourceLinksProps) {
|
|
|
61
61
|
) : null}
|
|
62
62
|
<span className="resource-link-item">
|
|
63
63
|
{primary ? <ResourceSeparator /> : null}
|
|
64
|
-
<a href="https://
|
|
64
|
+
<a href="https://farmjs.dev">
|
|
65
65
|
<DocsIcon />
|
|
66
66
|
<span>Docs</span>
|
|
67
67
|
</a>
|
|
@@ -21,7 +21,7 @@ export function SiteHeader({ user }: SiteHeaderProps) {
|
|
|
21
21
|
</a>
|
|
22
22
|
|
|
23
23
|
<nav className="header-nav" aria-label="Primary navigation">
|
|
24
|
-
<a href="https://
|
|
24
|
+
<a href="https://farmjs.dev">Docs</a>
|
|
25
25
|
{user ? (
|
|
26
26
|
<a className="header-account" href="/dashboard">
|
|
27
27
|
<span className="avatar" aria-hidden="true">
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { betterAuth } from "better-auth";
|
|
2
|
-
import { getMigrations } from "better-auth/db/migration";
|
|
3
2
|
import { Pool, type PoolConfig } from "pg";
|
|
4
3
|
|
|
5
4
|
const authBaseUrl = process.env.BETTER_AUTH_URL ?? "http://localhost:3000";
|
|
@@ -32,12 +31,12 @@ const poolConfig: PoolConfig & { enableChannelBinding: boolean } = {
|
|
|
32
31
|
allowExitOnIdle: true,
|
|
33
32
|
};
|
|
34
33
|
|
|
35
|
-
const
|
|
34
|
+
export const authDatabase = new Pool(poolConfig);
|
|
36
35
|
|
|
37
36
|
export const auth = betterAuth({
|
|
38
37
|
appName: "FARMJS Better Auth Starter",
|
|
39
38
|
baseURL: authBaseUrl,
|
|
40
|
-
database,
|
|
39
|
+
database: authDatabase,
|
|
41
40
|
emailAndPassword: {
|
|
42
41
|
enabled: true,
|
|
43
42
|
minPasswordLength: 8,
|
|
@@ -45,6 +44,3 @@ export const auth = betterAuth({
|
|
|
45
44
|
secret,
|
|
46
45
|
trustedOrigins: [new URL(authBaseUrl).origin],
|
|
47
46
|
});
|
|
48
|
-
|
|
49
|
-
const migrations = await getMigrations(auth.options);
|
|
50
|
-
await migrations.runMigrations();
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { getMigrations } from "better-auth/db/migration";
|
|
2
|
+
import { auth, authDatabase } from "./auth.ts";
|
|
3
|
+
|
|
4
|
+
try {
|
|
5
|
+
const migrations = await getMigrations(auth.options);
|
|
6
|
+
await migrations.runMigrations();
|
|
7
|
+
console.log("Better Auth migrations completed.");
|
|
8
|
+
} finally {
|
|
9
|
+
await authDatabase.end();
|
|
10
|
+
}
|
|
@@ -58,5 +58,5 @@ For batching, multiple bindings, safe keyed-list fallback, and the full compiler
|
|
|
58
58
|
see the maintained
|
|
59
59
|
[React Compiler example](https://github.com/farming-labs/farm.js/tree/main/examples/react-compiler).
|
|
60
60
|
|
|
61
|
-
Read the [React compiler guide](https://
|
|
61
|
+
Read the [React compiler guide](https://farmjs.dev/docs/renderers/react#experimental-aot-compiler)
|
|
62
62
|
for the supported component contract and rollout guidance.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type-check": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@farm.js/core": "0.1.0-beta.
|
|
14
|
+
"@farm.js/core": "0.1.0-beta.88",
|
|
15
15
|
"@farm.js/react": "0.1.0-beta.8",
|
|
16
16
|
"@farming-labs/docs": "0.2.111",
|
|
17
17
|
"@farming-labs/farmjs": "0.2.111",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"react-dom": "19.2.8"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@farm.js/cli": "0.1.0-beta.
|
|
25
|
+
"@farm.js/cli": "0.1.0-beta.88",
|
|
26
26
|
"@playwright/test": "^1.52.0",
|
|
27
27
|
"@types/react": "^19.0.0",
|
|
28
28
|
"@types/react-dom": "^19.0.0",
|
|
@@ -25,5 +25,5 @@ manual wiring required.
|
|
|
25
25
|
|
|
26
26
|
## Learn more
|
|
27
27
|
|
|
28
|
-
- [Farm.js documentation](https://
|
|
29
|
-
- [Configuration guide](https://
|
|
28
|
+
- [Farm.js documentation](https://farmjs.dev/docs)
|
|
29
|
+
- [Configuration guide](https://farmjs.dev/docs/configuration)
|
|
@@ -61,7 +61,7 @@ export function ResourceLinks({ className, primary }: ResourceLinksProps) {
|
|
|
61
61
|
) : null}
|
|
62
62
|
<span className="resource-link-item">
|
|
63
63
|
{primary ? <ResourceSeparator /> : null}
|
|
64
|
-
<a href="https://
|
|
64
|
+
<a href="https://farmjs.dev">
|
|
65
65
|
<DocsIcon />
|
|
66
66
|
<span>Docs</span>
|
|
67
67
|
</a>
|