Config & Environments
How to configure Jeasx
Jeasx provides sensible defaults to get you started quickly, but it also allows you to override important settings with environment variables. This makes it easy to adapt the framework to your needs.
To facilitate managing multiple configurations, Jeasx leverages dotenv-flow for handling .env-files. This enables the use of different .env-files based on the NODE_ENV value, such as .env.development
to override values from .env
.
Please note: Jeasx only sets NODE_ENV="development"
automatically when running jeasx dev
. For production or testing environments, you'll need to set the NODE_ENV
environment variable to the desired value (e.g. production
or test
) depending on your requirements and workflows.
Environment variables for client and server
For security reasons, only environment variables prefixed with BROWSER_PUBLIC_
are accessible in client-side JavaScript to prevent accidental exposure of sensitive data. In server-side code, all environment variables are accessible regardless of their naming convention.
Environment Variables
Name | Description |
---|---|
HOST | The hostname or IP address that the server should listen on. Defaults to |
PORT | The port number that the server should listen on. Defaults to |
BUILD_TIME | A read-only value set at build time and encoded as |
ESBUILD_BROWSER_TARGET | Defaults to |
FASTIFY_BODY_LIMIT | The default maximum body size for incoming requests is |
FASTIFY_DISABLE_REQUEST_LOGGING | Set this to true to disable request logging. |
FASTIFY_STATIC_HEADERS | Custom headers for static files, such as JavaScript, CSS, and assets from the public directory. Use these headers to configure cache settings for static content.
The keys of the mapping are compared via Please note: If you set caching headers in global |
FASTIFY_TRUST_PROXY | By enabling the trustProxy option, Fastify will know that it is sitting behind a proxy and that the X-Forwarded-* header fields may be trusted, which otherwise may be easily spoofed. Please note: the option only supports |
JEASX_BUILD_JS_WATCH | Watched directories for browser bundle. This is only needed if you want to share code between server and browser (e.g. set it to |