/Wiki/sources/honojs__hono/2026/https-hono-dev-llms-full-txt-load-env-when-local-5141a6e05b26-load-env-when-local-development-s0392-c0001.md
Load env when local development (2) - hono-docs
Load env when local development (2) Source evidence: /Sources/raw/honojs hono/honojs hono.md Canonical citation: https://hono.dev/llms full.txt load env when...
Load env when local development (2)
Source evidence: /Sources/raw/honojshono/honojshono.md Canonical citation: https://hono.dev/llms-full.txt#load-env-when-local-development
Summary
::: info By default, process.env is not available in Cloudflare Workers, so it is recommended to get environment variables from c.env. If you want to use it, you need to enable [nodejs_compat_populate_process_env](https://developer...
Content
::: info
By default, process.env is not available in Cloudflare Workers, so it is recommended to get environment variables from c.env. If you want to use it, you need to enable nodejs_compat_populate_process_env flag. You can also import env from cloudflare:workers. For details, please see How to access env on Cloudflare docs
:::
type Bindings = {
SECRET_KEY: string
}
const app = new Hono<{ Bindings: Bindings }>()
app.get('/env', (c) => {
const SECRET_KEY = c.env.SECRET_KEY
return c.text(SECRET_KEY)
})Before you deploy your project to Cloudflare, remember to set the environment variable/secrets in the Cloudflare Workers project's configuration.