# Core Platform

Shared records, permissions, automations, and data exchange every plugin builds on


The shared records and services every erxes plugin builds on: organizations and permissions, contacts, products, custom fields and segments, forms and documents, automations, broadcasts, email delivery, and bulk import/export.

Core API (`backend/core-api`, port `3300`) is the always-on service behind the `core` subgraph. It registers with the gateway the same way a plugin API does, through its own bootstrap in [src/main.ts](https://github.com/erxes/erxes/blob/f91e8c6f4714c910a32c6b6e14fe085f6435c89e/backend/core-api/src/main.ts), but holds the platform's shared data model: the collections plugins link to rather than duplicate. Everything in this section is a core-api module or a shared pipeline it runs; plugin APIs reach them through shared service interfaces, never by reading core's collections directly.

## How plugins use core

- **tRPC.** [init-trpc.ts](https://github.com/erxes/erxes/blob/f91e8c6f4714c910a32c6b6e14fe085f6435c89e/backend/core-api/src/init-trpc.ts) merges each module's router into the core `appRouter`, served at `/trpc`. A plugin builds a typed client through `getPlugin('core')`; the generator writes one into `src/trpc/trpcClients.ts`. It calls procedures such as `users.findOne` or `customers.count`.
- **`meta` hooks.** The `meta` object a plugin passes to `startPlugin` (`permissions`, `automations`, `segments`, `notifications`, `importExport`, `afterProcess`, `references`) is serialized into the Redis key `erxesservice:config:<name>` and read back by core-api, the gateway, and the background services. That is how a plugin adds permission actions, automation triggers and actions, segment types, notification types, and import/export handlers without touching core code. See [Plugin Metadata & Extensions](https://erxes.io/docs/plugin-metadata-extensions) for the full `meta` registration.
- **Shared interfaces.** `erxes-api-shared/core-modules` holds the domain interfaces and producer helpers (`automations`, `segments`, `permissions`, `properties`, `forms`, `import-export`, and more) that both core and plugins compile against.

## Module map

Each guide covers one area's data model, GraphQL API, permissions, and extension hooks.

| Area | core-api location | Guide |
| --- | --- | --- |
| Team members, structure, brands, RBAC | `modules/organization`, `modules/permissions`, `modules/auth` | [Organizations, Users & Permissions](https://erxes.io/docs/core-organizations-users) |
| Customers and companies | `modules/contacts` | [Contacts](https://erxes.io/docs/core-contacts) |
| Catalog, categories, units of measure | `modules/products` | [Products](https://erxes.io/docs/core-products) |
| Custom fields, tags, dynamic audiences | `modules/properties`, `modules/tags`, `modules/segments` | [Properties, Tags & Segments](https://erxes.io/docs/core-properties-tags-segments) |
| Document templates with placeholders | `modules/documents` (`modules/forms` is a legacy shell; the working forms module is in `frontline_api`. See [Forms & Surveys](https://erxes.io/docs/frontline-forms-surveys)) | [Documents](https://erxes.io/docs/core-forms-documents) |
| Workflow engine and approval locks | `modules/automations`, `modules/approval`, plus the `services/automations` worker (see [Background Services](https://erxes.io/docs/architecture-background-services)) | [Automations & Approvals](https://erxes.io/docs/core-automations-approvals) |
| Campaigns and in-app/email notifications | `modules/broadcast`, `modules/notifications` | [Broadcasts & Notifications](https://erxes.io/docs/core-broadcast-notifications) |
| Outbound transports and inbound mail | `src/utils/email` and `erxes-api-shared/src/utils/email`; inbound via `cloudflare/mail-worker` into `frontline_api` | [Email Delivery](https://erxes.io/docs/api-email) |
| Bulk CSV load and extraction | `modules/import-export` | [Import & Export](https://erxes.io/docs/core-import-export) |

Core API also contains modules without a dedicated page: `clientportal` (portal records and portal-user auth, see [Client Portal](https://erxes.io/docs/app-client-portal)), `apps` (machine tokens), `conformities` and `relations` (record linking), `internalNote`, `search`, `template`, and `logs`.

## Guides

- [Organizations, Users & Permissions](https://erxes.io/docs/core-organizations-users): Tenants, team members, structure, and RBAC
- [Contacts](https://erxes.io/docs/core-contacts): Customers and companies with tags and segments
- [Products](https://erxes.io/docs/core-products): Catalog, categories, units, and pricing helpers
- [Properties, Tags & Segments](https://erxes.io/docs/core-properties-tags-segments): Custom fields, labels, and dynamic audiences
- [Documents](https://erxes.io/docs/core-forms-documents): Reusable document templates with placeholders, print and barcode rendering
- [Automations & Approvals](https://erxes.io/docs/core-automations-approvals): Workflows, executions, and approval locks
- [Broadcasts & Notifications](https://erxes.io/docs/core-broadcast-notifications): Campaigns and in-app plus email notifications
- [Email Delivery](https://erxes.io/docs/api-email): Transactional email transports, templates, and the Cloudflare mail worker
- [Import & Export](https://erxes.io/docs/core-import-export): Bulk-load and extract records

