Skip to main content

How apps work

An app is a collection of entities declared using defineEntity() functions from the twenty-sdk package. The CLI detects these declarations via AST analysis at build time and produces a manifest — a complete description of what your app adds to a workspace. These functions validate your configuration at build time and provide IDE autocompletion and type safety.
File organization is up to you. Entity detection is AST-based — the SDK finds export default defineEntity(...) calls regardless of where the file lives. The folder structure above is a convention, not a requirement.

Entity types

Sandboxing

  • Logic functions run in isolated Node.js processes on the server. They only access data through the typed API client, which acts either as the person who triggered the run or as the app itself. See Whose access a call uses.
  • Front components run in Web Workers using Remote DOM — sandboxed from the main page but rendering native DOM elements (not iframes). They communicate with Twenty via a message-passing host API.
  • Permissions are enforced at the API level. Two runtime tokens are injected, both derived from the role declared with defineApplicationRole(); the default one is narrowed further to what the triggering person can do whenever someone is behind the run.

App lifecycle

  • twenty app dev — watches your source files and live-syncs changes to a connected Twenty server. After a successful sync, it regenerates the typed API client when the schema or installed generator package changed, or generated client files are missing or changed. To refresh types after changing the workspace in the UI, run twenty app generate-client.
  • twenty app build — compiles TypeScript, bundles logic functions and front components with esbuild, and produces a manifest.
  • Pre/post-install and uninstall hooks — optional functions that run during installation or right before removal. See Install Hooks for details.

Next steps

apps-config
Config
Application identity, default role, and install and uninstall hooks.
apps-data
Data
Objects, fields, and bidirectional relations.
apps-logic
Logic
Logic functions, skills, agents, connections, and messaging channels.
layout-window-v1
Layout
Views, navigation, page layouts, front components.
apps-operations
Operations
CLI, testing, remotes, CI, and publishing your app.