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_ENVis set to anything other thandevelopment, or whenKRYPTIC_DISABLED=true. - Finds
kryptic.jsonby 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.