✨ If you've tried DMNO or looked through the docs, let us know
what you think!
Using DMNO with Vercel
This platform integration exposes a pre-made config schema and underlying types to interact with the env vars that Vercel injects while using their platform. You may not need this at all, but it can be useful if you are using their platform extensively and want helpful type info for their system’s env vars.
Vercel injects a set of system environment variables at build and runtime that provide information about the current build or runtime environment.
The @dmno/vercel-platform module exposes DMNO data types and a pre-made config schema object which you can use in your own schema. You can use the pickFromSchemaObject utility to pick only the env var keys that you need from the full list that Vercel injects. For example:
Migrating from Vercel managed config
Should I set env vars in the Vercel UI at all?
Vercel has the ability to set config vars per environment - dev/preview/prod. Of course you can still set overrides and secrets within the Vercel UI if you like and rely on config values being injected that way.
However, we recommend migrating all of your config to DMNO itself by using switchBy to create branching logic based on the VERCEL_ENV flag injected and any other logic you like. This is much more flexible and powerful, and will centralize your config management within your codebase.
You can also use plugins - for example our Encrypted Vault and 1Password plugins - to handle sensitive config within your schema. Note that you will still set a single environment variable in the Vercel UI, to allow these plugins to access the rest of your secrets.