Node.js

Updated

krypticdev 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.

Install

npm install --save-dev krypticdev

Use

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

// ES modules
import { inject } from 'krypticdev';
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
});