Nxpress LogoNxpressv1.3.8
03

Server Options & Configuration

Server options can be configured via nxpress.config.json (or .js, .ts, .mjs, .cjs) in the project root, or passed directly to nxpress(options) / serve(options).

Configuration Schema Options

All configurable properties accepted by the Nxpress server options schema:

OptionTypeDefaultDescription
rootDirstringprocess.cwd()Absolute path to the project root directory.
appDirstring"app" (or "pages")Directory containing view templates and route files.
componentsDirstring"components"Directory containing reusable template components.
publicDirstring"public"Directory for serving static assets via Express static middleware.
enginestring"ejs"Template engine choice ("ejs", "hbs", "html", "nunjucks", "liquid").
portnumber3000HTTP server port number (can also be set via process.env.PORT).
tailwindboolean | objecttrueAutomatic Tailwind CSS compilation (true, false, or custom path config).
globalsobject{}Application-wide default global variables injected into all template views.
secureEnvbooleantrueSecurity flag filtering environment variables exposed to templates via E / env.
isDevbooleanAuto-detectedDevelopment mode flag enabling Hot Reload and live route re-scanning.
i18nobjectundefinedInternationalization options (locales, defaultLocale, prefixDefault, localesDir).

Configuration Example (nxpress.config.json)

nxpress.config.json
{
  "$schema": "https://unpkg.com/@nxpress/core@latest/schema.json",
  "port": 3000,
  "engine": "ejs",
  "appDir": "app",
  "componentsDir": "components",
  "publicDir": "public",
  "secureEnv": true,
  "i18n": {
    "locales": ["fr", "en", "es"],
    "defaultLocale": "fr",
    "prefixDefault": false
  },
  "globals": {
    "siteName": "My Store",
    "author": "Nxpress Team",
    "currency": "$"
  }
}