Local Development: JavaScript & TypeScript
The pattern is the same for every JavaScript tool: in package.json, put ennote secret get "<secret>" -- in front of the command that starts the dev server. Run npm run dev (or pnpm dev, yarn dev, bun dev) as usual.
The examples use a secret named site-env in a workspace with the ID local-development. Replace my-org-id and the other IDs with your own. See Local development without .env files for the one-time setup.
Vite (Vue, React, Svelte, Solid)
{
"scripts": {
"dev": "ennote secret get \"site-env\" --organization-id \"my-org-id\" --workspace-id \"local-development\" -- vite",
"build": "vite build"
}
}
Vite reads variables from the environment it starts in, so keys from Ennote work exactly like keys from a .env file:
- Keys that start with
VITE_are available in your app code asimport.meta.env.VITE_API_URL. - All keys are available in
vite.config.tsand in server-side code throughprocess.env.
const apiUrl = import.meta.env.VITE_API_URL
VITE_ is compiled into the JavaScript bundle that browsers download, so anyone can read it. Only put public values there, such as API URLs or publishable keys. Keep secret keys (database passwords, private API keys) in your backend.Next.js
{
"scripts": {
"dev": "ennote secret get \"site-env\" --organization-id \"my-org-id\" --workspace-id \"local-development\" -- next dev"
}
}
- Server code (Route Handlers, Server Components, Server Actions) reads any key with
process.env.DATABASE_URL. - Keys that start with
NEXT_PUBLIC_are inlined into the browser bundle and are public, likeVITE_keys.
Next.js still loads .env* files if they exist, but variables already set in the environment take precedence, so the values from Ennote win.
Nuxt
{
"scripts": {
"dev": "ennote secret get \"site-env\" --organization-id \"my-org-id\" --workspace-id \"local-development\" -- nuxt dev"
}
}
Name the keys after your runtimeConfig and Nuxt fills it in at start-up. A key NUXT_API_SECRET sets runtimeConfig.apiSecret, and NUXT_PUBLIC_API_BASE sets runtimeConfig.public.apiBase:
export default defineNuxtConfig({
runtimeConfig: {
apiSecret: '', // server only, set by NUXT_API_SECRET
public: {
apiBase: '', // exposed to the browser, set by NUXT_PUBLIC_API_BASE
},
},
})
Node.js (Express, Fastify, NestJS)
{
"scripts": {
"dev": "ennote secret get \"api-env\" --organization-id \"my-org-id\" --workspace-id \"local-development\" -- node --watch src/server.js"
}
}
The same works with any runner: -- tsx watch src/server.ts, -- nodemon, -- nest start --watch. Read the values with process.env:
const databaseUrl = process.env.DATABASE_URL
If your code calls dotenv.config() or uses node --env-file, you can keep it while you migrate. Neither overrides variables that are already set, so the values from Ennote win.
Monorepos and Several Apps
Each app can use its own secret. For example, a frontend and an API in one repository:
{
"scripts": {
"dev:web": "ennote secret get \"web-env\" -- pnpm --filter web dev",
"dev:api": "ennote secret get \"api-env\" -- pnpm --filter api dev"
}
}
These scripts leave out the IDs and use the organization and workspace set with ennote config set.
FAQ
Do I need ennote in every script?
Only in scripts that need secrets, usually dev, and scripts such as db:migrate or seed. Production builds and deployments get their secrets from your CI/CD pipeline. See GitHub Actions or GitLab CI/CD.
Does the package.json script work on Windows?
Yes. The escaped double quotes (\"site-env\") work in the shells npm uses on Windows, macOS and Linux.
Why is my VITE_ variable undefined in the browser?
Check that the key name in Ennote starts with VITE_ exactly, and restart the dev server after changing the secret. Values are read when the command starts.
Need Help?
If you encounter any issues or have questions, don't hesitate to contact support. Our team is here to assist you with any challenges you might face.
Overview
Stop keeping .env files on developer machines: store local development secrets in an Ennote workspace and start your app with ennote secret get, which injects them as environment variables of that process only.
Python
Run Django, FastAPI, Flask and Python scripts locally with secrets from Ennote instead of a .env file, using ennote secret get with python, uv, Poetry or a Makefile.