Overview
Twenty applications allow you to:- Create custom objects - Add new data models to your CRM
- Build serverless functions - Run backend logic triggered by events
- Add UI components - Extend the frontend with custom views
- Integrate external services - Connect Twenty with third-party APIs
- Automate workflows - Create complex business logic
Prerequisites
- Node.js 24+
- Yarn 4
- Twenty workspace with API access
- Basic TypeScript knowledge
Quick Start
1. Create New App
Use the app scaffolder to create a new application:- Basic project structure
- Example serverless function
- Configuration files
- Type definitions
2. Authenticate
Generate an API key in Twenty at/settings/api-webhooks, then authenticate:
3. Start Development
Run the dev server to watch for changes and sync automatically:- Build your application
- Sync to your workspace
- Watch for file changes
- Hot-reload on save
Project Structure
A typical Twenty app structure:Creating Custom Objects
Define new data models for your CRM:src/objects/post-card.object.ts
Field Types
Available field types:- TEXT - Single-line text
- NUMBER - Numeric values
- DATE_TIME - Timestamps
- BOOLEAN - True/false
- SELECT - Dropdown options
- MULTI_SELECT - Multiple choice
- RELATION - Link to other objects
- EMAIL - Email addresses
- PHONE - Phone numbers
- URL - Web links
- CURRENCY - Monetary values
- RATING - Star ratings
Building Serverless Functions
Create backend logic triggered by events:src/functions/create-post-card.function.ts
Trigger Types
- Route Trigger
- Database Event
- Scheduled
- Webhook
HTTP endpoint trigger:Accessible at:
{SERVER_URL}/functions/my-app/my-endpointUsing the SDK
Core API Client
Query and mutate workspace data:Metadata API Client
Manage workspace configuration:Creating UI Components
Build custom frontend components:src/front-components/dashboard.front-component.tsx
CLI Commands
Development Commands
Entity Management
Deployment
Testing Functions Locally
Test your functions before deploying:src/functions/__tests__/create-post-card.test.ts
App Manifest
Configure your application:src/manifest.ts
Best Practices
Type Safety
Use TypeScript throughout for better DX and fewer runtime errors
Error Handling
Always handle errors gracefully and return meaningful messages
Idempotency
Make functions idempotent so they can safely retry on failure
Logging
Log important actions for debugging and monitoring
Performance Tips
- Batch operations - Use
createManyinstead of multiplecreateOnecalls - Limit queries - Always specify
limitto avoid fetching too much data - Cache when possible - Store frequently accessed data in memory
- Use filters - Filter on the server instead of fetching and filtering locally
Security Considerations
- Validate input - Never trust user input, always validate
- Use permissions - Declare minimum required permissions
- Store secrets safely - Use app settings for sensitive data, not code
- Sanitize output - Prevent XSS in UI components
Example: Complete App
Here’s a complete example app:Next Steps
SDK Reference
Complete SDK documentation
Webhooks
Integrate with external systems
GraphQL API
Use the GraphQL API directly
Examples
Browse example apps
