fdab89ae02
# Introduction The `twenty-client-sdk` is always provided and injected at runtime by the twenty-server instance Which mean that even if in your app locally you're using twenty-client-sdk `1.0` installing this app on twenty instance `2.0` will result in injecting another `twenty-client-sdk` That's the expected behavior and tradeof The twenty-app devdep should only be used to guide local devxp following typesafety and so on A user can still locally generated its own twenty-client-sdk and publish it if necessary <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/twentyhq/twenty/pull/21611?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. -->
62 lines
2.7 KiB
Plaintext
62 lines
2.7 KiB
Plaintext
---
|
|
title: Project Structure
|
|
description: What's inside a scaffolded Twenty app — files, folders, and what each one does.
|
|
icon: "folder-tree"
|
|
---
|
|
|
|
A new app generated by `npx create-twenty-app` looks like this:
|
|
|
|
```text filename="my-twenty-app/"
|
|
my-twenty-app/
|
|
package.json
|
|
src/
|
|
application-config.ts # Required — your app's entry point
|
|
default-role.ts # Permissions for logic functions
|
|
constants/
|
|
universal-identifiers.ts # Auto-generated UUIDs and metadata
|
|
__tests__/
|
|
setup-test.ts
|
|
app-install.integration-test.ts
|
|
.github/workflows/ci.yml # GitHub Actions
|
|
public/ # Static assets
|
|
vitest.config.ts # Test runner config
|
|
tsconfig.json, tsconfig.spec.json
|
|
.nvmrc, .yarnrc.yml, .oxlintrc.json
|
|
README.md, LLMS.md
|
|
```
|
|
|
|
## Key files
|
|
|
|
| File / Folder | Purpose |
|
|
|---|---|
|
|
| `src/application-config.ts` | **Required.** The main configuration file for your app. |
|
|
| `src/default-role.ts` | Default role controlling what your logic functions can access. |
|
|
| `src/constants/universal-identifiers.ts` | Auto-generated UUIDs and metadata (display name, description). |
|
|
| `src/__tests__/` | Integration tests (setup + example test). |
|
|
| `public/` | Static assets (images, fonts) served with your app. |
|
|
|
|
<Note>
|
|
**File organization is up to you.** The folders above are conventions — the SDK detects entities via AST analysis on `export default defineEntity(...)` calls regardless of where the file lives.
|
|
</Note>
|
|
|
|
## Dependencies
|
|
|
|
Both Twenty SDK packages belong under `devDependencies`, not `dependencies`:
|
|
|
|
```json filename="package.json"
|
|
{
|
|
"dependencies": {},
|
|
"devDependencies": {
|
|
"twenty-client-sdk": "^2.13.0",
|
|
"twenty-sdk": "^2.13.0"
|
|
}
|
|
}
|
|
```
|
|
|
|
- **`twenty-sdk`** ships the `twenty` CLI and the build/scaffolding tooling. It only runs at development and build time and is never imported by your published app's runtime.
|
|
- **`twenty-client-sdk`** _is_ imported by your app code (`CoreApiClient`, `MetadataApiClient`, `RestApiClient`), but Twenty provides it at runtime — logic functions get it from a generated SDK layer, and front components resolve it from server-served modules. Your installed copy is only used for typechecking and the deploy-time build, so it never needs to ship in the deployed bundle.
|
|
|
|
Keeping either package under `dependencies` pulls it into the installed app's runtime bundle, where it is dead weight. `twenty build` emits a warning when either is still listed under `dependencies`.
|
|
|
|
Add your app's own runtime dependencies (libraries your logic functions actually import at runtime) under `dependencies` as usual.
|