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
| Field | Type | Description |
|---|---|---|
name | string | The unique name of your application. |
version | string | (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"],
}
}| Field | Type | Description |
|---|---|---|
files | string[] | 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"
]
}
}| Field | Type | Description | Default |
|---|---|---|---|
allowWasm | boolean | If true, the engine will allow loading and executing WebAssembly (.wasm) extensions. | false |
allowNative | string[] | 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.
| Field | Type | Description |
|---|---|---|
entry | string | (Optional) The entry point for your application logic. Defaults to app/. |
port | number | (Optional) The default port for the titan server. This can be overridden by environment variables. |
🛡️ Best Practices
- Minimalist Permissions: Only add extensions to
allowNativethat you have vetted and trust. - Explicit Builds: Always use
env: "production"in yourbuildblock when preparing a deployment bundle. - Custom Assets: Keep your
filesarray updated if your application relies on specific folders (likecerts/orcustom-assets/) remaining available in the final bundle.