- Define custom objects and fields as code (managed data model)
- Build logic functions with custom triggers (HTTP routes, cron, database events)
- Define skills for AI agents
- Build front components that render inside Twenty’s UI
- Deploy the same app across multiple workspaces
Prerequisites
- Node.js 24+ and Yarn 4
- A Twenty workspace and an API key (create one at https://app.twenty.com/settings/api-webhooks)
Getting Started
Create a new app using the official scaffolder, then authenticate and start developing:Project structure (scaffolded)
When you runnpx create-twenty-app@latest my-twenty-app, the scaffolder:
- Copies a minimal base application into
my-twenty-app/ - Adds a local
twenty-sdkdependency and Yarn 4 configuration - Creates config files and scripts wired to the
twentyCLI - Generates core files (application config, default function role, pre-install and post-install functions) plus example files based on the scaffolding mode
--exhaustive mode looks like this:
--minimal, only the core files are created (application-config.ts, roles/default-role.ts, logic-functions/pre-install.ts, and logic-functions/post-install.ts).
At a high level:
- package.json: Declares the app name, version, engines (Node 24+, Yarn 4), and adds
twenty-sdkplus atwentyscript that delegates to the localtwentyCLI. Runyarn twenty helpto list all available commands. - .gitignore: Ignores common artifacts such as
node_modules,.yarn,generated/(typed client),dist/,build/, coverage folders, log files, and.env*files. - yarn.lock, .yarnrc.yml, .yarn/: Lock and configure the Yarn 4 toolchain used by the project.
- .nvmrc: Pins the Node.js version expected by the project.
- .oxlintrc.json and tsconfig.json: Provide linting and TypeScript configuration for your app’s TypeScript sources.
- README.md: A short README in the app root with basic instructions.
- public/: A folder for storing public assets (images, fonts, static files) that will be served with your application. Files placed here are uploaded during sync and accessible at runtime.
- src/: The main place where you define your application-as-code
Entity detection
The SDK detects entities by parsing your TypeScript files forexport default define<Entity>({...}) calls. Each entity type has a corresponding helper function exported from twenty-sdk:
| Helper function | Entity type |
|---|---|
defineObject | Custom object definitions |
defineLogicFunction | Logic function definitions |
definePreInstallLogicFunction | Pre-install logic function (runs before installation) |
definePostInstallLogicFunction | Post-install logic function (runs after installation) |
defineFrontComponent | Front component definitions |
defineRole | Role definitions |
defineField | Field extensions for existing objects |
defineView | Saved view definitions |
defineNavigationMenuItem | Navigation menu item definitions |
defineSkill | AI agent skill definitions |
File naming is flexible. Entity detection is AST-based — the SDK scans your source files for the
export default define<Entity>({...}) pattern. You can organize your files and folders however you like. Grouping by entity type (e.g., logic-functions/, roles/) is just a convention for code organization, not a requirement.yarn twenty app:devwill auto-generate two typed API clients innode_modules/twenty-sdk/generated:CoreApiClient(for workspace data via/graphql) andMetadataApiClient(for workspace configuration and file uploads via/metadata).yarn twenty entity:addwill add entity definition files undersrc/for your custom objects, functions, front components, roles, skills, and more.
Authentication
The first time you runyarn twenty auth:login, you’ll be prompted for:
- API URL (defaults to http://localhost:3000 or your current workspace profile)
- API key
~/.twenty/config.json. You can maintain multiple profiles and switch between them.
Managing workspaces
yarn twenty auth:switch, all subsequent commands will use that workspace by default. You can still override it temporarily with --workspace <name>.
Manual setup (without the scaffolder)
While we recommend usingcreate-twenty-app for the best getting-started experience, you can also set up a project manually. Do not install the CLI globally. Instead, add twenty-sdk as a local dependency and wire a single script in your package.json:
twenty script:
yarn twenty <command>, e.g. yarn twenty app:dev, yarn twenty help, etc.
Troubleshooting
- Authentication errors: run
yarn twenty auth:loginand ensure your API key has the required permissions. - Cannot connect to server: verify the API URL and that the Twenty server is reachable.
- Types or client missing/outdated: restart
yarn twenty app:dev— it auto-generates the typed client. - Dev mode not syncing: ensure
yarn twenty app:devis running and that changes are not ignored by your environment.