e0bd4ab732
Part 5 of the app-docs audit series (after #22688–#22691).
## The problem
`front-components.mdx` warns that the legacy `/s/` route is deprecated
and **deactivates on 2026-07-24** (16 days from now), but the rest of
the docs still teach `/s/` as the only serving path:
`logic-functions.mdx` ("Exposes your function ... under the `/s/`
endpoint"), `logic/overview.mdx` ("A request hits your `/s/<path>`
endpoint"), and the document-generator tutorial fetches
`${TWENTY_API_URL}/s/...` from front-component code. A developer
following those pages today ships an app that breaks on Cloud in two
weeks.
## What this changes
- **logic/logic-functions.mdx** — httpRoute triggers are described as
served at the workspace's functions base URL (what the server injects as
`TWENTY_FUNCTIONS_URL`; a dedicated per-workspace domain on Cloud, per
`WorkspaceDomainsService.buildPublicFunctionBaseUrl`), with a warning
box covering the `/s/` deprecation and the self-host fallback.
- **logic/overview.mdx** — trigger table no longer hardcodes
`/s/<path>`.
- **document-generator tutorial** — the `curl
http://localhost:2020/s/...` examples stay (they're correct against the
local dev image, where no isolated functions domain exists), with a note
explaining the Cloud behavior. The front-component code snippets now use
the `TWENTY_FUNCTIONS_URL || TWENTY_API_URL + '/s'` fallback pattern —
the same one Twenty's own published apps use (e.g.
`packages/twenty-apps/public/call-recorder`).
Only English sources were touched; `l/<locale>` copies come from
Crowdin.
---
_Generated by [Claude
Code](https://claude.ai/code/session_01ExboyDAT19khDuKXaYXETT)_
<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/22693?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by: Martin <martin@twenty.com>
56 lines
3.2 KiB
Plaintext
56 lines
3.2 KiB
Plaintext
---
|
|
title: Overview
|
|
description: Server-side TypeScript that runs inside Twenty — triggered by HTTP routes, cron schedules, database events, AI tools, or workflow actions.
|
|
icon: "bolt"
|
|
---
|
|
|
|
A Twenty app's **logic layer** is the code that *runs* — server-side TypeScript handlers reacting to HTTP requests, cron schedules, and record changes; AI skills and agents that live inside the workspace; and OAuth connections that let your functions act on a user's behalf in third-party services.
|
|
|
|
```text
|
|
┌─ HTTP route ──┐
|
|
│ Cron schedule │
|
|
│ Database event │ ┌────────────────────┐
|
|
triggers ─┤ AI tool call ├─────▶│ Logic function │
|
|
│ Workflow action │ │ (your handler) │
|
|
│ Manual exec │ └────────────────────┘
|
|
└────────────────────┘ │
|
|
▼
|
|
┌────────────────────────────┐
|
|
│ Twenty API (records) │
|
|
│ Third-party API │
|
|
│ (via Connection token) │
|
|
└────────────────────────────┘
|
|
```
|
|
|
|
## In this section
|
|
|
|
<CardGroup cols={2}>
|
|
<Card title="Logic Functions" icon="bolt" href="/developers/extend/apps/logic/logic-functions">
|
|
The core building block — trigger types, payloads, and the typed API client.
|
|
</Card>
|
|
<Card title="Skills & Agents" icon="robot" href="/developers/extend/apps/logic/skills-and-agents">
|
|
Reusable AI agent instructions and assistants with custom system prompts.
|
|
</Card>
|
|
<Card title="Connections" icon="plug" href="/developers/extend/apps/logic/connections">
|
|
OAuth credentials your app holds for third-party services — Linear, GitHub, Slack, and more.
|
|
</Card>
|
|
</CardGroup>
|
|
|
|
## Trigger types at a glance
|
|
|
|
A logic function picks one or more triggers — every entry below is a separate field on `defineLogicFunction()`:
|
|
|
|
| Trigger | When it runs | Setting |
|
|
|---------|--------------|---------|
|
|
| **HTTP route** | A request hits your function's public URL | `httpRouteTriggerSettings` |
|
|
| **Cron** | A CRON expression matches | `cronTriggerSettings` |
|
|
| **Database event** | A workspace record is created, updated, or deleted | `databaseEventTriggerSettings` |
|
|
| **AI tool** | A Twenty AI feature decides to call your function | `toolTriggerSettings` |
|
|
| **Workflow action** | A workflow step invokes your function | `workflowActionTriggerSettings` |
|
|
|
|
Functions run sandboxed in isolated Node.js processes and access the workspace through a typed API client scoped to the role declared on [`defineApplication()`](/developers/extend/apps/config/application).
|
|
|
|
<Note>
|
|
**Install-time hooks** — code that runs before or after the install — share this runtime but use their own define functions and live under [Config → Install Hooks](/developers/extend/apps/config/install-hooks).
|
|
</Note>
|