/Knowledge/sources/honojs__hono/llms-full/cloudflare-workers-load-env-when-local-development--part-02--25cefbfe21d7.md

Cloudflare Workers: Load env when local development (part 02) - hono-...

Cloudflare Workers: Load env when local development (part 02) Source evidence: /Sources/honojs hono/provenance.md Canonical citation: https://hono.dev/llms f...

Cloudflare Workers: Load env when local development (part 02)

Source evidence: /Sources/honojs__hono/provenance.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.

Metadata

{
  "chunk_index": 1,
  "citation": "https://hono.dev/llms-full.txt#load-env-when-local-development",
  "coverage_role": "overview",
  "qualified_title": "Hono / llms-full / Cloudflare Workers > Load env when local development (2)",
  "retrieved_at": "2026-07-02T05:51:01Z",
  "section_index": 392,
  "source_id": "/honojs/hono",
  "source_type": "llms_full",
  "target_label": "llms-full",
  "title": "Cloudflare Workers: Load env when local development (part 02)",
  "upstream_url": "https://hono.dev/llms-full.txt",
  "version": "2026"
}
Kinic Wiki
Loading knowledge node
Details

Identity

database
db_23dhmsxlhukv
database_id
db_23dhmsxlhukv
path
/Knowledge/sources/honojs__hono/llms-full/cloudflare-workers-load-env-when-local-development--part-02--25cefbfe21d7.md
kind
directory
role
markdown_note
children
0

Metadata

created_at
virtual
updated_at
virtual
etag
virtual
metadata_json
{}

Lint Hints

No lightweight warnings.

Outgoing Links

No outgoing links indexed.

Incoming Links

Select a file node to inspect backlinks.

Raw Source

No raw source path inferred.