@newt-app/templates 0.19.3 → 0.20.0

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 (2) hide show
  1. package/dist/index.js +15 -7
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -41,6 +41,7 @@ node_modules
41
41
 
42
42
  # Local env files
43
43
  .env
44
+ dev.db*
44
45
  .env.local
45
46
  .env.development.local
46
47
  .env.test.local
@@ -153,7 +154,7 @@ Full-stack monorepo: Next.js 16 + NestJS 11 + better-auth + PostgreSQL.
153
154
  ## Quick start
154
155
 
155
156
  \`\`\`sh
156
- cp .env.example .env # fill in DATABASE_URL
157
+ # optional: set DATABASE_URL in .env for Postgres (defaults to local SQLite)
157
158
  pnpm install
158
159
  pnpm db:migrate
159
160
  pnpm dev
@@ -178,7 +179,8 @@ Open [http://localhost:3000](http://localhost:3000).
178
179
  // src/root/templates/env-example.ts
179
180
  var env_example_default = {
180
181
  filename: ".env",
181
- template: `DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
182
+ template: `# Uses a local SQLite file (dev.db) unless DATABASE_URL is set
183
+ # DATABASE_URL=postgresql://postgres:postgres@localhost:5432/postgres
182
184
  BETTER_AUTH_URL=http://localhost:3000
183
185
  BETTER_AUTH_SECRET=your-secret-here`
184
186
  };
@@ -995,16 +997,18 @@ var package_json_default4 = {
995
997
  ".": "./src/index.ts"
996
998
  },
997
999
  "scripts": {
998
- "migrate": "dotenv -e .env -- auth migrate -y --config src/index.ts",
999
- "generate": "dotenv -e .env -- auth generate --config src/index.ts"
1000
+ "migrate": "dotenv -e ../../.env -- auth migrate -y --config src/index.ts",
1001
+ "generate": "dotenv -e ../../.env -- auth generate --config src/index.ts"
1000
1002
  },
1001
1003
  "dependencies": {
1002
1004
  "auth": "^1.5.5",
1003
1005
  "better-auth": "^1.2.8",
1006
+ "better-sqlite3": "^12.11.1",
1004
1007
  "pg": "^8.14.1"
1005
1008
  },
1006
1009
  "devDependencies": {
1007
1010
  "@<%= projectName %>/typescript-config": "workspace:*",
1011
+ "@types/better-sqlite3": "^7.6.13",
1008
1012
  "@types/pg": "^8.11.13",
1009
1013
  "dotenv-cli": "^11.0.0",
1010
1014
  "typescript": "6.0.2"
@@ -1017,11 +1021,15 @@ var src_index_default = {
1017
1021
  filename: "packages/auth/src/index.ts",
1018
1022
  template: `import { betterAuth } from "better-auth";
1019
1023
  import { Pool } from "pg";
1024
+ import Database from "better-sqlite3";
1025
+ import path from "node:path";
1026
+
1027
+ const database = process.env.DATABASE_URL
1028
+ ? new Pool({ connectionString: process.env.DATABASE_URL })
1029
+ : new Database(path.resolve(process.cwd(), "../../dev.db"));
1020
1030
 
1021
1031
  export const auth = betterAuth({
1022
- database: new Pool({
1023
- connectionString: process.env.DATABASE_URL,
1024
- }),
1032
+ database,
1025
1033
  emailAndPassword: { enabled: true },
1026
1034
  trustedOrigins: [process.env.BETTER_AUTH_URL ?? "http://localhost:3000"],
1027
1035
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@newt-app/templates",
3
- "version": "0.19.3",
3
+ "version": "0.20.0",
4
4
  "private": false,
5
5
  "description": "Templates for newt-app",
6
6
  "type": "module",