NocoCRM is a complete NocoBase 3 application: it was generated from the NocoBase application template and has its own data model, services, APIs and pages on top of the foundation. All of its source is in the GitHub repository, and you can change it directly to add fields, pages, reports or agent capabilities for your own business.
This section is for developers. To get the code and start it locally, see Get started.
Foundation capabilities NocoCRM uses
General capabilities such as permissions, agents, mail, notifications and scheduled tasks come from NocoBase 3; NocoCRM does not rebuild them. Before you change any of these parts, read the documentation of the plugin behind it.
| From NocoBase 3 | What NocoCRM uses it for |
|---|---|
| Application server, database layer and command line | The server, migrations and seed data, configuration, build and deployment |
| Application template and UI component library | Layout, routes, theme, the sign-in page, and the components every page uses |
| Authentication, users and API keys | Sign-in, user accounts and personal API keys |
| Authorization (permission sets, record access rules) | The three roles, what each person can see and edit on every record, page grants, and the role settings page |
| Agents plugin | Agents, conversations, skills, model services, usage, and the commands the CRM gives agents |
| Notification plugins | In-app notifications |
| Lifecycle library | Approval states and transitions, the actions each transition triggers, approver rules, and the flow chart on the approval process settings page |
| Scheduled tasks | The daily check, task preparation and the company signals check |
| Mail plugin | Each member's mailbox: syncing, reading, writing and sending |
| File and i18n plugins | Attachments and their previews, and the 12 interface languages |
| Database Explorer | Read-only browsing of the application's tables |
Develop with a coding agent
We recommend letting a coding agent such as Claude Code or Codex change the code. AGENTS.md at the repository root is the development guide written for them: where code goes, how to write migrations, the rules for APIs and permissions, and what to check after a change. .agents/rules/crm-*.md records the CRM's own conventions by topic, such as record pages, approvals, agents and permissions; pnpm install also syncs the NocoBase 3 development skills into .agents/skills/.
When you give an agent a task, just state the business goal, for example "Add a contract number field to opportunities, and show it in the list and on the detail page." The agent follows these guides to find what to change.
Code structure
The CRM's own code lives mainly here:
client/
routes.ts Routes and menus of all business pages
pages/ Pages: the workspace, list and detail pages of each record type, reports, Agents, business guidance, mail, WhatsApp, settings
components/crm/ CRM components: record forms, timeline, AI cards, import and export, report charts and more
components/ui/ shadcn/ui primitives, added only with the CLI
locales/crm/ The CRM's interface text: index.ts holds English and Chinese, and each of the other 10 languages has its own file
server/
providers/crm/ The CRM's business core: CrmService, field definitions, permissions, conversion, merging, background AI, reports, notifications
providers/crm-agents/ How the CRM plugs into the Agents plugin: the Sales Expert, background agents, skills, conversation rules
lifecycles/approvals.ts The approval state machine
routes/ HTTP APIs
config/ Plugin configuration
locales/crm-ai/texts/ Text the AI writes, one file for each of the 12 languages
ai/skills/ SKILL.md of the six built-in method skills
database/main/migrations/ Database migrations
database/main/seeds/ Initial data: the two sales permission sets
tests/ Logic tests, component tests and browser testsThe two most important files:
server/providers/crm/schema.ts: the field definitions of the six business objects. Server validation, the API document, forms, list columns, import and export, and the command descriptions for agents are all generated from it; see Data model.server/providers/crm/service.ts:CrmService. Every read and write of a record goes through it, and it handles record permissions, field rules and system-maintained fields.
These directories follow the common structure of a NocoBase 3 application; see Project structure. For the common way to build pages, APIs, permissions and tests, see Application development overview.
Common commands
| Command | What it does |
|---|---|
pnpm dev | Starts the server and client with hot reload; pending migrations run on start |
pnpm build | Builds to dist/ |
pnpm start | Runs the build |
pnpm test | Runs the tests in tests/ |
pnpm typecheck | Type-checks the client and server |
pnpm lint | Lints the code |
pnpm nocobase db apply | Runs pending migrations and seeds without a restart |
pnpm nocobase --help | Lists all other commands |
For everyday changes, check only the affected files, for example pnpm exec vitest run tests/logic/crm.test.ts. pnpm check runs every check and the build, which suits the time before a release.
API document and API keys
Every CRM API is declared in the API document, and the tests check this:
- OpenAPI document:
<app URL>/api/swagger - Interactive Swagger page:
<app URL>/api/swagger/docs, usuallyhttp://127.0.0.1:13000/main/api/swagger/docsin local development
Requests can use a signed-in session or carry an x-api-key header. Administrators manage keys in System settings › API keys, and each member can also create their own keys in personal settings. A key calls the API with the identity and permissions of the person who created it.
The CRM's APIs sit directly under /api, for example /api/leads and /api/opportunities. On success they return { data }, and lists also return meta; on failure they return the standard error structure.