@bella-baxter/fastify 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 +63 -0
  2. package/package.json +12 -2
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @bella-baxter/fastify
2
+
3
+ [![npm](https://img.shields.io/npm/v/@bella-baxter/fastify)](https://www.npmjs.com/package/@bella-baxter/fastify)
4
+ [![license: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
5
+
6
+ [Bella Baxter](https://github.com/Cosmic-Chimps/bella-baxter) plugin for Fastify — decorates the Fastify instance with `app.bella` for live-reloading secrets.
7
+
8
+ ## Installation
9
+
10
+ ```bash
11
+ npm install @bella-baxter/fastify fastify
12
+ # or
13
+ pnpm add @bella-baxter/fastify fastify
14
+ ```
15
+
16
+ ## Usage
17
+
18
+ ```ts
19
+ import Fastify from 'fastify';
20
+ import { bellaPlugin } from '@bella-baxter/fastify';
21
+
22
+ const app = Fastify({ logger: true });
23
+
24
+ await app.register(bellaPlugin, {
25
+ baxterUrl: process.env.BELLA_BAXTER_URL!,
26
+ apiKey: process.env.BELLA_BAXTER_API_KEY!,
27
+ projectSlug: 'my-app', // or BELLA_BAXTER_PROJECT env var
28
+ environmentSlug: 'production', // or BELLA_BAXTER_ENV env var
29
+ });
30
+
31
+ app.get('/health', async () => {
32
+ const dbUrl = app.bella.getOrThrow('DATABASE_URL');
33
+ return { ok: true };
34
+ });
35
+
36
+ await app.listen({ port: 3000 });
37
+ ```
38
+
39
+ `app.bella` is typed as `BellaConfig & BellaSecrets` — after running `bella secrets generate typescript --declaration`, typed property access works automatically:
40
+
41
+ ```ts
42
+ app.bella.DATABASE_URL // string — typed!
43
+ ```
44
+
45
+ ## Lifecycle
46
+
47
+ The plugin hooks into `onClose` to call `bella.destroy()` — polling stops cleanly when Fastify shuts down.
48
+
49
+ ## Environment variables
50
+
51
+ | Variable | Description |
52
+ |----------|-------------|
53
+ | `BELLA_BAXTER_URL` | Base URL of the Bella Baxter API |
54
+ | `BELLA_BAXTER_API_KEY` | API key (`bax-...`) |
55
+ | `BELLA_BAXTER_PROJECT` | Project slug |
56
+ | `BELLA_BAXTER_ENV` | Environment slug |
57
+ | `BELLA_BAXTER_PRIVATE_KEY` | Private key for ZKE (optional) |
58
+
59
+ ## Links
60
+
61
+ - [GitHub](https://github.com/Cosmic-Chimps/bella-baxter)
62
+ - [Issues](https://github.com/Cosmic-Chimps/bella-baxter/issues)
63
+ - [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/fastify",
3
- "version": "0.1.1-preview.36",
3
+ "version": "0.1.1-preview.41",
4
4
  "description": "Bella Baxter Fastify plugin — decorates the Fastify instance with live-reloading secrets",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -12,10 +12,11 @@
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
  "fastify": ">=4",
@@ -34,6 +35,15 @@
34
35
  "plugin"
35
36
  ],
36
37
  "license": "MIT",
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "https://github.com/Cosmic-Chimps/bella-baxter.git",
41
+ "directory": "apps/sdk/js/packages/fastify"
42
+ },
43
+ "homepage": "https://github.com/Cosmic-Chimps/bella-baxter/tree/main/apps/sdk/js/packages/fastify#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/Cosmic-Chimps/bella-baxter/issues"
46
+ },
37
47
  "scripts": {
38
48
  "build": "tsc",
39
49
  "typecheck": "tsc --noEmit"