Secrets are environment variables that contain sensitive information. This guide describes how to store secrets in your Hydrogen project.

How secrets work

You can store secrets in a .env file in your project, as per Vite's guide to secrets:

Prefixing secret names

You need to prefix your secret names with VITE_ for them to be displayed within your server components. However, as long as you only reference secrets using import.meta.env in your server components, your credentials won't be leaked to your client bundle.

Next steps