Secrets
Kazzle के पास API keys, database credentials, tokens, और अन्य sensitive values को store करने के लिए एक built-in encrypted vault है जिसकी आपके app को जरूरत है। Secrets को AES-256-GCM के साथ rest में encrypt किया जाता है जो KMS-wrapped data encryption keys का उपयोग करता है — plaintext values कभी database को touch नहीं करते।Concepts
Collections related secrets को एक साथ group करते हैं (जैसेstripe-keys, database-credentials)। हर collection के पास एक slug होता है (lowercase, hyphenated) जिसे आप config files और CLI commands में reference करते हैं।
Environments एक collection के भीतर optional scopes हैं (जैसे production, staging)। Secrets को एक specific environment के लिए scoped किया जा सकता है या collection level पर defaults के रूप में छोड़ा जा सकता है।
Resolution order: जब किसी दिए गए collection + environment के लिए secrets को resolve किया जाता है, तो environment-specific secrets collection-level secrets को same name के साथ override करते हैं। यह आपको अधिकांश secrets को environments में share करने देता है जबकि specific values को per-environment override करता है।
Managing secrets
App में
Settings > Vault खोलें ताकि आप UI के माध्यम से collections, environments, और secrets बना सकें।AI के साथ
AI आपके लिए collections बना सकता है, environments बना सकता है, secrets store कर सकता है, उन्हें scopes के बीच move कर सकता है, और उन्हें delete कर सकता है। AI secret names और metadata देख सकता है लेकिन encrypted values नहीं।CLI के साथ
अपने app से secrets को reference करना
kazzle.config.ts में एक component के env को एक secret collection और environment पर point करें। उस scope में हर secret को एक process env var के रूप में inject किया जाता है जिसका नाम secret name से match करता है:
env.collection और env.environment slugs हैं, display names नहीं। Collection के secrets के एक subset को inject करने के लिए env.include का उपयोग करें:
Secrets कैसे env vars बनते हैं
जब एक component के लिए secrets को resolve किया जाता है:- Collection को आपके space के भीतर slug द्वारा खोजा जाता है
- Specified environment के लिए scoped secrets को load किया जाता है
- Collection-level secrets (कोई environment नहीं) को defaults के रूप में शामिल किया जाता है
- Environment-specific secrets collection-level ones को same name के साथ override करते हैं
- Values के अंदर secret references को resolve किया जाता है
- Secret names को env var format में convert किया जाता है: uppercased, non-alphanumeric characters underscores बन जाते हैं
Stripe Secret Key नाम वाला एक secret STRIPE_SECRET_KEY बन जाता है।
हर secret के पास एक body mode होता है जो यह determine करता है कि इसे कैसे inject किया जाता है:
stringsecrets (API keys, tokens, URIs) को plain scalar strings के रूप में inject किया जाता हैjsonsecrets (structured config) को JSON strings के रूप में inject किया जाता हैfieldssecrets (login credentials, typed field bags) को JSON strings के रूप में inject किया जाता है
जब secrets को inject किया जाता है
| Context | Injected? | Details |
|---|---|---|
| Deploy (process component) | Yes | Production में runtime environment variables के रूप में जोड़े जाते हैं |
| Deploy (UI component) | Partial | केवल VITE_* prefixed secrets को build time पर pass किया जाता है |
CLI (kazzle run) | Yes | Command के environment में inject किए जाते हैं |
CLI (secrets.export) | Yes | KEY=value lines के रूप में export किए जाते हैं |
| Dev preview | Not yet | Preview starter अभी component env को resolve नहीं करता — अभी के लिए kazzle run का उपयोग करें |
Template references
Secret values अन्य secret fields को reference कर सकते हैं जो Kazzle कहीं और उपयोग करता है:${secret.<uuid>.<field>}— specific field या JSON path। App env/config के लिए इस format का उपयोग करें।${secret.<uuid>}— पूरा secret body। केवल तब उपयोग करें जब कोई tool explicitly पूरे raw secret के लिए पूछे; app env/config में इसका उपयोग न करें।