DioxusLabs / DioxusLabs/dioxus
Proposal: Support `PUBLIC_` prefix for client-exposed env vars (à la Next.js style)
- Dominant language
- Rust
- Stars
- 39.1k
- Forks
- 1.9k
- Avg merge
- 4d 10h
- Merged PRs (30d)
- 4
Description
Hiya ( ᵔ ⩊ ᵔ ) !
So I recently built a full-stack Web3 app for a local client using Next.js 15 (yes, I can also build full blown Next JS full stack apps, ez game 😎), and I learned their little trick for handling environment variables: anything prefixed with [`NEXT_PUBLIC_`](https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#bundling-environment-variables-for-the-browser) gets exposed to the client, while everything else stays server-side. Super clean!
Now, hopping back into Rust land with Dioxus (which j'adore 🧬), to expose a client-side env var, users have to run something like:
```sh
API_KEY=value dx serve
```
Which... works, but looks a bit ugly.
So here's the feature request: Could Dioxus adopt a convention like `PUBLIC_` for env vars meant to be used on the client side? That way, users can keep things tidy in a single `.env` file and avoid shouting secrets at their terminal.
Thanks!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.