Introduction to Twenty Apps
Relevant source files
The following files were used as context for generating this wiki page:- packages/create-twenty-app/README.md
- packages/twenty-sdk/README.md
- packages/twenty-cli/README.md
- packages/twenty-apps/community/webmetic/README.md
- packages/twenty-apps/community/rollup-engine/README.md
- packages/twenty-apps/community/linkedin-browser-extension/browser-extension/README.md
- packages/twenty-apps/community/activity-summary/README.md
Twenty Apps are extensions that add new features and integrations to the Twenty CRM platform. They allow developers to build custom logic, connect to external services, and enhance the core CRM experience. The ecosystem is supported by a dedicated Software Development Kit (SDK) and a scaffolding tool that simplifies the creation, development, and publishing of these applications.
Apps can range from simple serverless functions triggered by events to complex integrations with third-party APIs or even browser extensions that interact with other websites. The development workflow is designed to be streamlined, with tools for authentication, code generation, and live synchronization with a Twenty workspace for rapid testing and iteration.
Sources: packages/create-twenty-app/README.md, packages/twenty-sdk/README.md, packages/twenty-apps/community/linkedin-browser-extension/browser-extension/README.md
Core Tooling
The development of Twenty Apps relies on two primary command-line interface (CLI) tools: create-twenty-app for project initialization and twenty-sdk for the development lifecycle.
Sources: packages/create-twenty-app/README.md, packages/twenty-sdk/README.md
create-twenty-app
This is the official scaffolding CLI for bootstrapping a new Twenty App. It creates a minimal, zero-config project structure that is ready to run and works seamlessly with the twenty-sdk.
Key features include:
- Project Bootstrap: Generates a minimal app structure with TypeScript configuration.
- Pre-configured Scripts: Includes pre-wired scripts for common development tasks like authentication, code generation, and synchronization.
- Example Placeholders: Provides examples to guide developers in adding entities, actions, and sync logic.
Sources: packages/create-twenty-app/README.md:12-16
twenty-sdk
The twenty-sdk provides the core CLI and libraries to develop, build, and publish applications. It is the successor to the deprecated twenty-cli package.
Key features include:
- Type-Safe Client: Generates a typed Twenty client and TypeScript definitions for workspace entities.
- Development Lifecycle CLI: Offers commands for authentication, code generation, development synchronization, one-off sync, and uninstallation.
Sources: packages/twenty-sdk/README.md:12-16, packages/twenty-cli/README.md:3-4
Development Workflow
The process of creating and deploying a Twenty App follows a structured path, from initial setup to publishing.
The following diagram illustrates the typical development lifecycle for a Twenty App.
Key CLI Commands
The create-twenty-app scaffolder provides convenient yarn scripts that wrap the underlying twenty-sdk commands.
Command (yarn ...) | twenty-sdk Equivalent | Description |
|---|---|---|
auth | twenty auth login | Authenticates the CLI with your Twenty workspace using an API key. |
create-entity | twenty app add | A guided process to add a new entity to your application. |
generate | twenty app generate | Generates a typed Twenty client and workspace entity types. |
dev | twenty app dev | Starts development mode, automatically syncing local changes to your workspace. |
sync | twenty app sync | Performs a one-time synchronization of local changes to the workspace. |
logs | N/A | Watches and displays logs for the application's functions. |
uninstall | twenty app uninstall | Uninstalls the application from the current workspace. |
Sources: packages/create-twenty-app/README.md:22-44, packages/twenty-sdk/README.md:33-48
Authentication and Synchronization
The development process involves a sequence of interactions between the developer's local machine, the twenty-sdk CLI, and the Twenty CRM backend.
This sequence diagram shows how a developer uses the CLI to sync an app to their workspace.
App Architecture
A Twenty App is typically structured as a package within the packages/twenty-apps directory. While architectures can vary (e.g., browser extensions), a common pattern involves serverless functions, triggers, and configuration managed within the Twenty UI.
*Sources: packages/twenty-apps/community/webmetic/README.md, packages/twenty-apps/community/rollup-engine/README.md, packages/twenty-apps/community/linkedin-browser-extension/browser-extension/README.md *
Example App: Webmetic Visitor Intelligence
The Webmetic app demonstrates a typical serverless integration. It automatically syncs B2B website visitor data from the Webmetic API into Twenty.
The data flow for the Webmetic app is as follows:
Configuration
Apps can define configuration variables that users can set within the Twenty UI. These are often used for API keys, domain names, or other settings.
The Webmetic app, for example, requires the following configuration:
| Variable | Required | Description |
|---|---|---|
TWENTY_API_KEY | ✅ Yes | The Twenty API key for authentication. |
TWENTY_API_URL | ❌ No | Base URL of the Twenty instance. |
WEBMETIC_API_KEY | ✅ Yes | The API key for the Webmetic service. |
WEBMETIC_DOMAIN | ✅ Yes | The website domain to track. |
Source: packages/twenty-apps/community/webmetic/README.md:104-109
The Rollup Engine app shows how a JSON object can be used for more complex configuration, allowing users to override default behavior without changing the code.
Source: packages/twenty-apps/community/rollup-engine/README.md:54-57
Metadata and Custom Objects
Apps can programmatically create and manage custom objects and fields in the Twenty data model. For instance, the Webmetic app creates a websiteLead custom object with 14 fields to store visitor data. This is done idempotently, meaning the sync function can be run multiple times without creating duplicate fields or objects.
This is achieved by using:
- REST API: For data operations like creating and updating records (
POST /rest/companies,POST /rest/websiteLeads). - GraphQL Metadata API: For schema management like creating objects and fields (
createOneObject,createOneField).
Source: packages/twenty-apps/community/webmetic/README.md:25-31, 111-120
Publishing and Contribution
Developers are encouraged to share their applications with the Twenty community. The process involves contributing the app to the main Twenty repository.
The steps to publish an app are:
- Clone the
twentyhq/twentyrepository. - Create a new branch for your app (e.g.,
feature/my-awesome-app). - Copy your completed app folder into the
packages/twenty-apps/directory. - Commit the changes and open a pull request against the
twentyhq/twentyrepository.
The Twenty team reviews contributions for quality, security, and reusability before merging them.
Sources: packages/create-twenty-app/README.md:52-65, packages/twenty-sdk/README.md:55-68
Conclusion
The Twenty Apps ecosystem provides a powerful and flexible way to extend the CRM's capabilities. By leveraging create-twenty-app for quick setup and twenty-sdk for the development lifecycle, developers can build, test, and deploy custom integrations efficiently. The architecture supports serverless functions, custom data models, and external API integrations, with a clear path for contributing apps back to the open-source community.
Sources: packages/create-twenty-app/README.md, packages/twenty-sdk/README.md