@nano-app/backend 0.12.5 → 0.13.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/README.md +8 -6
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -173,20 +173,21 @@ pnpm add better-auth
173
173
  ```
174
174
 
175
175
  ```ts
176
- // src/auth.ts: the options, and an instance only for the Better Auth CLI
177
- import { betterAuth, type BetterAuthOptions } from 'better-auth';
176
+ // src/auth.ts: the options; nano-app creates the instance, the Better Auth CLI reads `options`
177
+ import type { BetterAuthOptions } from 'better-auth';
178
178
 
179
- export const authOptions = { emailAndPassword: { enabled: true } } satisfies BetterAuthOptions;
180
- export const auth = betterAuth(authOptions);
179
+ export default {
180
+ options: { emailAndPassword: { enabled: true } } satisfies BetterAuthOptions,
181
+ };
181
182
  ```
182
183
 
183
184
  ```ts
184
185
  // src/app.ts
185
186
  import { createNanoApp } from '@nano-app/backend';
186
- import { authOptions } from './auth';
187
+ import auth from './auth';
187
188
 
188
189
  createNanoApp({
189
- packages: { betterAuth: authOptions },
190
+ packages: { betterAuth: auth.options },
190
191
  mainPlugin: { database: { enabled: true } },
191
192
  });
192
193
  ```
@@ -212,6 +213,7 @@ npx prisma migrate dev
212
213
  - `createRoute({ public: true, ... })` answers without a session; its handlers still receive `session` when the request has one. An unknown path answers 404.
213
214
  - Its own endpoints, the plugins mounted before the app and the middlewares a plugin adds with `app.use` in `onMount` are not checked: a plugin that exposes something public says it in its README.
214
215
  - Better Auth is loaded only when it is on.
216
+ - nano-app creates the one instance the app uses: do not call `betterAuth()` in `src/auth.ts`. The CLI's `generate` only reads `options` of its default export.
215
217
 
216
218
  ### Permissions
217
219
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nano-app/backend",
3
- "version": "0.12.5",
3
+ "version": "0.13.0",
4
4
  "description": "Express server with file-convention routes, plugins and an optional PostgreSQL layer",
5
5
  "type": "module",
6
6
  "main": "build/index.js",