Bundle environment variables in create-react-app at launch time (not build time)!

This page summarizes the projects mentioned and recommended in the original post on /r/javascript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • cra-envs

    ⚙️ Bundle env var in CRA at launch time!

  • This is what cra-envs does.

  • Next.js

    The React Framework

  • But NextJS does statically build. Sure server side code would be dynamic but not any client side static content. I've found https://github.com/vercel/next.js/tree/canary/examples/with-docker-multi-env now which is new but its not a great solution either.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
  • onyxia

    Discontinued 🔬 A data science oriented container launcher

  • But... we don't control the environment where it is deployed! We ship an open source application called 0nyxia. Our users deploy it themselves. We can't tell them to clone and build. Beside even if we had full control. It's a waste of resources to rebuild the whole application when it's possible to just restart with different environment variables.

  • envsafe

    🔒 Makes sure you don't accidentally deploy apps with missing or invalid environment variables.

  • In next JS it's much easier. It's not static, node can read the environment variables. For validation and type safety, you can use this.

  • react-env

    Runtime environment variables for react apps.

  • This package does the same for Next.js. It's actually a very simple concept that can be done without the package tbh. We use an older version at my work and there's a few challenges (ie11 support which thank God is becoming less of an issue) also the package ingests the env vars in a different order than Next.js which can be a trip at first. The second complaint can be solved by a home grown solution lol.

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts