Node.js

Updated

@krypticdev/daemon-client injects your project's secrets into process.env during development startup. In production it is a no-op, and it never throws - no daemon simply means your app starts with the environment it already has.

Source: github.com/dev-kryptic/Kryptic.Node.

Install

npm install --save-dev @krypticdev/daemon-client

Use

// CommonJS - top of your entry point
require('@krypticdev/daemon-client').inject();

// ES modules
import { inject } from '@krypticdev/daemon-client';
await inject();

// All secrets now available:
const dbUrl = process.env.DATABASE_URL;

Works with any framework that reads process.env - Express, Fastify, NestJS, Next.js, Vite.

Behavior

  • No-op when NODE_ENV is set to anything other than development, or when KRYPTIC_DISABLED=true.
  • Finds kryptic.json by walking up from the working directory.
  • Never overwrites environment variables that are already set - real environment always wins.
  • Returns { injected, skipped, reason } so you can log what happened.
  • macOS/Linux via unix socket, Windows via named pipe.

Options

await inject({
  environment: 'staging',     // default: kryptic.json defaultEnvironment, then "development"
  projectId: 'proj_x',        // default: kryptic.json projectId
  timeoutMs: 2000,            // daemon connection timeout
});

Environment variables override everything: KRYPTIC_PROJECT_ID, KRYPTIC_ENV, KRYPTIC_SOCKET_PATH, KRYPTIC_TIMEOUT_MS, KRYPTIC_DISABLED, KRYPTIC_SILENT. See the configuration reference.