Born from agentic chaos

@types for your env vars

Ship faster. Stop debugging missing keys.

Define required API keys, tokens, and connection strings — with context, descriptions and a nice dashboard UI. Claude & Codex will keep on shipping.

$npm i secretdef
Developers — stop guessing which env vars your app needs
Teams — onboard new devs in minutes, not hours
AI agents — structured errors they can read and act on
Without secretdef
Console
Uncaught TypeError: Cannot read properties of undefined (reading 'split')
at processPayment (billing.ts:14:23)
at handleCheckout (checkout.ts:8:5)
at async Router.handle (router.ts:42:3)
POST /api/checkout 500 (Internal Server Error)

Which key? Where to get it? Good luck.

With secretdef
Console
1 secret problem [env=production]:
🔑STRIPE_SECRET_KEY— missing
Stripe API secret key
defined in: src/secrets.ts
Process exited with code 1

Name, description, link — fix it in seconds.

Not a vault. Not a secrets manager. Works alongside Doppler, Vault, Infisical, or plain .env files. A standard way for modules to declare what they need and where to get them. Zero dependencies. ~2KB.

I ship 10x faster now. So I spend 10x more time hunting missing keys.

AI agents write integrations in minutes. Stripe, Resend, a new database — done before lunch. But every deploy became the same loop: crash, check logs, guess which env var is missing, find the right dashboard, provision the key, redeploy. Again for staging. Again for the other project.

I started documenting secrets in infra.md, then CLAUDE.md, then Notion. None of it was there when I needed it — in the terminal, at the moment of failure. My agents couldn't read any of it. And I kept forgetting on which account I provisioned what, where.

So I put the documentation in the code. A spec that says: this app needs STRIPE_SECRET_KEY, here's what it looks like, here's where to get it. One call at startup validates everything. The error message is the documentation — for Claude, for me in 2 years, or the next dev working on this.

Felix Menard, creator of secretdef

Quick start with AI

Install the skill, then tell your AI agent to create secret definitions. Works with Claude Code, Cursor, Codex, and more.

$ npx skills add iplanwebsites/secretdef

Installs the skill for all detected AI tools in your project. Then just say:

Create secret definitions. Ensure all secrets have definitions.

3 redeploys. 1 missing key.

TypeError: Cannot read properties of undefined — you guess, redeploy, wait, repeat.

Is Stripe set up in staging?

Which keys exist where? Who has the token? Where's the connection string? Nobody knows until it breaks.

Your agent is stuck.

It doesn't know which key is missing, where to find it, or how to provision it. Give it context and a good agent can browse the dashboard or run a CLI to get the key itself.

Onboarding takes a full day

New dev. Stale .env.example. 40 keys. No descriptions. Half are for services you stopped using a year ago.

How it works

You list the secrets your app needs — the env var name, a description, and where to get the value. At startup, one call checks everything and tells you exactly what's missing.

1.List what your app needs

src/secrets.ts
// src/secrets.ts
import { defineSecrets } from 'secretdef';
import { secrets as openai } from '@secretdef/openai';

export const secrets = defineSecrets({
  ...openai,
  DATABASE_URL: {
    description: 'Postgres connection string',
    dashboard: 'https://console.neon.tech',
    validate: 'url',
    devDefault: 'postgresql://localhost:5432/myapp_dev',
  },
});

2.Validate at startup

src/env.ts
// src/env.ts — validate everything at startup
import { validateSecrets } from 'secretdef';
import { secrets as app } from './secrets';
import { secrets as db } from './modules/db/secrets';

export const env = validateSecrets({
  ...app,
  ...db,
});
Prefer less wiring? Use auto-register instead
src/index.ts
// Or use auto-register — less wiring, same result
import { validateSecrets } from 'secretdef';

import './secrets';
import './modules/db/secrets';

const env = validateSecrets();

3.Get actionable errors instead of cryptic crashes

Terminal
❌ 2 secret problems [env=production]:
🔑 STRIPE_SECRET_KEY — missing
Stripe API secret key
dashboard: https://dashboard.stripe.com/apikeys
defined in: src/secrets.ts

🔑 DATABASE_URL — missing
Postgres connection string
dashboard: https://console.neon.tech
defined in: src/modules/db/secrets.ts
Add to your .env file:
STRIPE_SECRET_KEY=
DATABASE_URL=

Using a service? Just import its package.

Community @secretdef/* packages ship ready-made definitions for popular services. Install, import, done.

$npm i openai @secretdef/openai secretdef
src/index.ts
// app entry point
import { validateSecrets } from 'secretdef';

import '@secretdef/openai';
// import '@secretdef/stripe';
// import '@secretdef/resend';

// Validates ALL secrets defined by the imports above
validateSecrets();

That's it. All 7 OpenAI env vars — OPENAI_API_KEY, OPENAI_ORG_ID, and more — are now validated at startup with descriptions, dashboard links, and format hints.

Strict in prod. Flexible in dev.

secretdef adapts to the environment. You don't need every secret configured to start working locally.

Production

Missing required secrets print an error table and exit the process. No surprises in prod.

Development

Missing secrets print a warning. The server starts. They throw only when code actually reads the missing value.

At point of use

useSecret() throws a structured error with the var name, description, and dashboard URL.

Dashboard UI

See all your secrets at a glance. One command.

$npx secretdef ui
secretdef
experimental
9 secrets6 ok3 issues
NameStatus
OPENAI_API_KEY
ok
STRIPE_SECRET_KEY
missing
DATABASE_URL
ok
RESEND_API_KEY
ok
STRIPE_WEBHOOK_SECRET
missing
SENTRY_DSN
ok
REDIS_URL
ok
CLERK_SECRET_KEY
invalid
ANALYTICS_KEY
ok

This is a preview — run npx secretdef ui for the real thing.

Two lines. Fail at startup, not at 2am.

Most SDKs already read process.env internally. Add two lines and missing keys fail on server start — not when a user hits the code path.

Just import + useSecret()

server.ts
import OpenAI from 'openai';
import { useSecret } from 'secretdef';
import '@secretdef/openai';

// useSecret() throws a rich error if OPENAI_API_KEY is missing
const openai = new OpenAI({ apiKey: useSecret('OPENAI_API_KEY') });
Startup error
❌ 1 secret problem [env=production]:
🔑 OPENAI_API_KEY — missing OpenAI API key dashboard: https://platform.openai.com/api-keys defined in: @secretdef/openai
Process exited with code 1

Every error tells you how to fix it

process.env.KEY returns undefined silently. useSecret('KEY') tells you what's wrong, where to find the value, and which file declared it. Your agent reads the same output and knows exactly what to do.

src/modules/stripe/client.ts
import { useSecret } from 'secretdef';

const key = useSecret('STRIPE_SECRET_KEY');
//
// If missing → throws with:
//   SecretNotAvailable: STRIPE_SECRET_KEY is not configured.
//     Environment variable: STRIPE_SECRET_KEY
//     Description:          Stripe API secret key
//     Where to find it:     https://dashboard.stripe.com/apikeys
//     Defined in:           src/secrets.ts
//     Current environment:  development
//     To fix: set STRIPE_SECRET_KEY in your environment or .env file.
//
// vs: TypeError: Cannot read properties of undefined

Every module declares its secrets

Your database module knows it needs DATABASE_URL. Your payment code knows it needs a Stripe key. When each module ships secret definitions, the whole app's requirements become discoverable, validated, and documented — automatically.

For services that don't ship their own definitions yet, the community maintains 1,319+ ready-made @secretdef/* packages. Here are some popular ones:

Azure OpenAI

Added secret definitions to your SDK or service? Open a PR to add it to the supported list — help others discover it.

Add your service

Native integrations

These libraries ship their own defineSecrets() calls natively — just install and import, no @secretdef/* package needed.

secretdefNative

The core secretdef library — define, validate, and access your environment secrets.

Ship your own secret definitions? Add your library to the list.

Add your library

1,319 community packages

Every service below has a ready-made @secretdef/* package you can install today. Each one declares the environment variables the service needs — descriptions, dashboard links, and validation rules included.

100msab-tastyabbyyablyabstract-apiaccessibeaccuweatheracrcloudactive-campaignactivepiecesacuityadobe-fireflyadobe-signadyenadzunaaffinityaftershipagendizeagility-cmsagoraai21aikidoairbrakeairbyteaircallairtableairtable-apiairvisualaivenaiven-kafkaakamaiakeneoalchemyalgoliaalibaba-qwenalloyalpacaalpha-vantageamadeusamazon-sesamazon-snsamazon-spamazon-sqsambassadoramchartsamplitudeamplitude-experimentankranthropicanvilanymailapache-airflowapideckapifyapilayerapimaticapnsapollo-graphqlapollo-ioappbotappcuesappetizeappfiguresappfollowappmixerappnetaappsmithapptioappwriteaptibleaquaarchive-orgarcjetargocdarize-phoenixartsyasanaasertoassemblaassemblyaiastro-deployathens-researchatlassianattioattom-dataauddauth0authorize-netautodeskautomate-ioavalaraawsaws-amplifyaws-bedrockaws-iot-coreaws-route53aws-ses-v2aws-translateaxiomayrshareazure-aiazure-blobazure-cognitiveazure-content-moderatorazure-cosmos-nosqlazure-devopsazure-functionsazure-openaiazure-searchazure-service-busazure-translatorbackblazebackendlessbacklogbaidu-qianfanbalenabamboohrbanana-devbandwidthbannerbearbardobaremetricsbarkbarkodersbasecampbaselimebaserowbasetenbatonbeamablebeamsbeehiivbeekeeperbentobettermodebetterstackbigcommercebigquerybillwerkbinancebirdbitbucketbitlybitnamibizzaboblack-forest-labsblackbaudblock-edenbloomerangbluesnapblynkboardmixbold-commercebombbombbookeobosunbotpressboxboxyhq-samlbraincloudbraintreebraintrustbrandwatchbreadcrumbsbreezometerbreezy-hrbrevobrexbridgecrewbridgerbright-databrowserbasebrowserlessbrowserstackbucketbuddybudibasebugsnagbugsplatbuildkitebullmq-cloudbunnynetbutter-cmsbynderbytepluscaisycal-comcalabashcalendlycamundacannycanvacanvaslmscaptchafoxcarbon-aicarbonecargocartesiacashfreecastaicazenacensuscensus-datacerboscerebrascertnchainstackchameleonchanneltalkchargebeechargepointchargifychartmogulchatfuelchattermillchatwootchatworkchecklycheckmarxcheckout-comchromachromaticchronospherechurnzerocirclecicivoclarifaiclarityclayclearbitclerkclevercloudclevertapclickhouseclicksendclickupclockifyclockworkclose-crmcloudconvertcloudekacloudflarecloudflare-workerscloudinarycloudinary-uploadcloudmersivecloudsmithcockpitcockroachdbcodacodacycodatcodecovcodemagiccodesandboxcodespacescoherecoinapicoinbase-advancedcoinbase-commercecoingeckocoinmarketcapcoinstatscomet-mlcometchatcommandbarcommentocommercetoolscommon-roomcommusoftcomposioconfigcatconfluenceconfluent-kafkaconjurconstructor-iocontentfulcontenthubcontentstackcontrast-securityconvertapiconvertkitconvexcookiebotcoolifycoppercoralogixcoralogix-rumcordovacoreweavecorrilycosmiccosmosdbcouchbasecountlycouriercradlepointcratedbcrates-iocreemcrispcriteocronofycrossbeamcrossmintcrowdincrowdseccrowdstrikecruisecuratedcurrencylayercustomer-iocustomerfieldscybersourcecypress-cloudd-iddadatadagster-clouddailydatabricksdatadogdatagriddatahubdatawaredato-cmsdaytonadebeziumdeeldeepgramdeepldeepseekdelighteddemiodeno-deploydeno-kvdepartures-boarddepotdescopedetectifydevcycledevhubdevrevdialpaddidomidiffbotdigitaloceandinerodirectusdiscorddiscord-webhookdiscoursedittodocassembledocebodocker-hubdocraptordocumodocusigndoofinderdoordashdoppiodopplerdotdigitaldragonflydreamhostdriftdripdronedropboxdubduffeldwolladynatadynatracee2bearthengineeasypostebayecwidedamamedgedbeigenelarianelastic-apmelastic-cloudelastic-emailelastic-pathelasticsearchelementaryelevenlabsemailjsemailoctopusemarsysembassyendor-labsenvoyenzuzoeppoetherscanetsyeventbriteeverbridgeevervaultexaexceptionlessexchangerate-apiexotelexpofacebookfaceplusplusfal-aifastgenfastlyfathomfaunafcmfeaturebasefeedbinfiberyfieldwirefigmafile-iofinchfinicityfinnhubfirebasefirebase-adminfirecrawlfireworks-aifitbitfivetranfixer-ioflagrightflagsmithflexportflightawarefliptflotiqflutterwaveflyfolkfondyformbricksforteforterfossafoursquareframeiofredfreshbooksfreshdeskfreshpingfreshsalesfreshservicefriendly-captchafrontappfronteggfullstoryfunctionlandgainsightgathergcpgcp-speechgcp-storagegcp-ttsgcp-visiongeckoboardgeoapifygetstreamghostgiphygistgitbookgiteagithubgithub-copilotgithub-packagesgitlabgitpodgittergladiagleapglitchtipglobusgnewsgocanvasgocardlessgodaddygoogle-analyticsgoogle-calendargoogle-drivegoogle-genaigoogle-geocodinggoogle-mapsgoogle-placesgoogle-pubsubgoogle-sheetsgoogle-translategoogle-vertex-aigorgiasgorsegotifygovuk-notifygrafanagrafbasegraingraviteegreenhousegridsomegroqgroqcloudgrowthbookguardrails-aigumroadgustohankoharborharness-ffharvesthashicorp-consulhashicorp-nomadhashicorp-waypointhasurahcaptchahcloudheapheliconeheliushellosignhelpscouthere-mapsheroic-labs-nakamaherokuhetznerhetzner-dnshexnodeheygenhibobhighlighthightouchhivehologramhoneybadgerhoneycombhookdeckhookdeck-apihopinhotjarhtml-css-to-imagehubspothuduhuggingfacehumanloophume-aihumiohunter-iohygraphhypertrackibm-cloudideogramiex-cloudigdbimageaiimagekitimgiximgproxyimpervaincidentioindicioinfisicalinfluxdbinfobipinfomaniakinfurainkeepinngestinspectletinstagraminstanaintercominterzoidioredis-cloudip2locationipgeolocationipinfoipstackiugujamfjelasticjfrog-artifactoryjfrog-xrayjirajotaijotformjumiojumpcloudjunekagikaleyrakatanakayakokeapkeenkeycdnkeypupkickboxkindekintonekisikitklarnaklaviyoknockkoalakokorokongkontenakontent-aikreakustomerlaceworklagolakeralambdatestlangfuselangsmithlast9launchdarklyleanixlemlistlemonsqueezyleverlightspeedlightsteplinearlingo-devlinkedinlinodelinuxserverlistmonklithicliveagentliveblockslivekitllama-cloudlmntloblocationiqlocizelogdnalogfireloginradiuslogrocketlogsnaglogtaillogziolokaliseloomloopslucidchartluma-ailumigolunchmoneylushamagentomagic-linkmailchimpmailersendmailgunmailjetmailtrapmakemanagewpmandrillmanifestmapboxmapbox-searchmarchexmarketomastodonmatrixmavenmaxmindmediastackmedplummedusameilisearchmem0memberstackmemcached-cloudmemgraphmercadopagomergemessagebirdmessagebird-conversationsmetaapimetabasemetronomemezmomicrosoft-graphmicrosoft-teamsmiddleware-iomilvusmindeeminiomintlifymiromistralmixpanelmoengagemoesifmolliemomentomonday-commondoomongodbmoonshot-aimoosendmoovmoralismouseflowmparticlemqttmultiversxmuxmx-platformmysqln8nnamecheapnangonasaneo4jneonneon-serverlessnetlifynetlify-blobsnetlify-cmsneverbouncenewrelicnewsapinftstoragengroknhostnightfallnilenixtlanoco-dbnomicnordlayernorthflanknotificationapinotionnovita-ainovunoysintfynugetnumverifynuveinvidia-nimnylasobsidian-publishocr-spaceoctopus-deployoktaollamaomdbomnisendonedriveonepasswordonesignalonetrustonfidoopen-exchange-ratesopenaiopenai-whisperopenaqopencageopendataopenfgaopenlibraryopenmeteropenmrsopenphoneopenrouteropenseaopensea-streamopensearchopentelemetryopenverseopenweathermapopikopsgenieopsrampoptimizelyoracle-cloudorb-billingorbitorder-deskoryosanoosqueryossoouraoutreachoutsetaovhcloudowncloudoxylabspabblypachamapackagecloudpaddlepagerdutypagseguropalantirpandadocpaperspacepapertrailpardotparseparticlepartnerstackpassagepassjipayherepayload-cmspayoneerpaypalpayrexpaysafepaystackpayupdfcopeakapeliqanpendopennylanepeople-data-labspercypermit-ioperplexitypersonapersoniopesapalpexelspexipphantombusterphotonphrasepicovoicepinatapineconepingdompinterestpipedreampipedrivepipefypirschpixabaypixelaplacekeyplaidplainplanetscaleplanhatplasmicplatform-shplatypusplausibleplay-htplayfabplivoplivo-smsplunkpocketbasepodiopolarpolarispollfishpolygon-iopolytomicportainerposthogpostmanpostmarkpowerbiprefectpresetprestashopprintfulprintifyprisma-accelerateprisma-cloudprisma-pulseprismicprocreateproductboardpromptfooproofpointpropelauthprospeoprotocolproxmoxproxycurlpubnubpulumipusherpushoverpypipyroscopeqdrantqoveryqstashquestdbquickbasequickbooksquicknodequotaguardr2rabbitmq-cloudradarrailwayramprancherrasaravenrawgraycastraygunrazorpayreadmerebrandlyrebuffrecaptcharechargerecruiteerecurlyredditredisredoclyredpandaredshiftrefersionregalrememberizerremoterenderrepairshoprreplicachereplicatereplitresendresend-webhookresyretableretell-airetoolrevenue-catreviewboardrewardfulrewind-airingcentralripplingriskifiedroadieroboflowrocketreachrocksetrollbarrootlyroute4merouteerowyrss2jsonrudderstackrunpodrunscoperunwarerunwaysafaricomsagesailthrusaleorsalesbrickssalesflaresalesforcesambanovasamsarasanitysap-hanasardinesatismetersauce-labssavvycalscalewayscalrschnaqscraperapiscrapflyscrapingbeescreenlyseamseatablesecureframesegmentseismicsemaphoresemgrepsemrushsendbirdsendgridsendpulsesentryseonservicem8servicetitansetmoresharetribesheetdbsheetsonsheetyshipbobshipdayshipengineshipposhipstationshodanshopifyshopwareshort-iosightenginesignalfxsignalwiresignnowsignozsignrequestsignwellsimpleanalyticssimplerosimvolysinchsinglestoresite24x7skyflowslackslack-webhookslapdashslickplansmallpdfsmartcarsmartlingsmartlooksmartsheetsmartysmoochsnovsnoviosnowflakesnyksnyk-containersocket-iosocket-securitysocuresoftrsonarcloudsonarqubesonderspaceliftsparkpostspeakeasyspeechifyspeechmaticsspiraldbsplit-iosplunkspoonacularspotifyspotinstsquaresquare-posstabilityaistackhawkstackpathstacksharestadia-mapsstardogstatsigstatuscakestatuspagestenographystepfunctionsstepzenstiggstockxstonebranchstoretaskerstormglassstoryblokstorylanestrapistravastreakstreamstream-chatstripestytchsubstacksumo-logicsupabasesuperblockssupersetsupertokenssuprsendsurrealdbsurveymonkeysurvicatesvixswiftypesynadiasyncfusionsynthesiataigatalendtalon-onetaniumtapfiliatetaplyticstatumtavilytawk-totaxjarteachabletelegramtelesigntelnyxtemporaltenderlytermiiterraform-cloudtextmagicthalesthirdwebthumbortidb-cloudtidiotiger-beetletigergraphtiktoktimescaletina-cmstinestipaltitipetisanetmdbtodoisttogether-aitoggltomtomtonicaitoplynetowertraceabletracelooptrackjstranscendtransifextransloadittravis-citray-iotrellotresatatrievetriggertriggermeshtripletextrooptracktrufflehogtruliootrustpilotturnstiletursotuyatwelve-labstwiliotwingatetwitchtwitch-exttwittertyktypebottypeformtypesenseumamiunbodyunkeyunleashunsplashunstructuredupclouduploadcareuploadthingupstash-kafkaupstash-redisuptimerobotupworkusabillauserbackuserflowuserguidinguserpilotuservoicevalimailvaltownvapivaporvaultvectaravenafivendveracodevercelvercel-blobvercel-kvvercel-postgresveriffveritableverizon-mediavestaboardviamvideosdkvimeovirtruvirus-totalvisual-crossingvitallyvoiceflowvonagevoucherifyvoyage-aivultrvwovyondwakatimewasabiwavewealthsimpleweatherapiweatherstackweaviateweb3storagewebexwebflowwebhook-sitewebinyweglotweights-biaseswhat3wordswhatnotwhatsapp-businesswherebywhiskwhoisxmlwiremockwisewithingswizwizardlmwolframwonderpushwoocommercewoodpeckerworkableworkatoworkosworkspace-oneworldpaywrikewriter-aixaixanoxataxeroxmcloudxsollayelpyextyotpoyousignyoutubeyugabytezammadzapierzapritezendeskzenefitszenhubzenmlzenphizenrowszenserpzenviazepzerobouncezerodhazeroheightzinc-searchzitadelzixflowzoho-crmzoho-mailzonoszoomzoominfozorazuorazuplozywave
$npm i secretdef

Zero dependencies. ~2KB. MIT licensed.