Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.{yml,yaml}]
indent_size = 2

[Makefile]
indent_style = tab
39 changes: 39 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Default owner
* @General-Intelligence-Company/twenty-team

# Frontend
/packages/twenty-front/ @General-Intelligence-Company/twenty-team
/packages/twenty-ui/ @General-Intelligence-Company/twenty-team
/packages/twenty-emails/ @General-Intelligence-Company/twenty-team

# Backend
/packages/twenty-server/ @General-Intelligence-Company/twenty-team

# Shared
/packages/twenty-shared/ @General-Intelligence-Company/twenty-team
/packages/twenty-utils/ @General-Intelligence-Company/twenty-team

# SDK & CLI
/packages/twenty-sdk/ @General-Intelligence-Company/twenty-team
/packages/twenty-cli/ @General-Intelligence-Company/twenty-team
/packages/create-twenty-app/ @General-Intelligence-Company/twenty-team

# Documentation
/packages/twenty-docs/ @General-Intelligence-Company/twenty-team
/packages/twenty-website/ @General-Intelligence-Company/twenty-team

# Integrations
/packages/twenty-zapier/ @General-Intelligence-Company/twenty-team
/packages/twenty-apps/ @General-Intelligence-Company/twenty-team

# Testing
/packages/twenty-e2e-testing/ @General-Intelligence-Company/twenty-team

# Infrastructure
/packages/twenty-docker/ @General-Intelligence-Company/twenty-team

# CI/CD
/.github/ @General-Intelligence-Company/twenty-team

# ESLint Rules
/packages/twenty-eslint-rules/ @General-Intelligence-Company/twenty-team
48 changes: 48 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,3 +373,51 @@ const result = processData(sanitizedInput);
- Review `.cursor/rules/` for specific guidelines
- Run `npx nx graph` to visualize package dependencies
- Use `npx nx show project <package>` to see available targets

## Branch Protection Rules

The `main` branch has strict protection rules that must be satisfied before merging:

### Required CI Status Checks

All of the following checks must pass:

| Check | Description |
|-------|-------------|
| `ci-front-status-check` | Frontend linting, type checking, and tests |
| `ci-server-status-check` | Backend linting, type checking, and tests |
| `ci-shared-status-check` | Shared packages validation |
| `ci-format-status-check` | Code formatting with Prettier |
| `ci-emails-status-check` | Email templates validation |
| `ci-create-app-status-check` | Create app scaffolding tests |
| `Cursor Bugbot` | Automated code review for common issues |

### Code Review Requirements

- **All conversations must be resolved** - Every comment thread on a PR must be marked as resolved before the merge button becomes available
- **Approvals required** - PRs require review approval from code owners
- **CODEOWNERS enforcement** - Changes to specific packages require approval from designated team members

## Preview Environment Testing

Pull requests automatically trigger Render preview deployments:

### Available Preview Services

- **twenty-server** - Full backend API deployment for testing API changes
- **twenty-worker** - Background job worker for testing async processing

### Using Preview Environments

1. Open a PR with your changes
2. Wait for the Render preview deployment to complete (check PR status)
3. Access the preview URL provided in the PR comments
4. Test your changes in the isolated environment
5. Preview environments are automatically cleaned up when the PR is closed

### Best Practices for Preview Testing

- Test API endpoints directly in the preview environment
- Verify database migrations work correctly
- Check background job processing with the worker preview
- Use preview URLs for integration testing before merge
23 changes: 23 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,26 @@ IMPORTANT: Use Context7 for code generation, setup or configuration steps, or li
- `tsconfig.base.json` - Base TypeScript configuration
- `package.json` - Root package with workspace definitions
- `.cursor/rules/` - Development guidelines and best practices

## Branch Protection

The `main` branch is protected and requires the following status checks to pass before merging:

- `ci-front-status-check` - Frontend CI checks
- `ci-server-status-check` - Server CI checks
- `ci-shared-status-check` - Shared package CI checks
- `ci-format-status-check` - Code formatting checks
- `ci-emails-status-check` - Email templates CI checks
- `ci-create-app-status-check` - Create app CI checks
- `Cursor Bugbot` - Automated code review

**Required conversation resolution** is enabled - all PR review conversations must be resolved before merging.

## Preview Environments

Render preview environments are configured for automatic deployment on pull requests:

- **twenty-server** - Backend API preview deployment
- **twenty-worker** - Background worker preview deployment

Preview environments are automatically created when a PR is opened and destroyed when the PR is closed or merged. Use these previews to test backend changes in isolation before merging.
81 changes: 81 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Base image for common dependencies
FROM node:24-alpine AS common-deps

WORKDIR /app

# Copy only the necessary files for dependency resolution
COPY ./package.json ./yarn.lock ./.yarnrc.yml ./tsconfig.base.json ./nx.json /app/
COPY ./.yarn/releases /app/.yarn/releases
COPY ./.yarn/patches /app/.yarn/patches

COPY ./packages/twenty-emails/package.json /app/packages/twenty-emails/
COPY ./packages/twenty-server/package.json /app/packages/twenty-server/
COPY ./packages/twenty-server/patches /app/packages/twenty-server/patches
COPY ./packages/twenty-ui/package.json /app/packages/twenty-ui/
COPY ./packages/twenty-shared/package.json /app/packages/twenty-shared/
COPY ./packages/twenty-front/package.json /app/packages/twenty-front/

# Install all dependencies
RUN yarn && yarn cache clean && npx nx reset


# Build the back
FROM common-deps AS twenty-server-build

# Copy sourcecode after installing dependences to accelerate subsequents builds
COPY ./packages/twenty-emails /app/packages/twenty-emails
COPY ./packages/twenty-shared /app/packages/twenty-shared
COPY ./packages/twenty-server /app/packages/twenty-server

RUN npx nx run twenty-server:build

RUN yarn workspaces focus --production twenty-emails twenty-shared twenty-server

# Build the front
FROM common-deps AS twenty-front-build

ARG REACT_APP_SERVER_BASE_URL

COPY ./packages/twenty-front /app/packages/twenty-front
COPY ./packages/twenty-ui /app/packages/twenty-ui
COPY ./packages/twenty-shared /app/packages/twenty-shared
RUN npx nx build twenty-front


# Final stage: Run the application
FROM node:24-alpine AS twenty

# Used to run healthcheck in docker
RUN apk add --no-cache curl jq

RUN npm install -g tsx

RUN apk add --no-cache postgresql-client

COPY ./packages/twenty-docker/twenty/entrypoint.sh /app/entrypoint.sh
RUN chmod +x /app/entrypoint.sh
WORKDIR /app/packages/twenty-server

ARG REACT_APP_SERVER_BASE_URL
ENV REACT_APP_SERVER_BASE_URL=$REACT_APP_SERVER_BASE_URL

ARG APP_VERSION
ENV APP_VERSION=$APP_VERSION

# Copy built applications from previous stages
COPY --chown=1000 --from=twenty-server-build /app /app
COPY --chown=1000 --from=twenty-server-build /app/packages/twenty-server /app/packages/twenty-server
COPY --chown=1000 --from=twenty-front-build /app/packages/twenty-front/build /app/packages/twenty-server/dist/front

# Set metadata and labels
LABEL org.opencontainers.image.source=https://github.com/twentyhq/twenty
LABEL org.opencontainers.image.description="This image provides a consistent and reproducible environment for the backend and frontend, ensuring it deploys faster and runs the same way regardless of the deployment environment."

RUN mkdir -p /app/.local-storage /app/packages/twenty-server/.local-storage && \
chown -R 1000:1000 /app

# Use non root user with uid 1000
USER 1000

CMD ["node", "dist/main"]
ENTRYPOINT ["/app/entrypoint.sh"]
Loading