Code Standards

Write code that passes lint, build, and review. This guide follows version 3.1.7 (03acdf712c) and the plugin rules.

For the workflow, see Contribute to the Codebase.

Boundaries

  • Change only the owning projects: backend/plugins/<name>_api/** plus frontend/plugins/<name>_ui/** for a plugin task. Do not import another plugin's source or change core/shared contracts implicitly.
  • Share via public interfaces: erxes-api-shared, erxes-ui, ui-modules, published GraphQL/tRPC/HTTP/event contracts.
  • Keep each changed plugin's AGENTS.md in sync, including its bounded recent-changes section (10 entries).

TypeScript and UI

  • Type new and modified code; avoid any in application code. Use named application exports (tool configs may require a default export).
  • UI: public erxes-ui and ui-modules components, React Hook Form plus Zod, Apollo cache updates or refetch after mutations, loading/empty/error states for every view.
  • Backend: tenant models from the request subdomain, permission checks before sensitive operations, explicit Mongoose fields following the module's Schema plus schemaWrapper pattern, thin resolvers with logic in services/models.
  • GraphQL: explicit, unique, plugin-prefixed operation names colocated with the feature.

Formatting and lint

Root uses Prettier, ESLint, and Nx task orchestration (nx.json, eslint.config.js). Run the owning project's targets before pushing; see Testing.

Source references

Was this helpful?