Vite logo Vite

Vault with Vite

Run your Vite application through the GitOps CLI to load Vault secrets as environment variables before the server starts.

Run your application with Vault

Use gops vault run -- followed by your usual Vite start command:

gops vault run \
	--api-url https://cloud.getgitops.com/api \
	--api-key "$GOPS_API_KEY" \
	--project-id 00000000-0000-0000-0000-000000000000 \
	--path / \
	--env production \
	-- npm run preview

For local development, select the appropriate Vault environment and use your framework's development command after --.

See the official Vite documentation for framework-specific environment and deployment guidance.

Use your environment variables

Secrets are available as environment variables only to the process launched by gops vault run. Read them through your framework's server-side environment API and keep private values out of browser bundles.