Contributing to Twenty
Relevant source files
The following files were used as context for generating this wiki page:- README.md
- CLAUDE.md
- packages/twenty-docs/README.md
- packages/create-twenty-app/README.md
- packages/twenty-sdk/README.md
- packages/twenty-utils/dangerfile.ts
- packages/twenty-utils/congratulate-dangerfile.ts
- packages/twenty-website/src/app/_components/ui/layout/articles/ArticleEditContent.tsx
- packages/twenty-website/src/content/jobs/software-eng-intern.md
- packages/twenty-apps/community/webmetic/README.md
Twenty is an open-source project that thrives on community contributions. Whether you're fixing a bug, improving documentation, or building a new application, your input is valued. This guide provides a comprehensive overview of the development environment, coding standards, and contribution workflows to help you get started.
The project is built as an Nx monorepo using TypeScript, React, and NestJS. Contributions are welcome across the entire stack, from the frontend and backend core to documentation and community applications. The community is active on platforms like Discord, and all contributions are managed through GitHub pull requests.
Getting Started: Local Development
Before contributing, you need to set up the local development environment. The project uses Yarn 4 and Nx as a monorepo manager.
Sources: CLAUDE.md:10-12
Key Commands
The following table lists the most common commands for development, testing, and code quality checks. These are executed from the root of the monorepo.
| Command | Description |
|---|---|
yarn start | Starts the full development environment (frontend, backend, worker). |
npx nx start twenty-front | Starts only the frontend development server. |
npx nx start twenty-server | Starts only the backend server. |
npx nx run twenty-server:worker | Starts the background job worker. |
npx nx test twenty-front | Runs frontend unit tests. |
npx nx test twenty-server | Runs backend unit tests. |
npx nx run twenty-server:test:integration:with-db-reset | Runs backend integration tests with a database reset. |
npx nx lint twenty-front | Lints the frontend codebase. |
npx nx lint twenty-server --fix | Lints and auto-fixes the backend codebase. |
npx nx typecheck twenty-front | Runs TypeScript type checking on the frontend. |
npx nx fmt twenty-front | Formats the frontend code. |
npx nx run twenty-front:graphql:generate | Generates GraphQL types for the frontend. |
npx nx database:reset twenty-server | Resets the development database. |
Sources: CLAUDE.md:13-50
Development Principles
To maintain code quality and consistency, all contributions should adhere to the following principles:
| Principle | Description |
|---|---|
| Functional Components Only | Class components are not used in the React frontend. |
| Named Exports Only | Avoid default exports to ensure consistency. |
| Types Over Interfaces | Use type for custom definitions, except when extending third-party interfaces. |
| String Literals Over Enums | Prefer string literals for clarity, except for GraphQL enums. |
| No 'any' Type | All code must be strongly typed. |
| Event Handlers Over useEffect | Prefer event handlers for state updates triggered by user interactions. |
Sources: CLAUDE.md:82-88
Contribution Workflow
Contributions are made via GitHub Pull Requests. The general workflow involves forking the repository, creating a new branch, making changes, and then submitting a PR for review.
This diagram illustrates the high-level contribution process.
Pull Request Automation
The project uses DangerJS to automate several checks and actions on pull requests.
First-Time Contributors
If you are a first-time contributor, a bot will post a welcome message and ask you to agree to the Contributor License Agreement (CLA). This is a one-time process.
// packages/twenty-utils/dangerfile.ts:31-44
if (
danger.github &&
danger.github.pr &&
(danger.github.pr.author_association === 'FIRST_TIME_CONTRIBUTOR' ||
danger.github.pr.author_association === 'NONE')
) {
markdown(
getMdSection(
'Welcome!',
`
Hello there, congrats on your first PR! We're excited to have you contributing to this project.
By submitting your Pull Request, you acknowledge that you agree with the terms of our [Contributor License Agreement](https://github.com/twentyhq/twenty/blob/HEAD/.github/CLA.md).`,
),
);
}
For new contributors, issues labeled "good first issues" are a great place to start.
Sources: packages/twenty-utils/dangerfile.ts:31-44, packages/twenty-website/src/content/jobs/software-eng-intern.md:41-42
Automated Checks
DangerJS runs checks on every PR to ensure quality and consistency.
This sequence diagram shows the automated checks performed on a pull request.
Key automated checks include:
yarn.lockcheck: Warns ifpackage.jsonis modified butyarn.lockis not..env.examplecheck: Warns if.env.exampleis changed to ensure new variables are documented.- TODOs/Fixmes: Schedules a check to find any remaining
TODOorFIXMEcomments in the code.
Sources: packages/twenty-utils/dangerfile.ts:8-28, packages/twenty-utils/dangerfile.ts:47-47
Post-Merge Congratulations
After a contributor's PR is merged (and it's not their first one), a bot posts a congratulatory message with their contribution stats, such as their rank among all contributors.
Sources: packages/twenty-utils/congratulate-dangerfile.ts
Contributing to Documentation
Documentation is a vital part of the Twenty project. The official documentation is built with Mintlify and is located in the packages/twenty-docs directory.
Local Setup for Docs
To run the documentation site locally:
# From the twenty monorepo root
npx nx run twenty-docs:dev
The site will be available at http://localhost:3000.
Sources: packages/twenty-docs/README.md:15-19
Editing Content
The process for editing documentation is as follows:
- Edit MDX Files: Content is located in
user-guide/,developers/, andtwenty-ui/directories. - Update Navigation: If adding or removing pages, update
navigation/base-structure.json. - Generate Config: Run
yarn docs:generateto rebuild the maindocs.jsonconfiguration file used by Mintlify. - Submit a PR: Fork the repo, make your changes, and submit a pull request.
The documentation website also provides a direct link to edit content on GitHub, making it easy to suggest changes.
Sources: packages/twenty-docs/README.md:23-41, packages/twenty-website/src/app/_components/ui/layout/articles/ArticleEditContent.tsx:61-64
Contributing an Application
Another significant way to contribute is by building and sharing an application that extends Twenty's functionality. The create-twenty-app package and twenty-sdk provide the tools to do this.
App Contribution Workflow
This flowchart outlines the steps to create and contribute a new application to the Twenty ecosystem.
Scaffolding and Development
The recommended way to start is with create-twenty-app:
npx create-twenty-app@latest my-twenty-app
cd my-twenty-app
This command scaffolds a new project with a pre-configured structure and scripts that wrap the twenty-sdk CLI for authentication, code generation, and syncing with your workspace.
Sources: packages/create-twenty-app/README.md:23-24
Publishing Your App
Once your app is ready, you can share it with the community by submitting it to the main Twenty repository.
- Clone the
twentyhq/twentyrepository. - Create a new branch (e.g.,
feature/my-awesome-app). - Copy your application's folder into the
packages/twenty-appsdirectory. - Commit your changes and open a pull request.
The core team will review the submission for quality, security, and reusability before merging.
Sources: packages/create-twenty-app/README.md:59-73, packages/twenty-sdk/README.md:65-79, packages/twenty-apps/community/webmetic/README.md:20-21
Summary
Contributing to Twenty is a structured yet flexible process. Whether you are a seasoned developer or a first-time open-source contributor, there are many ways to get involved. By following the development principles, using the provided tools, and engaging with the community, you can help shape the future of this open-source CRM.
Sources: README.md:120-123