@bella-baxter/next 0.1.1-preview.36 → 0.1.1-preview.41

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 +92 -0
  2. package/package.json +13 -3
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # @bella-baxter/next
2
+
3
+ [![npm](https://img.shields.io/npm/v/@bella-baxter/next)](https://www.npmjs.com/package/@bella-baxter/next)
4
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ [Bella Baxter](https://github.com/Cosmic-Chimps/bella-baxter) integration for Next.js (App Router) — load secrets once in `instrumentation.ts` and access them in any server component or API route.
7
+
8
+ > ⚠️ **Node.js runtime only.** Not compatible with the Edge runtime. For Edge routes, export secrets at deploy time with `bella secrets get -o .env.production` and read from `process.env`.
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ npm install @bella-baxter/next
14
+ # or
15
+ pnpm add @bella-baxter/next
16
+ ```
17
+
18
+ ## Setup
19
+
20
+ ### 1. Enable instrumentation (Next.js 14+)
21
+
22
+ ```js
23
+ // next.config.js / next.config.ts
24
+ /** @type {import('next').NextConfig} */
25
+ const nextConfig = {
26
+ experimental: {
27
+ instrumentationHook: true,
28
+ },
29
+ };
30
+
31
+ export default nextConfig;
32
+ ```
33
+
34
+ ### 2. Initialize in `instrumentation.ts`
35
+
36
+ ```ts
37
+ // instrumentation.ts
38
+ import { initBella } from '@bella-baxter/next';
39
+
40
+ export async function register() {
41
+ if (process.env.NEXT_RUNTIME === 'nodejs') {
42
+ await initBella({
43
+ baxterUrl: process.env.BELLA_BAXTER_URL!,
44
+ apiKey: process.env.BELLA_BAXTER_API_KEY!,
45
+ projectSlug: 'my-app', // or BELLA_BAXTER_PROJECT env var
46
+ environmentSlug: 'production', // or BELLA_BAXTER_ENV env var
47
+ });
48
+ }
49
+ }
50
+ ```
51
+
52
+ ### 3. Use anywhere server-side
53
+
54
+ ```ts
55
+ // app/api/route.ts
56
+ import { getBella, bella } from '@bella-baxter/next';
57
+
58
+ export async function GET() {
59
+ // Option A: full config object
60
+ const config = getBella();
61
+ const dbUrl = config.getOrThrow('DATABASE_URL');
62
+
63
+ // Option B: direct shorthand
64
+ const redisUrl = bella('REDIS_URL');
65
+
66
+ return Response.json({ ok: true });
67
+ }
68
+ ```
69
+
70
+ ## Typed secrets
71
+
72
+ Run `bella secrets generate typescript --declaration` to generate `bella-secrets.d.ts`. `getBella()` returns `BellaConfig & BellaSecrets` — typed property access works automatically:
73
+
74
+ ```ts
75
+ getBella().DATABASE_URL // string — typed!
76
+ ```
77
+
78
+ ## Environment variables
79
+
80
+ | Variable | Description |
81
+ |----------|-------------|
82
+ | `BELLA_BAXTER_URL` | Base URL of the Bella Baxter API |
83
+ | `BELLA_BAXTER_API_KEY` | API key (`bax-...`) |
84
+ | `BELLA_BAXTER_PROJECT` | Project slug |
85
+ | `BELLA_BAXTER_ENV` | Environment slug |
86
+ | `BELLA_BAXTER_PRIVATE_KEY` | Private key for ZKE (optional) |
87
+
88
+ ## Links
89
+
90
+ - [GitHub](https://github.com/Cosmic-Chimps/bella-baxter)
91
+ - [Issues](https://github.com/Cosmic-Chimps/bella-baxter/issues)
92
+ - [Core SDK](https://www.npmjs.com/package/@bella-baxter/sdk)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bella-baxter/next",
3
- "version": "0.1.1-preview.36",
3
+ "version": "0.1.1-preview.41",
4
4
  "description": "Bella Baxter Next.js integration — load secrets in instrumentation.ts and access anywhere server-side",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,16 +12,17 @@
12
12
  }
13
13
  },
14
14
  "files": [
15
+ "README.md",
15
16
  "dist"
16
17
  ],
17
18
  "dependencies": {
18
- "@bella-baxter/sdk": "0.1.1-preview.36"
19
+ "@bella-baxter/sdk": "0.1.1-preview.41"
19
20
  },
20
21
  "peerDependencies": {
21
22
  "next": ">=14"
22
23
  },
23
24
  "devDependencies": {
24
- "typescript": "^5.9.3",
25
+ "typescript": "^6.0.2",
25
26
  "@types/node": "^25.5.0"
26
27
  },
27
28
  "keywords": [
@@ -31,6 +32,15 @@
31
32
  "next"
32
33
  ],
33
34
  "license": "MIT",
35
+ "repository": {
36
+ "type": "git",
37
+ "url": "https://github.com/Cosmic-Chimps/bella-baxter.git",
38
+ "directory": "apps/sdk/js/packages/next"
39
+ },
40
+ "homepage": "https://github.com/Cosmic-Chimps/bella-baxter/tree/main/apps/sdk/js/packages/next#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/Cosmic-Chimps/bella-baxter/issues"
43
+ },
34
44
  "scripts": {
35
45
  "build": "tsc",
36
46
  "typecheck": "tsc --noEmit"