Introducing a new way to review your PRs.

Read the announcement

frappe / crm

Fully featured, open source CRM

View on GitHub

24 documents · Updated Nov 23, 2026

docs / crm-client-application

CRM client application

The CRM client application is a Vue single-page application that gives CRM users one place to manage leads, deals, contacts, organizations, activities, and sales insight. It combines URL-based navigation with shared user and view state, then places each feature inside a responsive application shell with common dialogs, notifications, and call controls.

Application bootstrap

The application starts from home/…/main.js. The bootstrap creates the Vue app, installs the UI library, Pinia for shared state, the router, translations, icons, and telemetry, then exposes the dialog service and real-time socket to the rest of the client.

Startup sequence

The startup path prepares the browser context before it mounts the CRM interface. In development it first loads server context so the local app has the same site and session values as the server; in other modes it connects directly and mounts the app.

The main stages are:

  1. Load the global style and create the Vue app with App.vue.
  2. Register shared services and UI primitives.
  3. Configure the Frappe request layer and install Pinia, translations, telemetry, and the router.
  4. Create the Socket.IO connection and expose it as $socket.
  5. Mount the app at #app.

The build serves the client under the CRM asset base and copies the generated HTML entry point into the server web path. This makes the browser application a route-aware page inside the Frappe site rather than a separate service. References: frontend/…/main.js• L1-79, frontend/package.json• L9-16

Application root

App.vue provides the common UI context and decides which top-level surface the user can see. A permitted, signed-in user receives the responsive layout and the current route; setup and permission-denied pages bypass the normal shell so they can guide or stop access without the main navigation.

The root keeps shared dialogs and doctype modals mounted outside route content, so pages can open common actions without owning the lifetime of those overlays. It also sets the default theme and passes translated messages and time-zone values to the shared UI provider. References: frontend/…/App.vue• L1-48, frontend/…/dialogs.jsx• L4-45, frontend/…/DoctypeModals.vue

Route model

The router maps CRM URLs to feature pages and supplies the access checks that surround each navigation. It uses browser history below /crm, lazy-loads most page views, and passes record identifiers or view selections through route parameters and queries.

Access and landing flow

Navigation begins with the session cookie. If the visitor is not signed in, the router sends the browser to the login page with a return path to CRM. A signed-in user must belong to the CRM user set; otherwise the application shows the permission page.

The root route is a landing decision rather than a content page. It resolves the user’s saved default view and opens that view, or falls back to the leads list when no default exists. Before normal navigation, an administrator may be sent to the setup page when the server says that CRM setup is incomplete. The setup decision uses the server-provided crm_setup_pending value for the page session; it does not use a local completion flag to suppress a later setup check. References: frontend/…/router.js• L7-19, frontend/…/router.js• L156-215, frontend/…/landingPage.js• L1-28, frontend/…/session.js• L7-29

List and record routes

The route map separates collection pages from record pages. Collection routes cover leads, deals, contacts, organizations, notes, tasks, call logs, and data imports. Record routes carry the record ID for leads, deals, contacts, and organizations. The dashboard, notifications, welcome, setup, import, and access pages form the main supporting surfaces.

List URLs can name a view type such as list, kanban, or group_by, while saved views travel in the view query. When a user leaves these values out, the router resolves the saved or standard default before the page renders. Record pages also restore the last selected lead or deal tab from local storage when the URL has no hash. References: frontend/…/router.js• L21-148, frontend/…/router.js• L214-307

Responsive page selection

The client changes both its shell and some record pages for small screens. The root chooses the mobile shell below 640 pixels, while the router chooses mobile lead, deal, contact, and organization pages below 768 pixels. The result is a compact navigation and record experience without changing the CRM URL model. References: frontend/…/App.vue• L31-43, frontend/…/router.js• L150-154, frontend/…/router.js• L44-95, frontend/…/MobileLayout.vue• L1-15

Shared application state

Shared state combines Pinia stores with Frappe UI resources. A resource represents data fetched from the server and can cache, reload, transform, and submit that data; stores make the parts needed by many pages available through one client-level contract.

Session and user context

The session store turns the user_id cookie into the signed-in state and owns login and logout transitions. The users store then loads the CRM user set, resolves names and roles for display and access checks, and supplies role questions such as administrator, manager, sales user, and telephony agent.

This user context connects routing, navigation, filters, avatars, assignment controls, and dashboard access. The fast CRM-user load supports early interaction, while later lookups fill in user details needed by comments, owners, and recipient controls. References: frontend/…/session.js• L7-36, frontend/…/users.js• L10-66, frontend/…/users.js• L113-181

View and configuration context

The views store gives navigation and list pages a common model for standard, public, pinned, and personal views. It also identifies the user’s default view, which links the landing route to the list page that the user expects to open.

Metadata and settings provide the other shared configuration layer. Metadata describes fields and user layout choices for a doctype, while CRM settings provide brand values and product-level choices such as the default calendar view. These resources let pages use the same field rules, labels, formatting, and brand context. References: frontend/…/views.js• L5-82, frontend/…/meta.js• L6-32, frontend/…/settings.js• L4-30

Onboarding progress

The CRM onboarding composable connects checklist progress with product telemetry. A feature can mark a step complete when the checklist is ready; if setup has not yet created the checklist, the composable holds the step and flushes it after the checklist becomes available. This keeps user progress from being lost during the setup boundary and records completed steps for product measurement. References: frontend/…/onboarding.js• L1-30

Cross-feature services

Some shared behavior is held outside a single page because it crosses feature boundaries. The global store exposes dialogs, the socket, and the call action. Notifications provide unread counts and read state for the shell. Status and organization stores supply shared labels and lookup data for list rows, record pages, and activity controls.

Feature flags also shape the visible interface. Telephony integration state controls call actions and the header call UI, while WhatsApp availability controls record tabs and integration settings. References: frontend/…/global.js• L4-23, frontend/…/notifications.js• L6-43, frontend/…/statuses.js• L8-122, frontend/…/organizations.js• L6-36, frontend/…/telephony.js• L4-40, frontend/…/whatsapp.js• L4-23

Real-time connections

The client keeps a Socket.IO connection for server-driven updates. The connection is created during bootstrap and uses the current site context, so it can receive events for the same authenticated Frappe site.

Resource refresh

The main real-time contract is refetch_resource. When the server names a cached resource, the client finds the matching single-resource or list-resource cache and reloads it. Pages therefore update through their existing data resources instead of each page defining a separate event protocol.

Record resources can also enable real-time behavior when a socket is present. This gives record views a path to refresh document state while preserving the same resource model used for normal fetches and saves. References: frontend/…/socket.js• L1-31, frontend/…/document.js• L25-38

Event alerts

Event alerts add a user-facing layer above event data. Active alerts are kept in browser storage, completed events are remembered in user settings, and the root popup can send the user to the calendar for the selected event. This connects background event awareness with the normal calendar route rather than creating a second event view. References: frontend/…/notifications.js• L24-172, frontend/…/EventNotificationPopup.vue• L53-89

User interface composition

The CRM interface is composed from a stable shell and route-owned feature pages. The shell supplies navigation, the header, global modals, calls, settings, and help; the route page supplies the current list, record, dashboard, calendar, or setup surface.

Application shell

The desktop shell places the sidebar beside the header and route content. The mobile shell replaces these with mobile navigation and a mobile header while keeping global modals available. The sidebar builds its main links from CRM features and adds saved public or pinned views from shared view state.

The desktop sidebar can also show a Frappe Cloud trial card when billing settings are available. The card turns the current trial state into a dismissible notice or a billing action, and the action opens the shared Cloud Settings surface.

For a closer explanation of navigation state, saved views, sidebar behavior, and shell actions, see Client shell and navigation. References: frontend/…/DesktopLayout.vue• L1-15, frontend/…/MobileLayout.vue• L1-15, frontend/…/AppSidebar.vue• L116-146, frontend/…/AppSidebar.vue• L254-355, frontend/…/AppHeader.vue• L1-12, frontend/…/TrialCard.vue• L1-31, frontend/…/trialCard.js• L51-87, frontend/…/cloudSettings.js• L29-55

Record and list surfaces

List pages combine shared view controls with a doctype-specific table or board. They support filtering, paging, saved view selection, row actions, and creation flows. Record pages then provide the focused work area for one lead, deal, contact, or organization, with activity, details, assignment, status, files, and related actions around the record.

For the record lifecycle and the shared patterns across record pages, see Client record views. References: frontend/…/Leads.vue• L1-43, frontend/…/Leads.vue• L234-267, frontend/…/Lead.vue• L1-49, frontend/…/Lead.vue• L50-239, frontend/…/Contacts.vue• L1-60

Dashboards and workspaces

The dashboard is a role-aware workspace for sales measures and charts. It loads a layout with date and user filters, allows managers to edit or reset the layout, and shares the selected filter context with its chart grid. The calendar is another workspace: it scopes open events to a date range and user, then supports event creation, editing, movement, deletion, and navigation from notifications.

For the dashboard layout, chart behavior, calendar workspace, and related work areas, see Dashboards and workspaces. References: frontend/…/Dashboard.vue• L1-41, frontend/…/Dashboard.vue• L172-250, frontend/…/Calendar.vue• L21-41, frontend/…/Calendar.vue• L217-280

Shared work actions

Pages use common actions to keep work connected across the CRM. A user can start a call from a record or list row, open notes and tasks against a record, attach files, edit settings, and respond to event alerts without leaving the application shell. The header hosts the call UI, while global modal containers keep creation and edit flows above the current route.

This composition keeps feature pages focused on their business surface. Shared services handle actions that must work in more than one page or must remain available while the route changes. References: frontend/…/AppHeader.vue• L1-12, frontend/…/CallUI.vue• L45-133, frontend/…/GlobalModals.vue• L1-39, frontend/…/Lead.vue• L130-180

Rich-text editing

Rich-text editing is a shared UI capability for CRM fields that need formatted text. RichTextField provides one editor contract for editable and read-only use, with optional fixed or selection-based menus, change events, and file upload support. Its shared editor configuration keeps formatting, mentions, links, media, tables, and safe file handling consistent across the user interface. References: frontend/…/RichTextField.vue• L1-58, frontend/…/config.ts• L28-100, frontend/package.json• L18-41

Change checklist

When these files or sections are changed, remember to consider these:

  • When changing route names, view parameters, or aliases in frontend/…/router.js, update sidebar links, saved-view route data, breadcrumbs, and any links that open record tabs.
  • When changing the session or CRM-user contract, check both route access decisions and every role-gated shell or dashboard action.
  • When changing setup completion checks or the setup route, keep the administrator gate, server setting, page-session setup flag, and root-level shell bypass aligned.
  • When changing cached resource names or the refetch_resource payload, keep the socket refresh lookup aligned with the resource cache used by the affected page.
  • When changing mobile breakpoints or mobile route selection, check both the shell breakpoint in App.vue and the record component selection in router.js.
  • When changing shared doctype metadata or user settings, check list formatting, record layouts, view controls, and saved settings because they read from the same metadata context.
  • When changing onboarding step names or checklist initialization, keep pending-step flushing and telemetry event names aligned with the onboarding checklist.
  • When changing event alert persistence, keep browser-stored alert IDs aligned with the event names and the user-setting records used to suppress completed alerts.
  • When changing the trial card or Cloud Settings entry point, keep the billing availability check, trial-state wording, dismissal behavior, upgrade telemetry, and dialog refresh behavior aligned.
  • When changing the shared rich-text field or editor menus, keep field change events, mention IDs, and upload targets aligned with the forms and server comment handling that consume them.

Important failure modes

TriggerConsequenceGuard
A signed-in user is not in the CRM user setThe router sends the user to Not Permitted instead of loading CRM pages.Keep the user resource available before access checks and keep CRM membership data aligned with server roles.
CRM setup is incomplete for an administratorNormal CRM navigation redirects to setup until the setup state is complete.Keep the server setting, page-session setup flag, and setup access check aligned.
A default or saved view points to an unknown route or viewHome or a list URL can fall back to Leads or list mode and lose the user’s intended view.Preserve route names and view types across the views API, router normalization, and sidebar links.
The socket sends a cache key that has no matching Frappe UI resourceThe page does not refresh from the event and can show stale data.Use the same cache key for the resource and the server refetch event.
A record save fails validation or permission checksThe record stays unchanged or rolls back an optimistic field change and the user sees an error.Keep metadata, mandatory-field rules, and document permissions in sync with the server doctype.
A mobile route is selected at a different breakpoint from the shellA mobile record page can appear inside a desktop shell or the reverse.Treat the shell and record breakpoints as one responsive contract.
An onboarding step completes before the checklist existsThe step is delayed until the checklist is ready; a missing flush can leave progress unrecorded.Keep the pending-step queue connected to checklist initialization.
Cloud billing settings are unavailable or the billing dialog cannot openThe trial card is hidden or the user receives no working path to choose a plan.Keep the Cloud Settings availability check and billing dialog contract aligned with the trial card.
A rich-text field sends a stale value or an invalid mention or upload targetForm content can be lost or a linked comment or file can point to the wrong record.Keep the field value, mention identifiers, and upload document context aligned across the shared editor and its consumers.

Key files

FileWhy to read it
frontend/…/main.jsDefines the client bootstrap and installs the shared application services.
frontend/…/App.vueShows the root composition, responsive shell choice, UI provider context, and persistent overlays.
frontend/…/router.jsDefines the URL model, access gates, setup checks, default-view resolution, and mobile record selection.
frontend/…/landingPage.jsDefines how saved landing pages and views become router destinations.
frontend/…/socket.jsDefines the server-to-client resource refresh contract.
frontend/…/session.jsDefines signed-in state and login or logout transitions.
frontend/…/onboarding.jsConnects checklist progress with telemetry and protects steps during setup.
frontend/…/users.jsDefines CRM membership, user lookup, and role context.
frontend/…/views.jsDefines saved, standard, public, pinned, and default views.
frontend/…/document.jsShows the shared record resource and document lifecycle used by record pages.
frontend/…/AppSidebar.vueShows how feature navigation, saved views, and contextual sidebar actions become the shell menu.
frontend/…/TrialCard.vueIllustrates the conditional trial notice and its entry point to billing settings.
frontend/…/RichTextField.vueShows the shared formatted-text field used by CRM forms and work surfaces.
frontend/…/config.tsDefines the common editor features, menus, mentions, and file-upload contract.
frontend/…/Lead.vueIllustrates the full record work surface and its shared actions.
frontend/…/Dashboard.vueIllustrates a filtered and editable CRM workspace.
frontend/…/Calendar.vueIllustrates a date-based workspace with event CRUD and user scope.