Skip to content

App Manifest

Every Forge app is defined by a ptkl.config.js file — a default export that describes the app's identity, entry points, lifecycle scripts, services, tools, and permissions.


Example

import path from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

export default {
    name: 'invoice-app',
    version: '1.0.0',
    icon: 'icon.svg',
    type: 'platform',
    label: {
        locales: {
            en_US: 'Invoice App',
            sr: 'Aplikacija za fakture',
        }
    },

    views: {
        main: path.resolve(__dirname, 'src/main.tsx'),
        'public-invoice': {
            entry: path.resolve(__dirname, 'src/publicInvoice.tsx'),
            access: 'public',
            permissions: ['read invoices', 'get documents'],
        },
    },

    services: [
        {
            name: 'track-invoice',
            script: path.resolve(__dirname, 'src/services/trackInvoice.ts'),
            access: 'public',
            permissions: ['read invoices'],
            label: { locales: { en_US: 'Track Invoice' } },
            description: { locales: { en_US: 'Look up invoice status by tracking number' } },
        },
        {
            name: 'create-invoice',
            script: path.resolve(__dirname, 'src/services/createInvoice.ts'),
            access: 'platform',
            permissions: ['read invoices', 'write invoices'],
        },
    ],

    scripts: {
        install: path.resolve(__dirname, 'src/scripts/install.ts'),
        uninstall: path.resolve(__dirname, 'src/scripts/uninstall.ts'),
    },

    distPath: path.resolve(__dirname, "dist"),

    permissions: [
        "invoices",
        "read invoices",
        "edit invoices",
    ],

    install_permissions: [
        "manage base_components",
    ],

    runtime_permissions: [
        "read invoices",
        "edit invoices",
        "read documents",
    ],
}

Fields

name

Type string
Required Yes

Unique identifier for the app. Used as the storage key and to match the app record when uploading new versions.

version

Type string
Required Yes

Semantic version string (e.g. "1.0.0"). Each uploaded version is stored separately — an app can have up to 5 versions.

icon

Type string
Required No

Path or filename for the app icon. Used as the favicon when the app is loaded in the platform.

type

Type "platform" | "public" | "service"
Required No
Default "platform"

Determines the app's visibility, infrastructure provisioning, and what resources it can expose.

Value Description
platform Internal app. Views default to access: "platform" but individual views can be set to "public". Can declare services with either access scope.
public Public-facing app. All views and services must be access: "public". Automatically receives an API role, API user, API token, and a generated subdomain (e.g. happy-cat.ptkl.app). Enables ssrRenderer.
service Headless API-only app. Cannot declare views. All services must be access: "public". Accessed exclusively through service domains.

label

Type { locales: Record<string, string> }
Required No

Internationalized display name shown in the platform UI and used as document.title when the app loads.

label: {
    locales: {
        en_US: 'My App',
        sr: 'Moja Aplikacija',
    }
}

views

Type Record<string, string \| ViewDefinition>
Required Yes (except for type: "service")

Map of view names to their entry points. Each value can be a simple file path string or an object with access control.

views: {
    main: path.resolve(__dirname, 'src/main.tsx'),
}

When the value is a string, it is treated as the entry point path. The view inherits its access scope from the app type: "platform" for platform apps, "public" for public apps.

views: {
    main: path.resolve(__dirname, 'src/main.tsx'),
    'public-invoice': {
        entry: path.resolve(__dirname, 'src/publicInvoice.tsx'),
        access: 'public',
        permissions: ['read invoices', 'get documents'],
    },
}

Object entries accept:

Field Type Description
entry string Path to the view's entry point file. Required.
access "platform" | "public" Access scope. Defaults to the app type's default.
permissions string[] Subset of runtime_permissions this view needs. Used to mint a scoped token for the view's API proxy.

Both formats can be mixed in the same views object. The main view is the primary entry point loaded by the platform shell.

Public views are standalone SPAs

Views with access: "public" are served as standalone single-page applications without the platform shell (no sidebar, no header, no $forge global). They are accessed through {uuid}.public.ptkl.app/{view-name}. The app's edit page lists them in its Public views tab.

Access scope constraints

  • type: "public" apps — all views must be access: "public"
  • type: "service" apps — views are not allowed
  • type: "platform" apps — views can be either "platform" or "public"

Limits: Maximum 10 views per app. View names must match ^[a-z][a-z0-9-]{0,62}[a-z0-9]$ (lowercase, hyphens allowed, 2–64 characters). The name main is also allowed.

services

Type ServiceDefinition[]
Required No

Array of service definitions. Services are server-side scripts that execute in an isolated sandbox and are callable via HTTP. See Services for the full execution model.

services: [
    {
        name: 'track-invoice',
        script: path.resolve(__dirname, 'src/services/trackInvoice.ts'),
        access: 'public',
        permissions: ['read invoices'],
        label: { locales: { en_US: 'Track Invoice' } },
        description: { locales: { en_US: 'Look up invoice status by tracking number' } },
    },
]

Each service definition has:

Field Type Required Description
name string Yes Unique name for the service. Appears in the URL path. Must match ^[a-z][a-z0-9-]{1,62}[a-z0-9]$.
script string Yes Path to the service script source file.
access "platform" | "public" No Access scope. Defaults to "public" for public and service apps.
permissions string[] No Subset of runtime_permissions the service needs. A scoped token is minted with these permissions.
label { locales: Record<string, string> } No Display name for the service.
description { locales: Record<string, string> } No Human-readable description of what the service does.

Access scope constraints

  • type: "public" apps — all services must be access: "public"
  • type: "service" apps — services can be either "platform" or "public"
  • type: "platform" apps — services can be either "platform" or "public"

Limits: Maximum 20 services per app. Service permissions must be a subset of the app's runtime_permissions.

tools

Type ToolDefinition[]
Required No

Array of tools that Kortex agents can call. Tools are server-side scripts like services, with a validated input and no HTTP endpoint. See Tools for the full model.

tools: [
    {
        name: 'find_orders',
        description: 'Find orders by customer email.',
        input_schema: {
            type: 'object',
            properties: { email: { type: 'string' } },
            required: ['email'],
        },
        read_only: true,
        permissions: ['read orders'],
        script: path.resolve(__dirname, 'src/tools/findOrders.ts'),
    },
]

Each tool definition has:

Field Type Required Description
name string Yes Unique among the app's tools. Must match ^[a-z][a-z0-9_]{0,63}$.
description string Yes 1 to 1024 characters. What the tool does and when to use it.
input_schema object Yes JSON Schema of type: "object" for the input. At most 16 KB serialized.
read_only boolean No The tool changes nothing. Defaults to false.
destructive boolean No The tool deletes or overwrites data. Defaults to false. Cannot be combined with read_only.
permissions string[] No Subset of runtime_permissions the tool needs.
script string Yes Path to the tool script source file.

Limits: Maximum 50 tools per app. Tool permissions must be a subset of the app's runtime_permissions. An app that declares tools needs an Owner or Maintainer to approve it.

scripts

Type { install?: string, uninstall?: string }
Required No

Paths to lifecycle scripts that run during deployment and removal. See Lifecycle Scripts for details.

scripts: {
    install: path.resolve(__dirname, 'src/scripts/install.ts'),
    uninstall: path.resolve(__dirname, 'src/scripts/uninstall.ts'),
}
  • install — Runs every time a version is deployed. Must be idempotent.
  • uninstall — Runs when a version is revoked or the app is deleted.

distPath

Type string
Required No

Absolute path to the build output directory. This is where the bundled assets (main.bundle.js, main.css, etc.) are written during the build process.

distPath: path.resolve(__dirname, "dist"),

ssrRenderer

Type string
Required No
Available Only when type is "public"

Path to the server-side rendering entry point. When provided, the platform uses this file to pre-render the app on the server before sending it to the client. This option is only available for public apps.

ssrRenderer: path.resolve(__dirname, 'src/ssr/renderer.tsx'),

permissions

Type string[]
Required No

List of permissions that the app exposes to the platform's permission system. Once deployed, these permissions become available to assign to any role on the platform — allowing fine-grained access control scoped to the app's functionality.

permissions: [
    "reviewer",
    "documents",
    "read documents",
    "edit documents",
    "documents:delete",
]

Permissions are additive

The app declares what permissions exist. Platform administrators then assign these permissions to roles through the standard role management interface. Users with those roles will have the corresponding access when using the app.

install_permissions

Type string[]
Required No

List of platform permissions the install and uninstall scripts are allowed to use. Before a user installs the app, they are shown a consent screen listing exactly these permissions — similar to an OAuth scope screen. The script runs with a token scoped to only these permissions and cannot act outside of them.

If omitted, the install script still executes but receives a token with no permissions. Any call to a Protokol API that requires authorization will fail — the script can only perform work that does not depend on platform API access.

install_permissions: [
    "manage base_components",
    "manage integrations",
]

An app whose install script declares or sets component secrets lists secrets::write <ref> for each component, for example secrets::write orders. The person installing or updating the app must hold it.

runtime_permissions

Type string[]
Required No

List of platform permissions the app is allowed to use at runtime. This is the permission pool for three consumers:

  1. Platform views — When a user launches the app, the runtime token contains the intersection of runtime_permissions and the user's own permissions.
  2. Public views — The view's permissions array (a subset of runtime_permissions) determines the scoped token. No user context is involved.
  3. Services — Same as public views: the service's permissions array is used to mint a scoped token.

If omitted, the app's UI and services receive no platform permissions at runtime.

runtime_permissions: [
    "read invoices",
    "edit invoices",
    "read documents",
]

entitlements

Type string[]
Required No

List of platform permissions that are unconditionally added to the app's runtime token, regardless of the launching user's own roles. Unlike runtime_permissions, entitlements bypass the user-intersection step — the app always receives these permissions when it starts.

Use entitlements for capabilities the app always needs to function correctly, independent of who is using it.

entitlements: [
    "documents:delete",
    "documents:archive",
]

Entitlements bypass user permission checks

Because entitlements are merged unconditionally, they should only be used for permissions the app genuinely requires to operate — not to grant elevated access to the end user.

Combined limit

The total count of runtime_permissions and entitlements combined must not exceed 100 entries. This limit is enforced during bundle upload and installation.

Approval covers every list

Whoever installs or updates the app approves its whole declared set: install_permissions, runtime_permissions, permissions, entitlements, and each service's and view's permissions. They must hold every permission in it. Declare only what the app needs. See Security: approval.

requires

Type { integrations: IntegrationRequirement[] }
Required No

Declares the integrations an app needs to work. An unmet requirement is reported by preflight and shown in the launch gate, which offers a button through to the integrations screen so the user can activate or upgrade what's missing — not a deep link to any one integration's billing page.

requires: {
    integrations: [
        { id: 'protokol-mail', options: ['standard', 'premium'] },
    ],
}

Each entry in requires.integrations:

Field Type Required Description
id string Yes Integration id, e.g. "protokol-mail".
optional boolean No false (default) — hard requirement: the app will not launch until it is met. true — soft requirement: reported by preflight but never gates launch.
options string[] No Acceptable option codes. Omit for a presence-only requirement (the integration just needs to be active, any tier).

An option is a product variant — a project holds exactly one per integration at a time, so options is always matched any-of: options: ['standard', 'premium'] means "either tier satisfies this," never "both are required." There is no all-of reading.

requires gates launch, not installation

An unmet requirement never blocks installation — not the first install, not an update. It blocks launch, and only launch. An app can therefore be installed and unusable, and that is the intended state: a bundled hard dependency provisions the default option at install time, and it's the app's own onboarding that takes the user from there to the tier it actually needs. See Billing — satisfying requires for how an app can check this itself.

Hard integration dependencies are purchased with the app

A requires.integrations entry with optional: false (the default) is not merely a compatibility check — it is bundled into the app's checkout, trial, and activation-code flows as a purchase. Installing the app buys the dependency. Say this plainly wherever the app's pricing is described; it should not be a surprise the user discovers on the invoice.

Validated at ptkl forge bundle, and again at publish:

  • unknown keys on a requires.integrations entry are rejected
  • options, when present, must be a non-empty array of non-empty, unique strings

Option codes are not checked against the integration's live option set at build time — the toolkit has no project context, and an option set can change independently of an app's release cycle. An unknown code is only ever reported at preflight, where it has that context.

variables

Type { dev?: object, live?: object }
Required No

The default variables every install of the app starts from, per environment. It applies the same way to an install from the marketplace, one delivered by a paid subscription, or one made by the platform.

variables: {
    dev:  { API_URL: 'https://sandbox.example', SESSION_KEY: 'secretgen::random(32)' },
    live: { API_URL: 'https://api.example',     SESSION_KEY: 'secretgen::random(32)' },
}
  • A value is either plain or a secretgen:: generator. A generator produces a new secret for each install and environment. The secret is stored encrypted and never shown.
  • A secret:: value is refused, both at ptkl forge bundle and at publish. The manifest is readable by everyone who can read the app, so a secret written into it would be published. Declare a generator instead, or let the user set the value after install.
  • Values sent with an install override the defaults with the same key.

After install, the project changes its variables in the app's settings, and the app can update its own through the variables API.


Bundle Output

After building, the app is packaged as a .tar.gz bundle with the following structure:

invoice-app-1.0.0.tar.gz
├── manifest.json                  # Generated metadata (always at the root)
├── browser/                       # Everything a browser is served
│   ├── main.bundle.js             # Platform view bundle
│   ├── main.css
│   ├── public-invoice.bundle.js   # Public view bundle
│   └── public-invoice.css
└── server/                        # Everything only the platform reads
    ├── install.script.js
    ├── uninstall.script.js
    └── services/
        ├── track-invoice.js
        └── create-invoice.js

Browser files and server files never share a folder, and "layout": 2 in the manifest is what says so. A view, a lifecycle script and a service are all different kinds of file: a route that serves pages to a browser can refuse server/ outright, rather than relying on every path being checked.

Manifest paths do not carry the folder

"install.script.js", "services/track-invoice.js" and "main.bundle.js" are written exactly as before — the reader knows which folder its own kind of file lives in. Do not prefix a manifest path with browser/ or server/.

Bundles built before this layout have no layout field and keep every file in one flat folder. They are still served; nothing has to be rebuilt.

A lifecycle script is named after its manifest key, not its entry file: scripts: { install: 'src/setup.ts' } is bundled as install.script.js. The same goes for a view (views.main → main.bundle.js) and a service (name: 'track-invoice' → services/track-invoice.js).

The manifest.json in the bundle contains the serialized metadata — name, version, label, icon, permissions, views with resolved access scopes, services, and script paths.

manifest.json Format

{
    "layout": 2,
    "name": "invoice-app",
    "version": "1.0.0",
    "type": "platform",
    "label": { "locales": { "en_US": "Invoice App" } },
    "icon": "data:image/svg+xml;base64,...",
    "permissions": ["invoices", "read invoices", "edit invoices"],
    "install_permissions": ["manage base_components"],
    "runtime_permissions": ["read invoices", "edit invoices", "read documents"],
    "entitlements": [],
    "requires": {
        "integrations": [
            { "id": "protokol-mail", "options": ["standard", "premium"] }
        ]
    },
    "views": {
        "main": "main.bundle.js",
        "public-invoice": {
            "entry": "public-invoice.bundle.js",
            "access": "public",
            "permissions": ["read invoices", "read documents"]
        }
    },
    "services": [
        {
            "name": "track-invoice",
            "script": "services/track-invoice.js",
            "access": "public",
            "permissions": ["read invoices"],
            "label": { "locales": { "en_US": "Track Invoice" } },
            "description": { "locales": { "en_US": "Look up invoice status by tracking number" } }
        },
        {
            "name": "create-invoice",
            "script": "services/create-invoice.js",
            "access": "platform",
            "permissions": ["read invoices", "edit invoices"]
        }
    ],
    "scripts": {
        "install": "install.script.js",
        "uninstall": "uninstall.script.js"
    }
}

Views in the manifest use two formats:

  • String ("main.bundle.js") — no explicit access scope; inherits from app type.
  • Object ({ entry, access, permissions }) — view with explicit access scope and optional scoped permissions.

App Types at a Glance

Feature platform public service
Views Yes (platform or public) Yes (public only) No
Services Yes (platform or public) Yes (public only) Yes (platform or public)
Platform shell (sidebar, header) Yes No N/A
Custom domains No Yes No
SSR No Yes N/A
Auto-provisioned API user No Yes No
Lifecycle scripts Yes Yes Yes
UUID-based service domain When services declared When services declared Yes

Examples by Type

An internal app with views inside the platform shell and services with mixed access scopes.

export default {
    name: 'invoice-app',
    version: '1.0.0',
    type: 'platform',
    label: { locales: { en_US: 'Invoice App' } },

    views: {
        main: path.resolve(__dirname, 'src/main.tsx'),
    },

    services: [
        {
            name: 'create-invoice',
            script: path.resolve(__dirname, 'src/services/createInvoice.ts'),
            access: 'platform',
            permissions: ['read invoices', 'write invoices'],
        },
    ],

    runtime_permissions: ['read invoices', 'write invoices'],
}

A platform app that also exposes public views and services. Public views are standalone SPAs served outside the platform shell at {uuid}.public.ptkl.app/{view-name}. This is useful when a platform app needs both an internal UI for operators and a public-facing page for end users.

export default {
    name: 'invoice-app',
    version: '1.0.0',
    type: 'platform',
    label: { locales: { en_US: 'Invoice App' } },

    views: {
        main: path.resolve(__dirname, 'src/main.tsx'),
        'public-invoice': {
            entry: path.resolve(__dirname, 'src/publicInvoice.tsx'),
            access: 'public',
            permissions: ['read invoices'],
        },
    },

    services: [
        {
            name: 'create-invoice',
            script: path.resolve(__dirname, 'src/services/createInvoice.ts'),
            access: 'platform',
            permissions: ['read invoices', 'write invoices'],
        },
        {
            name: 'track-invoice',
            script: path.resolve(__dirname, 'src/services/trackInvoice.ts'),
            access: 'public',
            permissions: ['read invoices'],
        },
    ],

    runtime_permissions: ['read invoices', 'write invoices'],
}

A headless API-only app — no views, no platform shell. All services must be access: "public".

export default {
    name: 'email-sender',
    version: '1.0.0',
    type: 'service',
    label: { locales: { en_US: 'Email Sender' } },

    services: [
        {
            name: 'send-email',
            script: path.resolve(__dirname, 'src/services/sendEmail.ts'),
            permissions: ['send mail'],
        },
        {
            name: 'send-bulk',
            script: path.resolve(__dirname, 'src/services/sendBulk.ts'),
            permissions: ['send mail', 'read contacts'],
        },
    ],

    scripts: {
        install: path.resolve(__dirname, 'src/scripts/install.ts'),
    },

    install_permissions: ['manage integrations'],
    runtime_permissions: ['send mail', 'read contacts'],
}

A public-facing app with its own subdomain. All views and services must be access: "public".

export default {
    name: 'storefront',
    version: '1.0.0',
    type: 'public',
    label: { locales: { en_US: 'Storefront' } },

    views: {
        main: path.resolve(__dirname, 'src/main.tsx'),
    },

    services: [
        {
            name: 'add-to-cart',
            script: path.resolve(__dirname, 'src/services/addToCart.ts'),
            permissions: ['write orders'],
        },
    ],

    ssrRenderer: path.resolve(__dirname, 'src/ssr/renderer.tsx'),
    runtime_permissions: ['write orders', 'read products'],
}

See Also