@farm.js/create-app 0.1.0-beta.86 → 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.
Files changed (38) hide show
  1. package/dist/index.js +2 -2
  2. package/dist/index.js.map +1 -1
  3. package/dist/index.mjs +2 -2
  4. package/dist/index.mjs.map +1 -1
  5. package/package.json +1 -1
  6. package/templates/_integrations/better-auth/preact/farm.config.ts +3 -0
  7. package/templates/_integrations/better-auth/solid/farm.config.ts +3 -0
  8. package/templates/_integrations/better-auth/svelte/farm.config.ts +3 -0
  9. package/templates/_integrations/better-auth/svelte/src/components/resource-links.svelte +1 -1
  10. package/templates/_integrations/better-auth/vue/farm.config.ts +3 -0
  11. package/templates/_integrations/better-auth/vue/src/components/resource-links.vue +1 -1
  12. package/templates/_renderers/preact/package.json +2 -2
  13. package/templates/_renderers/preact/src/components/resource-links.tsx +1 -1
  14. package/templates/_renderers/solid/package.json +2 -2
  15. package/templates/_renderers/solid/src/components/resource-links.tsx +1 -1
  16. package/templates/_renderers/svelte/package.json +2 -2
  17. package/templates/_renderers/svelte/src/components/resource-links.svelte +1 -1
  18. package/templates/_renderers/vue/package.json +2 -2
  19. package/templates/_renderers/vue/src/components/resource-links.vue +1 -1
  20. package/templates/auth/package.json +3 -3
  21. package/templates/auth/src/app/docs/page.md +2 -2
  22. package/templates/auth/src/components/resource-links.tsx +1 -1
  23. package/templates/auth/src/components/site-header.tsx +1 -1
  24. package/templates/basic/package.json +2 -2
  25. package/templates/basic/src/app/docs/page.md +2 -2
  26. package/templates/basic/src/components/resource-links.tsx +1 -1
  27. package/templates/better-auth/README.md +9 -3
  28. package/templates/better-auth/farm.config.ts +8 -0
  29. package/templates/better-auth/package.json +4 -3
  30. package/templates/better-auth/src/app/docs/page.md +2 -2
  31. package/templates/better-auth/src/components/resource-links.tsx +1 -1
  32. package/templates/better-auth/src/components/site-header.tsx +1 -1
  33. package/templates/better-auth/src/lib/auth.ts +2 -6
  34. package/templates/better-auth/src/lib/migrate-auth.ts +10 -0
  35. package/templates/react-compiler/README.md +1 -1
  36. package/templates/react-compiler/package.json +2 -2
  37. package/templates/react-compiler/src/app/docs/page.md +2 -2
  38. package/templates/react-compiler/src/components/resource-links.tsx +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farm.js/create-app",
3
- "version": "0.1.0-beta.86",
3
+ "version": "0.1.0-beta.88",
4
4
  "description": "Create a new FARMJS application",
5
5
  "keywords": [
6
6
  "@farm.js/create-app",
@@ -11,6 +11,9 @@ export default defineConfig({
11
11
  integrations: {
12
12
  auth: betterAuth({ instance: auth }),
13
13
  },
14
+ migrations: {
15
+ commands: [{ name: "Better Auth schema", command: "pnpm auth:migrate" }],
16
+ },
14
17
  deploy: {
15
18
  target: "vercel",
16
19
  },
@@ -11,6 +11,9 @@ export default defineConfig({
11
11
  integrations: {
12
12
  auth: betterAuth({ instance: auth }),
13
13
  },
14
+ migrations: {
15
+ commands: [{ name: "Better Auth schema", command: "pnpm auth:migrate" }],
16
+ },
14
17
  deploy: {
15
18
  target: "vercel",
16
19
  },
@@ -11,6 +11,9 @@ export default defineConfig({
11
11
  integrations: {
12
12
  auth: betterAuth({ instance: auth }),
13
13
  },
14
+ migrations: {
15
+ commands: [{ name: "Better Auth schema", command: "pnpm auth:migrate" }],
16
+ },
14
17
  deploy: {
15
18
  target: "vercel",
16
19
  },
@@ -16,7 +16,7 @@
16
16
  {/if}
17
17
  <span class="resource-link-item">
18
18
  {#if primary}<span class="resource-separator" aria-hidden="true">/</span>{/if}
19
- <a href="https://farm.js.dev">
19
+ <a href="https://farmjs.dev">
20
20
  <svg
21
21
  class="resource-icon"
22
22
  viewBox="0 0 24 24"
@@ -11,6 +11,9 @@ export default defineConfig({
11
11
  integrations: {
12
12
  auth: betterAuth({ instance: auth }),
13
13
  },
14
+ migrations: {
15
+ commands: [{ name: "Better Auth schema", command: "pnpm auth:migrate" }],
16
+ },
14
17
  deploy: {
15
18
  target: "vercel",
16
19
  },
@@ -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://farm.js.dev">
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.86",
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.86",
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://farm.js.dev">
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.86",
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.86",
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://farm.js.dev">
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.86",
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.86",
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"
@@ -1,6 +1,6 @@
1
1
  <nav aria-label="Starter resources">
2
2
  <span class="resource-link-item">
3
- <a href="https://farm.js.dev">
3
+ <a href="https://farmjs.dev">
4
4
  <svg
5
5
  class="resource-icon"
6
6
  viewBox="0 0 24 24"
@@ -9,7 +9,7 @@
9
9
  "type-check": "vue-tsc --noEmit"
10
10
  },
11
11
  "dependencies": {
12
- "@farm.js/core": "0.1.0-beta.86",
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.86",
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"
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <nav aria-label="Starter resources">
3
3
  <span class="resource-link-item">
4
- <a href="https://farm.js.dev">
4
+ <a href="https://farmjs.dev">
5
5
  <svg
6
6
  class="resource-icon"
7
7
  viewBox="0 0 24 24"
@@ -11,8 +11,8 @@
11
11
  "type-check": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@farm.js/auth": "0.1.0-beta.86",
15
- "@farm.js/core": "0.1.0-beta.86",
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.86",
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://farm.js.dev/docs)
29
- - [Configuration guide](https://farm.js.dev/docs/configuration)
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://farm.js.dev">
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://farm.js.dev">Docs</a>
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.86",
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.86",
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://farm.js.dev/docs)
29
- - [Configuration guide](https://farm.js.dev/docs/configuration)
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://farm.js.dev">
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 automatic Better Auth migrations
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, configures the pooled
45
- Postgres connection, and runs programmatic migrations.
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
@@ -16,6 +16,14 @@ export default defineConfig({
16
16
  experimental: {
17
17
  serverComponents: true,
18
18
  },
19
+ migrations: {
20
+ commands: [
21
+ {
22
+ name: "Better Auth schema",
23
+ command: "pnpm auth:migrate",
24
+ },
25
+ ],
26
+ },
19
27
  vite: {
20
28
  server: {
21
29
  port: 3000,
@@ -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.86",
14
- "@farm.js/core": "0.1.0-beta.86",
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.86",
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://farm.js.dev/docs)
29
- - [Configuration guide](https://farm.js.dev/docs/configuration)
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://farm.js.dev">
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://farm.js.dev">Docs</a>
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 database = new Pool(poolConfig);
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://farm.js.dev/docs/renderers/react#experimental-aot-compiler)
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.86",
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.86",
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://farm.js.dev/docs)
29
- - [Configuration guide](https://farm.js.dev/docs/configuration)
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://farm.js.dev">
64
+ <a href="https://farmjs.dev">
65
65
  <DocsIcon />
66
66
  <span>Docs</span>
67
67
  </a>