Titan Planet Logo
How to Use Titan

14. Configuration (tanfig.json)

Explore all possible configurations for your TitanPL application in the tanfig.json file.

The tanfig.json file is the central point of configuration for your TitanPL project. It controls how your application is built, how extensions are loaded, and how the engine behaves in different environments.


🏗️ Top-Level Configuration

FieldTypeDescription
namestringThe unique name of your application.
versionstring(Optional) The version of your application.

📦 Build Configuration (build)

The build block controls the behavior of the titan build --release command.

{
  "build": {
    "files": ["public", "static", "db", "certs", "custom-assets"],
  }
}
FieldTypeDescription
filesstring[]An array of files or folders from your project root that should be copied into the build/ directory. By default, TitanPL copies public, static, db, and tanfig.json.

🧩 Extension Configuration (extensions)

The extensions block handles security and permissions for different types of TitanPL extensions.

{
  "extensions": {
    "allowWasm": true,
    "allowNative": [
      "@titanpl/core",
      "my-custom-native-ext"
    ]
  }
}
FieldTypeDescriptionDefault
allowWasmbooleanIf true, the engine will allow loading and executing WebAssembly (.wasm) extensions.false
allowNativestring[]A list of explicit extension names (found in node_modules or .ext/) that are permitted to run in native mode.[]

Security Rule: To prevent unvetted code execution, any extension that is not a JS-only extension must be explicitly allowed here. If a native extension is found but not listed, the engine will refuse to start.


🚀 Engine Configuration (engine)

(Advanced) Configure how the TitanPL engine interacts with your host environment.

FieldTypeDescription
entrystring(Optional) The entry point for your application logic. Defaults to app/.
portnumber(Optional) The default port for the titan server. This can be overridden by environment variables.

🛡️ Best Practices

  • Minimalist Permissions: Only add extensions to allowNative that you have vetted and trust.
  • Explicit Builds: Always use env: "production" in your build block when preparing a deployment bundle.
  • Custom Assets: Keep your files array updated if your application relies on specific folders (like certs/ or custom-assets/) remaining available in the final bundle.

On this page