CLI Tool (`create-twenty-app`)
Relevant source files
The following files were used as context for generating this wiki page:
create-twenty-app is the official command-line interface (CLI) for scaffolding applications on top of the Twenty CRM. Its primary purpose is to bootstrap a zero-configuration, ready-to-run project that integrates seamlessly with the twenty-sdk. This tool simplifies the initial setup for developers, providing a structured starting point with pre-configured scripts and TypeScript support.
The generated project is designed to work directly with the twenty-sdk, which provides the core functionalities for developing, building, and publishing applications that extend Twenty CRM.
Sources: packages/create-twenty-app/README.md
Quick Start
To create a new Twenty application, you need Node.js (v24+) and Yarn (v4+). The process begins with a single command to generate the project structure, followed by a series of yarn scripts to manage the application's lifecycle.
Sources: packages/create-twenty-app/README.md
Developer Workflow
The following diagram illustrates the typical workflow for a developer using create-twenty-app.
Sources: packages/create-twenty-app/README.md
Scaffolded Scripts
The generated project includes a set of pre-wired scripts in its package.json. These scripts are convenient wrappers around the twenty-sdk CLI commands.
| Command | Description | Underlying twenty-sdk Command |
|---|---|---|
yarn auth | Authenticates the CLI with your Twenty workspace using an API key. | twenty auth login |
yarn create-entity | Starts a guided process to add a new entity to the application. | twenty app add |
yarn generate | Generates a typed Twenty client and TypeScript definitions for workspace entities. | twenty app generate |
yarn dev | Starts development mode, which automatically syncs local file changes to your workspace. | twenty app dev |
yarn sync | Performs a one-time sync of local changes to the workspace. | twenty app sync |
yarn logs | Watches and displays the logs for your application's functions. | (Not explicitly mapped, but part of SDK functionality) |
yarn uninstall | Uninstalls the application from the current workspace. | twenty app uninstall |
yarn help | Displays help information for the available commands. | twenty help |
Sources: packages/create-twenty-app/README.md, packages/twenty-sdk/README.md
Project Scaffolding
When you run create-twenty-app, it scaffolds a minimal project structure that is ready for Twenty application development.
The scaffolded project includes:
- A minimal application structure.
- A
package.jsonwith pre-configured scripts. - A TypeScript configuration (
tsconfig.json). - Example placeholders to guide the creation of entities, actions, and sync logic.
Sources: packages/create-twenty-app/README.md, packages/twenty-cli/README.md
The following diagram shows the relationship between create-twenty-app and the generated project's dependency on twenty-sdk.
Architecture and Dependencies
The create-twenty-app tool is a Node.js application built to be an interactive CLI. Its dependencies, listed in package.json, reveal its architecture.
| Dependency | Purpose |
|---|---|
commander | A framework for building node.js command-line interfaces. It parses arguments and options. |
inquirer | Provides interactive command-line user interfaces (prompts, questions). |
fs-extra | Adds file system methods that aren't included in the native fs module, used for creating files and directories. |
chalk | Used for styling terminal string output with colors. |
lodash.* | Utility functions for string manipulation (e.g., camelCase, kebabCase). |
Sources: packages/create-twenty-app/package.json
The bin field in its package.json defines the executable command that npx runs.
{
"name": "create-twenty-app",
"version": "0.2.0",
"bin": "dist/cli.cjs",
...
}
Sources: packages/create-twenty-app/package.json:4-5
Relationship with twenty-sdk and twenty-cli
The Twenty development ecosystem has evolved. The original CLI tool was twenty-cli, which is now deprecated. It has been replaced by twenty-sdk, which provides both an SDK and a more powerful CLI under the twenty command.
create-twenty-app is the modern entry point for developers and exclusively sets up projects to use the current twenty-sdk. It does not use the deprecated twenty-cli package. This ensures that all new applications are built with the latest and supported tooling.
Sources: packages/twenty-cli/README.md, packages/twenty-sdk/README.md, packages/create-twenty-app/README.md
Publishing an Application
Once an application is developed, it can be shared with the community by submitting it to the main Twenty repository. The process involves:
- Cloning the
twentyhq/twentyrepository. - Creating a new branch.
- Copying the application folder into
packages/twenty-apps/community. - Opening a pull request for the Twenty team to review.
Sources: packages/create-twenty-app/README.md, packages/twenty-sdk/README.md