@bella-baxter/next 0.1.1-preview.15 → 0.1.1-preview.150

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 (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +92 -0
  3. package/package.json +13 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Cosmic Chimps
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
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.15",
3
+ "version": "0.1.1-preview.150",
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.15"
19
+ "@bella-baxter/sdk": "0.1.1-preview.150"
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-js.git",
38
+ "directory": "apps/sdk/js/packages/next"
39
+ },
40
+ "homepage": "https://github.com/Cosmic-Chimps/bella-baxter-js/tree/main/packages/next#readme",
41
+ "bugs": {
42
+ "url": "https://github.com/Cosmic-Chimps/bella-baxter-js/issues"
43
+ },
34
44
  "scripts": {
35
45
  "build": "tsc",
36
46
  "typecheck": "tsc --noEmit"