react-env
envsafe
react-env | envsafe | |
---|---|---|
3 | 3 | |
297 | 775 | |
- | - | |
0.0 | 0.0 | |
about 1 year ago | 11 months ago | |
JavaScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
react-env
- Runtime variables vs build time variables in ReactJS
-
Docker build per environment vs. single build for all environments
Runtime env vars.
-
Bundle environment variables in create-react-app at launch time (not build time)!
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.
envsafe
-
Next.js with Public Environment Variables in Docker
To further secure your environment variables, consider using envsafe for validation and type safety. Install the package and adjust the env/env.ts file accordingly along with the variable types:
-
Type-safe env variables
Disclaimer: This post is inspired by env-safe by @alexdotjs and his recent Twitter reply to my thread, where he suggested handling environmental variables in Typescript with a generic schema validation library over a dedicated library. If youβre not following Alex on Twitter yet, you should definitely do it now!
-
Bundle environment variables in create-react-app at launch time (not build time)!
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.
What are some alternatives?
craco - Create React App Configuration Override, an easy and comprehensible configuration layer for Create React App.
react-starter-kit - The web's most popular Jamstack front-end template (boilerplate) for building web applications with React
mocktail - Free, 11MB, containerized, self-hosted mock server.
envy - Envy allows you to synchronize environment variables across different machines.
cra-envs - βοΈ Bundle env var in CRA at launch time!
examples-next-prisma-starter - π tRPC starter repo with E2E-testing
Next.js - The React Framework
global-env - Dynamically evaluate environment variables at runtime.
envcli - Populate .env file from javascript variables
onyxia - π¬ A data science oriented container launcher
zart - π€― zART-stack β Zero-API, React [Native], & TypeScript